-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the feature
AWS SDK C++ fails to compile when built with opentelemetry-cpp 1.19.0 or later (and maybe earlier as well) due to incomplete type errors for Counter<T> and Histogram<T>.
error: implicit instantiation of undefined template 'opentelemetry::metrics::Counter<unsigned long>'
/usr/local/include/opentelemetry/metrics/meter.h:16:7: note: template is declared here
16 | class Counter;Error output shows similar failures for Histogram.
This is due to src/aws-cpp-sdk-core/include/smithy/tracing/impl/opentelemetry/MeterAdapters.h having:
#include <opentelemetry/metrics/meter.h>
#include <opentelemetry/metrics/async_instruments.h>But in OpenTelemetry C++ 1.19.0, the full template definitions for Counter and Histogram are in <opentelemetry/metrics/sync_instruments.h>, not in meter.h (which only contains forward declarations).
Environment
AWS SDK C++ version: 1.11.453 (also affects 1.11.730)
OpenTelemetry C++ version: 1.19.0 and later
Compiler: Clang 20.0.0git with libc++
OS: Amz Linux 2023 (aarch64)
Build flags: -DBUILD_OPTEL=ON
Use Case
Using newest opentelemetry-cpp.
Proposed Solution
Add the missing include to MeterAdapters.h:
#include <opentelemetry/metrics/async_instruments.h> // Already exists
#include <opentelemetry/metrics/sync_instruments.h> // Add thisDocs should also be updated to reflect minimum/max OpenTelemetry compatible version requirements.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change