Skip to content

func (i *Ingester) Push has some performance issues.(#4915) #4940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

t00350320
Copy link
Contributor

Signed-off-by: tanghengjian [email protected]

issue details in #4915

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the good work! 👍
Let's also update the PR title. func (i *Ingester) Push has some performance issues.(#4915) is not very descriptive about what you plan to change.


"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/assert"
)

func copyFn(l labels.Labels) labels.Labels { return l }

func FromLabelAdaptersToLabels(ls []labels.Label) labels.Labels {
return *(*labels.Labels)(unsafe.Pointer(&ls))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems redundant. Let's use cortexpb.FromLabelAdaptersToLabels.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cortexpb.FromLabelAdaptersToLabels only handle a []LabelAdapter labels, this may change current tests' variables, so a new local FromLabelAdaptersToLabels seems better suitable.

@@ -53,8 +53,8 @@ func NewActiveSeries() *ActiveSeries {
}

// Updates series timestamp to 'now'. Function is called to make a copy of labels if entry doesn't exist yet.
func (c *ActiveSeries) UpdateSeries(series labels.Labels, now time.Time, labelsCopy func(labels.Labels) labels.Labels) {
fp := fingerprint(series)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are not going to use fingerprint(series), then it is not used anywhere else. Let's remove related code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, has been removed.

ref, copiedLabels := app.GetRef(cortexpb.FromLabelAdaptersToLabels(ts.Labels))
tsLabels := cortexpb.FromLabelAdaptersToLabels(ts.Labels)
tsLabelsHash := tsLabels.Hash()
ref, copiedLabels := app.GetRef(tsLabels,tsLabelsHash)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not compilable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because this is related with vendor/prometheus . don't know how to match these two projects' codes.
BTW, the PR of prometheus is pendding.
prometheus/prometheus#11485

t00350320 added a commit to t00350320/cortex that referenced this pull request Nov 1, 2022
@t00350320 t00350320 closed this Nov 1, 2022
@pull-request-size pull-request-size bot added size/XS and removed size/M labels Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants