-
Notifications
You must be signed in to change notification settings - Fork 888
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
How to handle case-insensitive instrument name collisions in metric SDK #3539
Comments
Where can they be case sensitive down stream?
This is what the java implementation does. The python implementation converts all metric names to lower case (see more in discussion here). |
There's no restriction on the OTLP metric name to be case-sensitive, right? It could be the case that if you run your app and send |
Hmm, this seems problematic. If a user in Java is able to measure It seems like an under-specified area of the specification. Is there a backwards compatible way we can specify the behavior here so all SDKs produce the same telemetry? |
Given that according to the API, metric names are "They are case-insensitive, ASCII strings.", I think a consumer which treats them as case sensitive would risk unexpected behavior. I don't see any reference to case sensitivity of metric name in the metric data model document, or metric proto definitions... Perhaps this was an oversight? |
Yeah, I think some clarification is needed here. |
A clarification would be great IMHO |
Notes from the specification SIG meeting:
The proposal we settled on is:
This will mean the Python implementation would need to change. @open-telemetry/python-approvers thoughts? |
Is the same name in a different case considered a conflict? |
As far as I can tell, yes. The name is defined as a case-insensitive string. Therefore, names that differ only by case are equivalent, but not identical. The second instrument the user requests will return an instrument other than what the user asked for if the name normalization strategy mentioned above is followed. |
Should we change our implementation now? Or is there a plan to add the results of the discussion to the spec and once this is added to the spec should we reimplement? |
There is a plan to update the specification, I just need to find the time to open the PR. I would wait until that is merged before changing. |
Looking at the existing duplicate instrument registration guidelines:
I'm wondering if instead of unifying the data in the SDK, just export two streams (like would be done in the case of different units) and emit a warning? @jack-berg thoughts? |
Based on this, JS is currently not differentiating between case-insensitive instrument names. I think their current behavior is to export multiple streams based on my reading of that issue. |
I'm in favor or using the first value seen, as proposed here, for the following reasons:
|
What would the guidance be for SDKs like JS that already made a different choice? Should we coalesce on the new behavior as a bug fix and just accept that it is breaking, or should we flag this for 2.0? edit: to be clear, we didn't make this choice consciously. we simply missed it while building the metric sdk |
I see this as a bug fix. First off, there shouldn't be any public interfaces or functions that change from this. Only the export behavior. Specifically for the duplicate stream case: the duplicate instrument registration section already specifies that identical instruments need to aggregated into a single data stream:
If an implementation is not unifying these streams, I think it then follows that merging the streams is a bug fix. As for the Python case, where all names are being changed to lowercase, it is a bit more of a grey area. I don't know of any place that specifically says the casing of an instrument name cannot be changed in the specification, but I expect we want to preserve the casing a user provides. I could see it as a bug to not do so. |
- Refactor the "Duplicate instrument registration" section - Clarify how to handle when instrument names differ by only their casing: 1. Return the first-seen instrument name for all conflicting instrument names 2. Log a warning Resolves #3539
- Refactor the "Duplicate instrument registration" section - Clarify how to handle when instrument names differ by only their casing: 1. Return the first-seen instrument name for all conflicting instrument names 2. Log a warning Resolves open-telemetry#3539
The metric API defines instrument names as being case insensitive:
And the metric SDK "MUST aggregate data from identical Instruments together in its export pipeline." Where, "[t]he term identical applied to Instruments describes instances where all identifying fields are equal." Where an instrument's
name
,kind
,unit
,description
, and number type are all considered identifying.This implies that an instruments with names
request_counter
,request_Counter
, andRequest_Counter
(assuming all other identifying fields are equal) need to all be aggregated together. However, downstream, instrument names can be case-sensitive. What should the instrument name be for the produced metric stream? Should it just be the first name registered?The text was updated successfully, but these errors were encountered: