Skip to content

Commit f7a9aea

Browse files
authored
[SEMANTIC CONVENTIONS] Migration to weaver (open-telemetry#3105)
1 parent a713947 commit f7a9aea

File tree

108 files changed

+13511
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+13511
-252
lines changed

CHANGELOG.md

+16-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ Increment the:
1515

1616
## [Unreleased]
1717

18-
* [API] Comply with W3C Trace Context [#3115](https://github.com/open-telemetry/opentelemetry-cpp/pull/3115)
19-
* Also adds CI check to ensure continued compliance
18+
* [API] Comply with W3C Trace Context
19+
[#3115](https://github.com/open-telemetry/opentelemetry-cpp/pull/3115)
2020

2121
* [API] Jaeger Propagator should not be deprecated
2222
[#3086](https://github.com/open-telemetry/opentelemetry-cpp/pull/3086)
2323

24+
* Upgrade to prometheus 1.3.0
25+
[#3122](https://github.com/open-telemetry/opentelemetry-cpp/pull/3122)
26+
27+
* [SEMANTIC CONVENTIONS] Migration to weaver
28+
[#3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105)
29+
2430
Important changes:
2531

2632
* [API] Jaeger Propagator should not be deprecated
@@ -32,14 +38,19 @@ Important changes:
3238
as the Jaeger propagator can be used without the (now removed)
3339
Jaeger exporter.
3440

35-
* Upgrade to prometheus 1.3.0
36-
[#3122](https://github.com/open-telemetry/opentelemetry-cpp/pull/3122)
37-
3841
* [EXPORTER] Change log resources location for ElasticsearchLogRecordExporter
3942
[#3119](https://github.com/open-telemetry/opentelemetry-cpp/pull/3131)
4043

4144
* Moved from `root/resources` to `root`
4245

46+
* [SEMANTIC CONVENTIONS] Migration to weaver
47+
[#3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105)
48+
49+
* `semantic_convention.h` header files are deprecated,
50+
replaced by `semconv/xxx_attributes.h` header files,
51+
for each `xxx` semantic attribute group.
52+
* See file DEPRECATED.md for details.
53+
4354
## [1.17 2024-10-07]
4455

4556
* [CI] Add a clang-tidy build

DEPRECATED.md

+78
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,81 @@ N/A
5959
## [Documentation]
6060

6161
N/A
62+
63+
## Semantic conventions
64+
65+
### Header files "semantic_conventions.h"
66+
67+
#### Announcement (semantic_conventions.h)
68+
69+
Deprecation is announced as part of the migration to weaver:
70+
71+
* `Version:` release following opentelemetry-cpp 1.17.0
72+
* `Date:` Nov 9, 2024
73+
* `PR:` [PR 3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105)
74+
75+
#### Motivation (semantic_conventions.h)
76+
77+
The header files for semantic conventions are generated automatically.
78+
The tooling to generate these files is changing:
79+
80+
* before, the build-tool repository was used
81+
* now, the weaver repository is used
82+
83+
Changes in tooling allows to generate code that is better organized,
84+
with dedicated header files per group of semantic conventions,
85+
instead of a single header file for everything.
86+
87+
#### Scope (semantic_conventions.h)
88+
89+
The following files:
90+
91+
* `api/include/opentelemetry/trace/semantic_conventions.h`
92+
* `sdk/include/opentelemetry/sdk/resource/semantic_conventions.h`
93+
94+
are now deprecated.
95+
96+
They correspond to semantic conventions v1.27.0,
97+
and will no longer be maintained up to date.
98+
99+
These files will be removed in the future.
100+
101+
#### Mitigation (semantic_conventions.h)
102+
103+
Two things have changed:
104+
105+
* the header file to use
106+
* the symbol name to use.
107+
108+
Before, the semantic convention for `url.full` was:
109+
110+
* declared in file `semantic_conventions.h`
111+
* declared as symbol `SemanticConventions::kUrlFull`
112+
113+
Now, the `url.full` convention, which is part or the `url` group, is:
114+
115+
* declared in file `semconv/url_attributes.h`
116+
* declared as symbol `semconv::url::kUrlFull`
117+
118+
Application code that uses semantic conventions must be adjusted
119+
accordingly.
120+
121+
In addition, semantic conventions that are not marked as stable
122+
are generated in a different header file, placed under directory
123+
`incubating`, to better separate stable and non stable code.
124+
125+
For example, file `semconv/incubating/url_attributes.h`
126+
defines `semconv::url::kUrlDomain`,
127+
which is not marked as stable in semconv v1.27.0
128+
129+
#### Planned removal (semantic_conventions.h)
130+
131+
The following files:
132+
133+
* `api/include/opentelemetry/trace/semantic_conventions.h`
134+
* `sdk/include/opentelemetry/sdk/resource/semantic_conventions.h`
135+
136+
will be removed.
137+
138+
The removal date is planned for July 1, 2025.
139+
This allows more than six months for applications to adjust.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/*
7+
* DO NOT EDIT, this is an Auto-generated file from:
8+
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
9+
*/
10+
11+
#pragma once
12+
13+
#include "opentelemetry/common/macros.h"
14+
#include "opentelemetry/version.h"
15+
16+
OPENTELEMETRY_BEGIN_NAMESPACE
17+
namespace semconv
18+
{
19+
namespace client
20+
{
21+
22+
/**
23+
* Client address - domain name if available without reverse DNS lookup; otherwise, IP address or
24+
* Unix domain socket name. <p> When observed from the server side, and when communicating through
25+
* an intermediary, @code client.address @endcode SHOULD represent the client address behind any
26+
* intermediaries, for example proxies, if it's available.
27+
*/
28+
static constexpr const char *kClientAddress = "client.address";
29+
30+
/**
31+
* Client port number.
32+
* <p>
33+
* When observed from the server side, and when communicating through an intermediary, @code
34+
* client.port @endcode SHOULD represent the client port behind any intermediaries, for example
35+
* proxies, if it's available.
36+
*/
37+
static constexpr const char *kClientPort = "client.port";
38+
39+
} // namespace client
40+
} // namespace semconv
41+
OPENTELEMETRY_END_NAMESPACE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/*
7+
* DO NOT EDIT, this is an Auto-generated file from:
8+
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
9+
*/
10+
11+
#pragma once
12+
13+
#include "opentelemetry/common/macros.h"
14+
#include "opentelemetry/version.h"
15+
16+
OPENTELEMETRY_BEGIN_NAMESPACE
17+
namespace semconv
18+
{
19+
namespace error
20+
{
21+
22+
/**
23+
* Describes a class of error the operation ended with.
24+
* <p>
25+
* The @code error.type @endcode SHOULD be predictable, and SHOULD have low cardinality.
26+
* <p>
27+
* When @code error.type @endcode is set to a type (e.g., an exception type), its
28+
* canonical class name identifying the type within the artifact SHOULD be used.
29+
* <p>
30+
* Instrumentations SHOULD document the list of errors they report.
31+
* <p>
32+
* The cardinality of @code error.type @endcode within one instrumentation library SHOULD be low.
33+
* Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
34+
* should be prepared for @code error.type @endcode to have high cardinality at query time when no
35+
* additional filters are applied.
36+
* <p>
37+
* If the operation has completed successfully, instrumentations SHOULD NOT set @code error.type
38+
* @endcode. <p> If a specific domain defines its own set of error identifiers (such as HTTP or gRPC
39+
* status codes), it's RECOMMENDED to: <p> <ul> <li>Use a domain-specific attribute</li> <li>Set
40+
* @code error.type @endcode to capture all errors, regardless of whether they are defined within
41+
* the domain-specific set or not.</li>
42+
* </ul>
43+
*/
44+
static constexpr const char *kErrorType = "error.type";
45+
46+
namespace ErrorTypeValues
47+
{
48+
/**
49+
* A fallback error value to be used when the instrumentation doesn't define a custom value.
50+
*/
51+
static constexpr const char *kOther = "_OTHER";
52+
53+
} // namespace ErrorTypeValues
54+
55+
} // namespace error
56+
} // namespace semconv
57+
OPENTELEMETRY_END_NAMESPACE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/*
7+
* DO NOT EDIT, this is an Auto-generated file from:
8+
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
9+
*/
10+
11+
#pragma once
12+
13+
#include "opentelemetry/common/macros.h"
14+
#include "opentelemetry/version.h"
15+
16+
OPENTELEMETRY_BEGIN_NAMESPACE
17+
namespace semconv
18+
{
19+
namespace exception
20+
{
21+
22+
/**
23+
* SHOULD be set to true if the exception event is recorded at a point where it is known that the
24+
* exception is escaping the scope of the span. <p> An exception is considered to have escaped (or
25+
* left) the scope of a span, if that span is ended while the exception is still logically "in
26+
* flight". This may be actually "in flight" in some languages (e.g. if the exception is passed to a
27+
* Context manager's @code __exit__ @endcode method in Python) but will usually be caught at the
28+
* point of recording the exception in most languages. <p> It is usually not possible to determine
29+
* at the point where an exception is thrown whether it will escape the scope of a span. However, it
30+
* is trivial to know that an exception will escape, if one checks for an active exception just
31+
* before ending the span, as done in the <a
32+
* href="https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception">example
33+
* for recording span exceptions</a>. <p> It follows that an exception may still escape the scope of
34+
* the span even if the @code exception.escaped @endcode attribute was not set or set to false,
35+
* since the event might have been recorded at a time where it was not
36+
* clear whether the exception will escape.
37+
*/
38+
static constexpr const char *kExceptionEscaped = "exception.escaped";
39+
40+
/**
41+
* The exception message.
42+
*/
43+
static constexpr const char *kExceptionMessage = "exception.message";
44+
45+
/**
46+
* A stacktrace as a string in the natural representation for the language runtime. The
47+
* representation is to be determined and documented by each language SIG.
48+
*/
49+
static constexpr const char *kExceptionStacktrace = "exception.stacktrace";
50+
51+
/**
52+
* The type of the exception (its fully-qualified class name, if applicable). The dynamic type of
53+
* the exception should be preferred over the static type in languages that support it.
54+
*/
55+
static constexpr const char *kExceptionType = "exception.type";
56+
57+
} // namespace exception
58+
} // namespace semconv
59+
OPENTELEMETRY_END_NAMESPACE

0 commit comments

Comments
 (0)