-
Notifications
You must be signed in to change notification settings - Fork 894
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
Clarify name/version identity for named tracer/meters. #434
Comments
Please assign this to me so I don't lose it |
from our spec sig mtg, seems like ongoing discussion in gitter before this can be closed |
In relation to the name of It seems to me like there are two approaches to the naming schemes here, and the semantics of the names.
Personally, I think 2) makes more sense, and makes it feel more like where we landed with tracer naming, but a contrib implementation in the java repo takes approach 2: https://github.com/open-telemetry/opentelemetry-java/blob/e248ea7ad74b3ac9774f871636c8f6b839be998f/contrib/runtime_metrics/src/main/java/io/opentelemetry/contrib/metrics/runtime/MemoryPools.java#L67 I think we should clarify this somewhere in the specification, since there isn't clarity right now. |
Where @bogdandrutu and I had landed on this is that the meter name is the name of the library, just like tracers, but is also used to namespace the instrument names. Example library named const meter = api.metrics.getMeter('fancy-db-instr', 'semver:1.0.0');
const disk = meter.createObserver('index_size', {
monotonic: false,
labelKeys: ['index_name'],
description: 'Size in gb of an index',
});
function getIndexSize(name: string) {
// return index size
}
disk.setCallback((observerResult) => {
observerResult.observe(() => getIndexSize('idx1'), { index_name: 'idx1' });
observerResult.observe(() => getIndexSize('idx2'), { index_name: 'idx2' });
observerResult.observe(() => getIndexSize('idx3'), { index_name: 'idx3' });
observerResult.observe(() => getIndexSize('idx4'), { index_name: 'idx4' });
}); At export time, this metric would be namespaced using |
This seems the opposite of where we landed for Tracer names, where the intention is not to have to prepend tracer names on to span names to make them meaningful. Are we comfortable with the fact that these two approaches are semantically different? |
I think the issue is that if metric names collide, it could cause major issues in backends like prometheus. Not so for span names. So we need to prevent metric name collisions, and it would be weird for users if we made them have a name and a namespace. Also, there would be no guarantee that different libraries wouldn't try to squat on the same namespace, so you just reintroduce the possibility of collisions again. If we use the library name, we know the namespace is unique. |
can't we make it so this is something that prometheus exporters do, rather than baking it in and forcing all exporters to do it? I would think that most backends could have a label/attribute to distinguish the metrics. |
It doesn't necessarily need to be prefixed to the name. This is a concern of the exporter. However an exporter does namespacing, they should use the meter name as that namespace. |
If the instrument is named "latency", then you'll have to prefix the meter name to make a meaningful metric name. And, you'll get a different http_client_latency metric name for every instrumentation library, across every language. That seems like a huge downside to this approach. |
Let's rephrase: if a backend wants unified metric names across libraries & languages, it won't have a way to do it, with this strategy. |
Option 2 opens up the possibility of naming collisions. If |
The New Relic backend wants those names to be the same, distinguished by labels. How can we accomplish that with this approach? |
So, the prometheus exporter can prepend if it needs to, due to a limitation on the backend. |
The newrelic exporter would simply not prepend the meter name if it has some other method of disambiguating collisions |
but "latency" is a terrible metric name. We want "http_client_latency" to be a separate metric name from "http_server_latency". I don't see a way to make this happen with this approach, unless we strictly specify the structure of the meter names. |
We can't guarantee that users will give good and meaningful names. That is a separate issue. Or else I am completely misunderstanding your issue here and we're back at square 1 |
The example in the java repo has the instrument names as "area" and "pool", scoped by the meter name "jvm_memory". The instrument names are completely meaningless without prepending the meter name. I'd like to change the instrument names to "jvm.memory.area" and "jvm.memory.pool", but @bogdandrutu pushed back and said I should just prepend at export time. |
Here is how I would go about that example. maybe it will help clarify my thinking. First, that example is not using the name of the instrumenting library as the meter name, which is a spec violation. So I would change to Second, I would change the metric name on line 75 to be more meaningful. Possibly |
It sounds like we are 100% in agreement then! How to we make sure that this approach is codified somewhere, so there isn't confusion on this? |
It's definitely how I interpreted it! But, @bogdandrutu didn't, I guess. |
I think we could add some clarity to the metric instrument name section, since that's really where the disagreement lies, I think. Also, semantic conventions for instrument names are definitely required. |
+1 to @jkwatson and @dyladan 's interpretation. It is also how I've been using it. Important for us because Tracers and Meters are named and versioned based on the instrumenting libraries OTP Application name (like a Java package I think...) and then each module in the Application is mapped to the Tracer/Meter so when a tracer or meter operation is done in a module the code simply has to say, "lookup Tracer/Meter by the name of the module I'm in". But this does make using the meter name as a prefix annoying and better moved to a label. |
Note that the spec only says the meter name should be used to namespace metrics. It doesn't specify a mechanism for that. In my mind, it is the responsibility of the exporter to make sure it is using a mechanism appropriate to its target backend. |
From OTEP 76, Bogdan's comments:
and
Please clarify this when including the related changes into the specification.
The text was updated successfully, but these errors were encountered: