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

[OpenTelemetry.Instrumentation.Process] Multiple provider dispose issue #831

Closed
CodeBlanch opened this issue Dec 15, 2022 · 2 comments · Fixed by #972
Closed

[OpenTelemetry.Instrumentation.Process] Multiple provider dispose issue #831

CodeBlanch opened this issue Dec 15, 2022 · 2 comments · Fixed by #972
Labels
comp:instrumentation.process Things related to OpenTelemetry.Instrumentation.Process

Comments

@CodeBlanch
Copy link
Member

CodeBlanch commented Dec 15, 2022

Issue with OpenTelemetry.Instrumentation.Process

process.cpu.utilization requires tracking of the last collection time. When multiple providers are used, it needs to track it based on the provider. There isn't a really good way to do this. What we're doing is creating a Meter instance for each provider. But each instance has the same name for Meter & Instruments so SDK is probably just treating everything as one data stream. To compound that problem, when a provider is disposed it should dispose its instrumentation. Due to the same name issue this leads to all providers being unsubscribed if one provider is disposed.

Update: There is a failing test which demonstrates the disposal problem.

@CodeBlanch CodeBlanch added the comp:instrumentation.process Things related to OpenTelemetry.Instrumentation.Process label Dec 15, 2022
@alanwest
Copy link
Member

alanwest commented Dec 15, 2022

process.cpu.utilization requires tracking of the last collection time. When multiple providers are used, it needs to track it based on the provider. There isn't a really good way to do this.

Agreed, this seems like a spec limitation.

The semantics define process.cpu.utilization as:

Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process.

I don't think instrumentation can maintain state like this without violating the spec in some way. This definition seems be be geared toward an out-of-proc implementation like the collector's host metrics receiver.

I haven't found other languages that have implemented process.cpu.utilization. Java appears to to have introduced their own utilization metrics with different semantics.

For example, process.runtime.jvm.cpu.utilization is defined as:

Recent CPU utilization for the process

with a footnote

These utilizations are not defined as being for the specific interval since last measurement

Some reasoning for this is presented here. I think it gets the same problem we're bumping up against.

Should we consider doing something similar? That is, just compute utilization based on some fixed recent interval?

@alanwest
Copy link
Member

Commented here as well open-telemetry/opentelemetry-specification#2439 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.process Things related to OpenTelemetry.Instrumentation.Process
Projects
None yet
2 participants