-
Notifications
You must be signed in to change notification settings - Fork 38
wip: refactor: uniquely identify metric time series by name and label sets #131
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
base: main
Are you sure you want to change the base?
wip: refactor: uniquely identify metric time series by name and label sets #131
Conversation
} | ||
|
||
private enum MetricType { | ||
case counterMetrics(String, MetricContainer<Counter>) |
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.
In general not sure yet about naming, ideas?
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.
Also I would love to benefit from your Swift expertise re below ... it's probably the Type? It should be typed out for each metric type?
note: consider making enum 'MetricType' conform to the 'Sendable' protocol
private enum MetricType {
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.
Yeah Type isn't right, this isn't a type, it's a container. Something feels off with the names here, this is a container but why do we need MetricContainer if it's a single field?
By what is this supposed to be keyed, MetricsByLabel
or some MetricGroup
maybe?
If you're seeing a note
there's an associated warning
(or error
) that is the actual problem somewhere. Sendable is about concurrency safety, and yeah this may want to be Sendable if able to?
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.
A revised version of the names is ready for review. Let me know your thoughts? I’ve also addressed the Sendable error.
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.
Once the names are agreed upon, I propose implementing the changes for Gauge in this PR and then creating a separate PR for the rest.
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.
Overall ok, but the names are really confusing. Perhaps: keep Metric a type, drop MetricContainer, doesn't seem to have anything specific it's adding -- just a single field, and then rename "MetricType" to be the Container type?
} | ||
|
||
private enum MetricType { | ||
case counterMetrics(String, MetricContainer<Counter>) |
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.
Yeah Type isn't right, this isn't a type, it's a container. Something feels off with the names here, this is a container but why do we need MetricContainer if it's a single field?
By what is this supposed to be keyed, MetricsByLabel
or some MetricGroup
maybe?
If you're seeing a note
there's an associated warning
(or error
) that is the actual problem somewhere. Sendable is about concurrency safety, and yeah this may want to be Sendable if able to?
a3bb1e5
to
fd0e483
Compare
private enum Metric { | ||
case counter(Counter, help: String) | ||
case counterWithLabels([String], [LabelsKey: Counter], help: String) | ||
case counter(name: String, CounterGroup) |
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.
Isn't the name duplicated here now in both the box
dictionary and then this enum case?
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.
It seemed that way before for labeled cases, so I thought it was a design preference.
Based on your comment, I understand that you approve of removing the small duplicative part. I’ve just re-pushed it.
Could you let me know if the design is now ok? If so, I’ll proceed to implement the changes for Gauge in this PR as well.
Previously, counters could only be identified by their name. This change allows multiple counters to share the same name, with each unique set of labels defining a distinct time series. Additionally, the internal data structure for a stored metric has been refactored, providing a more robust and programmatic representation. Signed-off-by: Melissa Kilby <[email protected]>
fd0e483
to
c697ee8
Compare
Previously, metrics were identified by their name. This change allows a shared metric name per metric type, with each unique set of labels defining a distinct time series.
Additionally, the internal data structure for a stored metric has been refactored, providing a more robust and programmatic representation.
CC @FranzBusch, @ktoso, @blindspotbounty
Let me know how you'd prefer to proceed. We have two main options:
Fixes #125 opened by @blindspotbounty