Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ Increment the:
* [CONFIGURATION] File configuration - exemplar filter
[#3837](https://github.com/open-telemetry/opentelemetry-cpp/pull/3837)

* [SDK] Invalid thread instrumentation in PeriodicExportingMetricReader
[#3842](https://github.com/open-telemetry/opentelemetry-cpp/pull/3842)

Breaking changes:

* [CONFIGURATION] File configuration - remove zipkin
Expand All @@ -66,6 +69,13 @@ Breaking changes:
* The Tls properties for Grpc and Http are renamed,
due to an upstream schema change.

* [SDK] Invalid thread instrumentation in PeriodicExportingMetricReader
[#3842](https://github.com/open-telemetry/opentelemetry-cpp/pull/3842)
* The collect thread in the periodic exporting metric reader no longer
exists.
* As a result, member `collect_thread_instrumentation` in class
`PeriodicExportingMetricReaderRuntimeOptions` is removed.

## [1.24 2025-11-20]

* [RELEASE] Bump main branch to 1.24-dev
Expand Down
3 changes: 0 additions & 3 deletions examples/otlp/http_instrumented_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,7 @@ void InitMetrics()
#ifdef ENABLE_THREAD_INSTRUMENTATION_PREVIEW
auto reader_periodic_instr = std::shared_ptr<opentelemetry::sdk::common::ThreadInstrumentation>(
new MyThreadInstrumentation("PeriodicExportingMetricReader(periodic)", "", "medium"));
auto reader_collect_instr = std::shared_ptr<opentelemetry::sdk::common::ThreadInstrumentation>(
new MyThreadInstrumentation("PeriodicExportingMetricReader(collect)", "", "medium"));
reader_rt_opts.periodic_thread_instrumentation = reader_periodic_instr;
reader_rt_opts.collect_thread_instrumentation = reader_collect_instr;
#endif /* ENABLE_THREAD_INSTRUMENTATION_PREVIEW */
auto reader = opentelemetry::sdk::metrics::PeriodicExportingMetricReaderFactory::Create(
std::move(exporter), reader_options, reader_rt_opts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class PeriodicExportingMetricReader : public MetricReader

/* The background worker thread */
std::shared_ptr<sdk::common::ThreadInstrumentation> worker_thread_instrumentation_;
std::shared_ptr<sdk::common::ThreadInstrumentation> collect_thread_instrumentation_;
std::thread worker_thread_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ struct PeriodicExportingMetricReaderRuntimeOptions
{
std::shared_ptr<sdk::common::ThreadInstrumentation> periodic_thread_instrumentation =
std::shared_ptr<sdk::common::ThreadInstrumentation>(nullptr);
std::shared_ptr<sdk::common::ThreadInstrumentation> collect_thread_instrumentation =
std::shared_ptr<sdk::common::ThreadInstrumentation>(nullptr);
};

} // namespace metrics
Expand Down
20 changes: 2 additions & 18 deletions sdk/src/metrics/export/periodic_exporting_metric_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ PeriodicExportingMetricReader::PeriodicExportingMetricReader(
: exporter_{std::move(exporter)},
export_interval_millis_{options.export_interval_millis},
export_timeout_millis_{options.export_timeout_millis},
worker_thread_instrumentation_(nullptr),
collect_thread_instrumentation_(nullptr)
worker_thread_instrumentation_(nullptr)
{
if (export_interval_millis_ <= export_timeout_millis_)
{
Expand All @@ -63,8 +62,7 @@ PeriodicExportingMetricReader::PeriodicExportingMetricReader(
: exporter_{std::move(exporter)},
export_interval_millis_{options.export_interval_millis},
export_timeout_millis_{options.export_timeout_millis},
worker_thread_instrumentation_(runtime_options.periodic_thread_instrumentation),
collect_thread_instrumentation_(runtime_options.collect_thread_instrumentation)
worker_thread_instrumentation_(runtime_options.periodic_thread_instrumentation)
{
if (export_interval_millis_ <= export_timeout_millis_)
{
Expand Down Expand Up @@ -161,13 +159,6 @@ bool PeriodicExportingMetricReader::CollectAndExportOnce()
try
{
#endif
#ifdef ENABLE_THREAD_INSTRUMENTATION_PREVIEW
if (collect_thread_instrumentation_ != nullptr)
{
collect_thread_instrumentation_->OnStart();
collect_thread_instrumentation_->BeforeLoad();
}
#endif /* ENABLE_THREAD_INSTRUMENTATION_PREVIEW */
auto start = std::chrono::steady_clock::now();
this->Collect([this, &start](ResourceMetrics &metric_data) {
auto end = std::chrono::steady_clock::now();
Expand All @@ -182,13 +173,6 @@ bool PeriodicExportingMetricReader::CollectAndExportOnce()
return true;
});

#ifdef ENABLE_THREAD_INSTRUMENTATION_PREVIEW
if (collect_thread_instrumentation_ != nullptr)
{
collect_thread_instrumentation_->AfterLoad();
collect_thread_instrumentation_->OnEnd();
}
#endif /* ENABLE_THREAD_INSTRUMENTATION_PREVIEW */
#if OPENTELEMETRY_HAVE_EXCEPTIONS
}
catch (std::exception &e)
Expand Down
Loading