Skip to content

[SDK] Invalid thread instrumentation in PeriodicExportingMetricReader #3840

@marcalff

Description

@marcalff

Class PeriodicExportingMetricReader contains two thread instrumentations:

  • worker_thread_instrumentation_
  • collect_thread_instrumentation_

but only one thread is actually running.

For subclasses of ThreadInstrumentation that do not use thread local storage, the SDK maintains the illusion that two threads are running, which was the case before the refactoring done in #3383.

For subclasses of ThreadInstrumentation that do use thread local storage, this creates chaos, because both the worker and collect instrumentation is invoked in the same thread, causing collisions in thread local storage state.

The proper fix is to remove collect_thread_instrumentation_ entirely, now that the collect thread no longer exist, and use worker_thread_instrumentation_ to instrument the (worker) thread execution.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions