You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discussed in cpp api:#1836, #2232
Current python implementation do not support close callback or gauge from api endpoint. While Java version has suppoerted this feature:
When I register a corresponding gauge to the SDK, my application needs to run for a long time and may register multiple different instruments. I use local caches like Guava and Caffeine to store objects used to process metrics. When these objects reach a certain size, they are evicted from memory. However, when I report a metric with the same name again, it prompts that a duplicate instrument has been created, causing the report to fail. The original callback monitoring the valueHolder is no longer accessible by the API due to the object being released, leading to a memory leak issue.
In python, it outputs warning:
[WARNING][None][/otel-auto-instrumentation-python/opentelemetry/sdk/metrics/_internal/__init__.py:274][create_observable_gauge()][msg] An instrument with name avg-metric-python, type ObservableGauge, unit 1 and description gauge reporter: avg-metric-python has been created already.
I notice that the validation of duplicate metric is different in java and python, and seems that python api doesn't supply a interface like "unregister_callback", .
Describe the solution you'd like
solution 1:
Can use close() interface to close instrument.
solution2:
Allow to re-link the new observed value to the previous created instrument
Describe alternatives you've considered
Actually, register instrument process in both meter and measurement_consumer module.
Additional Context
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
Discussed in cpp api:#1836, #2232
Current python implementation do not support close callback or gauge from api endpoint. While Java version has suppoerted this feature:
When I register a corresponding gauge to the SDK, my application needs to run for a long time and may register multiple different instruments. I use local caches like Guava and Caffeine to store objects used to process metrics. When these objects reach a certain size, they are evicted from memory. However, when I report a metric with the same name again, it prompts that a duplicate instrument has been created, causing the report to fail. The original callback monitoring the valueHolder is no longer accessible by the API due to the object being released, leading to a memory leak issue.
In python, it outputs warning:
I notice that the validation of duplicate metric is different in java and python, and seems that python api doesn't supply a interface like "unregister_callback", .
Describe the solution you'd like
solution 1:
Can use close() interface to close instrument.
solution2:
Allow to re-link the new observed value to the previous created instrument
Describe alternatives you've considered
Actually, register instrument process in both meter and measurement_consumer module.
Additional Context
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: