-
Notifications
You must be signed in to change notification settings - Fork 895
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
Metrics API namespacing question #391
Comments
@bogdandrutu ^^^ The suggestion to use the named Meter's name as a namespace for metric instruments came from you. There's now a debate over that topic. |
I think having |
@bogdandrutu Named tracers are a way to know which library reported a span or metric and (and this is not sufficiently specified yet) disabling or rate-limiting this tracer by configuration. This implies that there can be more than one tracer and this means that there needs to be a registry / factory that keeps references to all tracers that exist. Namespaces are used to create unique metrics and traces (as far as I understand) and this is a different problem to solve. As such, you can not drop the one thing in favor of the other thing. I agree that there is a lack of reasoning why named tracers were added to the spec in the first place and I would suggest that this should be added. |
MOVED FROM #410From the call today and other issues, there seems to be a lot of confusion around meter names vs namespaces. Some solutions have been proposed to deal with this but there seems not to be consensus which solves everybody's problems. I am opening this discussion issue in the hopes that we can resolve it quickly and move on with actual spec updates. Here are the solutions that have been proposed that I am aware of: Use meter name as namespaceI think this will probably be the way forward, and it seems to be the option most people are in favor of. This is appealing because it completely removes the concept of namespace as a separate thing. It is on library developers to make sure that metric names within their library are unique, and if two libraries choose the same name, like "latency", then they are unique by virtue of being registered by separate libraries. Examples:
Problems:
Require metric names to be fully qualifiedIn this scenario, it is entirely on library developers to give their metrics a name which is globally unique. This simplifies implementation, but could be problematic if a library developer decides to use a name that is too general or misunderstands the way the system works. Examples:
Problems:
Use meter name as namespace, but allow it to be overridden by the operatorIn this scenario, it is again up to library developers to make their metric names unique only within their library, but allows operators to override the namespace used by a given library for one reason or another. Examples:
Problems:
Example mock configuration: // operator initializes OT SDK
opentelemetry.initGlobalMeterProvider(
new MeterProvider({
namespaceOverrides: [
{
meterName: 'mongodb-native',
namespace: 'mongodb'
},
{
meterName: 'mongodb-core',
namespace: 'mongodb'
}
],
})
);
// In library named mongodb-core
const coreMeter = opentelemetry.getMeter("mongodb-core", "3.2.2");
const coreLatency = coreMeter.createMeasure("latency");
// In library named mongodb-native
const nativeMeter = opentelemetry.getMeter("mongodb-native", "1.2.0");
const nativeLatency = nativeMeter.createMeasure("latency");
// In library named postgresql
const pgMeter = opentelemetry.getMeter("postgresql", "5.2.4");
const pgLatency = pgMeter.createMeasure("latency");
// The `namespace` property may not actually be exported, but is
// included here for illustrative purposes.
console.log(coreMeter.namespace); // mongodb
console.log(nativeMeter.namespace); // mongodb
console.log(pgMeter.namespace); // postgresql
/**
* In this example, the two mongodb libraries have been configured
* to have the same namespace by the operator. If the operator
* had not configured namespace overrides, they would have had their own
* separate namespaces.
*/ |
Based on what we talked about in the call, I believe we are moving forward with the "Use meter name as namespace" option. I am drafting a small update to the spec that makes this more clear and removes the ambiguous |
One thing (I think the only one) that worries me when merging namespace and meter name is that for the namespace I would prefer the name of the instrumented library instead of the instrumenting library. But I guess one can live with that too. |
I think this is closed by #408 |
In the review for the Metrics SDK specification (#347), it became clear that "Named" Meters are not intended to serve as a namespacing function.
(cc: @danielkhan)
There is a requirement that is not currently well written in the Metrics API specification that metric names have a unique kind within a process. This can be done using the name of the named meter, but that was not the intention behind named meters. See the thread with @arminru:
#347 (comment)
#347 (comment)
#347 (comment)
#347 (comment)
#347 (comment)
One of the reasons not to use the named Meter's name, IMO, is that it implies different names for the "same" span when generated by different tracers. This has me wondering if a first-class namespace concept should be added to the API. This issue is intended as a placeholder for this topic without making a strong recommendation. I'm not sure how this should be handled.
The text was updated successfully, but these errors were encountered: