Skip to content
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

Meter implementations MUST return an error when multiple instruments are registered by the same name #1201

Closed
codeboten opened this issue Oct 5, 2020 · 6 comments · Fixed by #1438
Assignees
Labels
1.10.0rc1 release candidate 1 for metrics GA api Affects the API package. bug Something isn't working good first issue Good first issue help wanted metrics release:required-for-ga To be resolved before GA release

Comments

@codeboten
Copy link
Contributor

As per spec:

Metric instrument names belong to a namespace, established by the the associated Meter instance. Meter implementations MUST return an error when multiple instruments are registered by the same name.

https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/metrics/api.md#instrument-naming-requirements

@codeboten codeboten added bug Something isn't working good first issue Good first issue api Affects the API package. metrics help wanted labels Oct 5, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this issue Nov 1, 2020
Co-authored-by: Mayur Kale <mayurkale@google.com>
@codeboten codeboten added release:required-for-ga To be resolved before GA release 1.10.0rc1 release candidate 1 for metrics GA labels Nov 26, 2020
@srikanthccv
Copy link
Member

@codeboten I would like to pick this up. Help me if I am understanding this correctly. Meter instance will be used to create multiple instrumentation using different functions such as create_counter, create_updowncounter and create_valuerecorder etc.. when user creates different instruments with same name, Meter should throw an error saying something like multiple instruments can't registered by the same name.

@lzchen
Copy link
Contributor

lzchen commented Nov 30, 2020

@lonewolf3739
I believe this is the correct understanding.

@aabmass
Copy link
Member

aabmass commented Dec 1, 2020

Related discussion on potentially just returning the existing instrument when this happens: open-telemetry/opentelemetry-specification#1046

@srikanthccv
Copy link
Member

From Spec

The OpenTelemetry SDK is responsible for ensuring that an individual Meter implementation cannot report multiple instruments with the same name and different definitions. To accomplish this, SDKs MUST reject duplicate registration of an instrument when another instrument has already been registered with same metric name to the same named Meter.

Does the term definition here mean the tuple (name, desc, unit)?

The requirement applies even for attempts to register an identical instrument definition.

Does this mean regardless of definition sdk must reject registration if another instrument has been registered with same name?

Was there any further discussion on returning the existing instrument in spec SIG or similar meetings?

@srikanthccv
Copy link
Member

One another thing clear is names should be case insensitive.

@lzchen
Copy link
Contributor

lzchen commented Dec 2, 2020

@lonewolf3739
I would ask in the issue that @aabmass linked to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.10.0rc1 release candidate 1 for metrics GA api Affects the API package. bug Something isn't working good first issue Good first issue help wanted metrics release:required-for-ga To be resolved before GA release
Projects
None yet
4 participants