Skip to content

[Feat] Better control of threads executed by opentelemetry-cpp #3174

@marcalff

Description

@marcalff

Context

The opentelemetry-cpp uses threads internally, for various components.

For example:

  • the batch processor uses a thread to process records from the span buffer.
  • the periodic metric reader uses a thread to trigger periodic collection, and a child thread to collect observable metrics.
  • the log processor uses a thread to process records from a log buffer.
  • every exporter based on CURL uses a thread internally, to process HTTP requests and responses.

Problem

An application that links with the opentelemetry-cpp library may have additional constraints, and may want to control at a very low level how the code executes within a thread.

For example:

  • the application may want to name threads, to be visible in the operating system under an application controlled name.
  • the application may need to initialize thread local storage, in particular when custom code is executed within a thread spawned by opentelemetry. Typically, callbacks for observable metrics may need TLS keys in place to execute properly.
  • the application may need to control thread priorities, or bind internal opentelemetry threads to some CPUs.
  • the application may need to control the current network namespace, when a thread opens a network connection.

Currently, there is no way to implement any of this from an application that uses opentelemetry-cpp.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions