Describe your environment
Platform: Linux
OpenTelemetry version: v1.1.0
Build system: CMake
Compiler:
> g++ --version
g++ (GCC) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Steps to reproduce
Compile this snippet:
#include <opentelemetry/sdk/resource/experimental_semantic_conventions.h>
#include <iostream>
int main(int, char**) {
std::cout << OTEL_CPP_GET_ATTR(AttrServiceName) << std::endl;
return 0;
}
$ g++ -I$CONDA_PREFIX/include test.cc -o test
What is the expected behavior?
The snippet should compile.
What is the actual behavior?
The snippet fails to compile:
> g++ -I$CONDA_PREFIX/include test.cc -o test
In file included from test.cc:1:
test.cc: In function 'int main(int, char**)':
~/miniconda3/envs/astronaut-cpp/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h:24:33: error: 'attr' was not declared in this scope
24 | #define OTEL_CPP_GET_ATTR(name) attr(OTEL_CPP_CONST_HASHCODE(name))
| ^~~~
test.cc:6:16: note: in expansion of macro 'OTEL_CPP_GET_ATTR'
6 | std::cout << OTEL_CPP_GET_ATTR(AttrServiceName) << std::endl;
| ^~~~~~~~~~~~~~~~~
Additional context
The use of the attr helper should be fully qualified here, so it can be used even when not inside an OpenTelemetry namespace or without having to add using opentelemetry::sdk::resource::attr;.
|
#define OTEL_CPP_GET_ATTR(name) attr(OTEL_CPP_CONST_HASHCODE(name)) |
Describe your environment
Platform: Linux
OpenTelemetry version: v1.1.0
Build system: CMake
Compiler:
Steps to reproduce
Compile this snippet:
What is the expected behavior?
The snippet should compile.
What is the actual behavior?
The snippet fails to compile:
Additional context
The use of the
attrhelper should be fully qualified here, so it can be used even when not inside an OpenTelemetry namespace or without having to addusing opentelemetry::sdk::resource::attr;.opentelemetry-cpp/sdk/include/opentelemetry/sdk/resource/experimental_semantic_conventions.h
Line 24 in 5de793d