-
Notifications
You must be signed in to change notification settings - Fork 698
Add check for duplicate instrument names #2409
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.
Change overall looks good, just one question
Also look at open-telemetry/opentelemetry-specification#2270 |
I would suggest we hold this on until we get clarification the linked spec discussion to avoid the rework and confusion. |
@srikanthccv 2317 has merged, can this PR be moved forward? |
Yes, thanks for pointing out. I believe this PR needs to be updated to confirm with latest spec changes. We don't want to throw an exception anymore in case of duplicate registration and should return a valid instrument. |
@srikanthccv, addressed your changes, please take a look ✌️ |
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.
We should also consider the views configuration before we warn the conflicting instrument, right?
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.
Since the check for duplicate instrument must take views into considerations, the checks should probably be moved into the SDK.
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.
The requirements I see in the API spec for this are:
-
When more than one Instrument of the same name is created for identical Meters, denoted duplicate instrument registration, the implementation MUST create a valid Instrument in every case.
-
When more than one distinct Instrument is registered with the same name for identical Meters, the implementation SHOULD emit a warning to the user informing them of duplicate registration conflict(s).
My take is we should implement requirement 2 in the API as a logged warning (which this PR does), but it should not throw an exception. The SDK should allow views to reconfigure this as @codeboten pointed out.
What do you think @codeboten?
@ocelotl I think the PR description is out of date, can you update?
|
@aabmass I guess it's a bit confusing, because the SDK specification says that if a view exists with a description, then this should avoid the warning. Unless we're saying we should have the warning anyways, and subsequent warnings could be avoided?
|
@codeboten @aabmass @srikanthccv please consider merging this PR and addressing the resolution of conflicts via views in a separate PR (one that would solve #2509). |
I'm ok with this plan. |
Not in this PR, we will implement that in a subsequent one when we solve #2558 |
@aabmass @srikanthccv please take a look ✌️ |
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.
Not in this PR, we will implement that in a subsequent one when we solve #2558
correct me if I'm wrong, but won't that require re-implementing this work in the SDK? What's your plan, to just override the _check_instrument_id()
in the SDK meter provider?
Co-authored-by: Srikanth Chekuri <[email protected]>
Co-authored-by: Srikanth Chekuri <[email protected]>
Fixes #2142
This PR adds the checking for duplicate instrument names in the API. Others may disagree and would consider this belongs in the SDK, please leave your comments ✌️
The issue includes this question:
I think that since the spec only requires that the instrument names are not repeated, we should be concerned with the
name
attribute of instruments only.