-
Notifications
You must be signed in to change notification settings - Fork 816
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
Conversation
There was a problem hiding this 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.
pkg/ingester/active_series_test.go
Outdated
|
||
"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)) | ||
} |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
pkg/ingester/active_series.go
Outdated
@@ -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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, has been removed.
pkg/ingester/ingester.go
Outdated
ref, copiedLabels := app.GetRef(cortexpb.FromLabelAdaptersToLabels(ts.Labels)) | ||
tsLabels := cortexpb.FromLabelAdaptersToLabels(ts.Labels) | ||
tsLabelsHash := tsLabels.Hash() | ||
ref, copiedLabels := app.GetRef(tsLabels,tsLabelsHash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems not compilable.
There was a problem hiding this comment.
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
Signed-off-by: tanghengjian <[email protected]>
Signed-off-by: tanghengjian [email protected]
issue details in #4915