Skip to content

Commit 3e58a0b

Browse files
authored
[SEMANTIC CONVENTIONS] Upgrade semantic conventions to 1.32.0 (#3351)
1 parent 99a0328 commit 3e58a0b

15 files changed

+874
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 app
20+
{
21+
22+
/**
23+
* A unique identifier representing the installation of an application on a specific device
24+
* <p>
25+
* Its value SHOULD persist across launches of the same application installation, including through
26+
* application upgrades. It SHOULD change if the application is uninstalled or if all applications
27+
* of the vendor are uninstalled. Additionally, users might be able to reset this value (e.g. by
28+
* clearing application data). If an app is installed multiple times on the same device (e.g. in
29+
* different accounts on Android), each @code app.installation.id @endcode SHOULD have a different
30+
* value. If multiple OpenTelemetry SDKs are used within the same application, they SHOULD use the
31+
* same value for @code app.installation.id @endcode. Hardware IDs (e.g. serial number, IMEI, MAC
32+
* address) MUST NOT be used as the @code app.installation.id @endcode. <p> For iOS, this value
33+
* SHOULD be equal to the <a
34+
* href="https://developer.apple.com/documentation/uikit/uidevice/identifierforvendor">vendor
35+
* identifier</a>. <p> For Android, examples of @code app.installation.id @endcode implementations
36+
* include: <ul> <li><a
37+
* href="https://firebase.google.com/docs/projects/manage-installations">Firebase Installation
38+
* ID</a>.</li> <li>A globally unique UUID which is persisted across sessions in your
39+
* application.</li> <li><a href="https://developer.android.com/identity/app-set-id">App set
40+
* ID</a>.</li> <li><a
41+
* href="https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID">@code
42+
* Settings.getString(Settings.Secure.ANDROID_ID) @endcode</a>.</li>
43+
* </ul>
44+
* <p>
45+
* More information about Android identifier best practices can be found <a
46+
* href="https://developer.android.com/training/articles/user-data-ids">here</a>.
47+
*/
48+
static constexpr const char *kAppInstallationId = "app.installation.id";
49+
50+
} // namespace app
51+
} // namespace semconv
52+
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/semconv/incubating/code_attributes.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kCodeFunction = "code.func
6868
* <li>Java method: @code com.example.MyHttpService.serveRequest @endcode</li>
6969
* <li>Java anonymous class method: @code com.mycompany.Main$1.myMethod @endcode</li>
7070
* <li>Java lambda method: @code com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod
71-
* @endcode</li> <li>PHP function: `GuzzleHttp\Client::transfer</li> <li>Go function: @code
72-
* github.com/my/repo/pkg.foo.func5 @endcode</li> <li>Elixir: @code OpenTelemetry.Ctx.new
71+
* @endcode</li> <li>PHP function: @code GuzzleHttp\Client::transfer @endcode</li> <li>Go function:
72+
* @code github.com/my/repo/pkg.foo.func5 @endcode</li> <li>Elixir: @code OpenTelemetry.Ctx.new
7373
* @endcode</li> <li>Erlang: @code opentelemetry_ctx:new @endcode</li> <li>Rust: @code
7474
* playground::my_module::my_cool_func @endcode</li> <li>C function: @code fopen @endcode</li>
7575
* </ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 cpython
20+
{
21+
22+
/**
23+
* Value of the garbage collector collection generation.
24+
*/
25+
static constexpr const char *kCpythonGcGeneration = "cpython.gc.generation";
26+
27+
namespace CpythonGcGenerationValues
28+
{
29+
/**
30+
* Generation 0
31+
*/
32+
static constexpr int kGeneration0 = 0;
33+
34+
/**
35+
* Generation 1
36+
*/
37+
static constexpr int kGeneration1 = 1;
38+
39+
/**
40+
* Generation 2
41+
*/
42+
static constexpr int kGeneration2 = 2;
43+
44+
} // namespace CpythonGcGenerationValues
45+
46+
} // namespace cpython
47+
} // namespace semconv
48+
OPENTELEMETRY_END_NAMESPACE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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_metrics-h.j2
9+
*/
10+
11+
#pragma once
12+
13+
#include "opentelemetry/common/macros.h"
14+
#include "opentelemetry/metrics/meter.h"
15+
#include "opentelemetry/version.h"
16+
17+
OPENTELEMETRY_BEGIN_NAMESPACE
18+
namespace semconv
19+
{
20+
namespace cpython
21+
{
22+
23+
/**
24+
* The total number of objects collected inside a generation since interpreter start.
25+
* <p>
26+
* This metric reports data from <a
27+
* href="https://docs.python.org/3/library/gc.html#gc.get_stats">@code gc.stats() @endcode</a>. <p>
28+
* counter
29+
*/
30+
static constexpr const char *kMetricCpythonGcCollectedObjects = "cpython.gc.collected_objects";
31+
static constexpr const char *descrMetricCpythonGcCollectedObjects =
32+
"The total number of objects collected inside a generation since interpreter start.";
33+
static constexpr const char *unitMetricCpythonGcCollectedObjects = "{object}";
34+
35+
static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
36+
CreateSyncInt64MetricCpythonGcCollectedObjects(metrics::Meter *meter)
37+
{
38+
return meter->CreateUInt64Counter(kMetricCpythonGcCollectedObjects,
39+
descrMetricCpythonGcCollectedObjects,
40+
unitMetricCpythonGcCollectedObjects);
41+
}
42+
43+
static inline nostd::unique_ptr<metrics::Counter<double>>
44+
CreateSyncDoubleMetricCpythonGcCollectedObjects(metrics::Meter *meter)
45+
{
46+
return meter->CreateDoubleCounter(kMetricCpythonGcCollectedObjects,
47+
descrMetricCpythonGcCollectedObjects,
48+
unitMetricCpythonGcCollectedObjects);
49+
}
50+
51+
static inline nostd::shared_ptr<metrics::ObservableInstrument>
52+
CreateAsyncInt64MetricCpythonGcCollectedObjects(metrics::Meter *meter)
53+
{
54+
return meter->CreateInt64ObservableCounter(kMetricCpythonGcCollectedObjects,
55+
descrMetricCpythonGcCollectedObjects,
56+
unitMetricCpythonGcCollectedObjects);
57+
}
58+
59+
static inline nostd::shared_ptr<metrics::ObservableInstrument>
60+
CreateAsyncDoubleMetricCpythonGcCollectedObjects(metrics::Meter *meter)
61+
{
62+
return meter->CreateDoubleObservableCounter(kMetricCpythonGcCollectedObjects,
63+
descrMetricCpythonGcCollectedObjects,
64+
unitMetricCpythonGcCollectedObjects);
65+
}
66+
67+
/**
68+
* The number of times a generation was collected since interpreter start.
69+
* <p>
70+
* This metric reports data from <a
71+
* href="https://docs.python.org/3/library/gc.html#gc.get_stats">@code gc.stats() @endcode</a>. <p>
72+
* counter
73+
*/
74+
static constexpr const char *kMetricCpythonGcCollections = "cpython.gc.collections";
75+
static constexpr const char *descrMetricCpythonGcCollections =
76+
"The number of times a generation was collected since interpreter start.";
77+
static constexpr const char *unitMetricCpythonGcCollections = "{collection}";
78+
79+
static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
80+
CreateSyncInt64MetricCpythonGcCollections(metrics::Meter *meter)
81+
{
82+
return meter->CreateUInt64Counter(kMetricCpythonGcCollections, descrMetricCpythonGcCollections,
83+
unitMetricCpythonGcCollections);
84+
}
85+
86+
static inline nostd::unique_ptr<metrics::Counter<double>>
87+
CreateSyncDoubleMetricCpythonGcCollections(metrics::Meter *meter)
88+
{
89+
return meter->CreateDoubleCounter(kMetricCpythonGcCollections, descrMetricCpythonGcCollections,
90+
unitMetricCpythonGcCollections);
91+
}
92+
93+
static inline nostd::shared_ptr<metrics::ObservableInstrument>
94+
CreateAsyncInt64MetricCpythonGcCollections(metrics::Meter *meter)
95+
{
96+
return meter->CreateInt64ObservableCounter(
97+
kMetricCpythonGcCollections, descrMetricCpythonGcCollections, unitMetricCpythonGcCollections);
98+
}
99+
100+
static inline nostd::shared_ptr<metrics::ObservableInstrument>
101+
CreateAsyncDoubleMetricCpythonGcCollections(metrics::Meter *meter)
102+
{
103+
return meter->CreateDoubleObservableCounter(
104+
kMetricCpythonGcCollections, descrMetricCpythonGcCollections, unitMetricCpythonGcCollections);
105+
}
106+
107+
/**
108+
* The total number of objects which were found to be uncollectable inside a generation since
109+
* interpreter start. <p> This metric reports data from <a
110+
* href="https://docs.python.org/3/library/gc.html#gc.get_stats">@code gc.stats() @endcode</a>. <p>
111+
* counter
112+
*/
113+
static constexpr const char *kMetricCpythonGcUncollectableObjects =
114+
"cpython.gc.uncollectable_objects";
115+
static constexpr const char *descrMetricCpythonGcUncollectableObjects =
116+
"The total number of objects which were found to be uncollectable inside a generation since "
117+
"interpreter start.";
118+
static constexpr const char *unitMetricCpythonGcUncollectableObjects = "{object}";
119+
120+
static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
121+
CreateSyncInt64MetricCpythonGcUncollectableObjects(metrics::Meter *meter)
122+
{
123+
return meter->CreateUInt64Counter(kMetricCpythonGcUncollectableObjects,
124+
descrMetricCpythonGcUncollectableObjects,
125+
unitMetricCpythonGcUncollectableObjects);
126+
}
127+
128+
static inline nostd::unique_ptr<metrics::Counter<double>>
129+
CreateSyncDoubleMetricCpythonGcUncollectableObjects(metrics::Meter *meter)
130+
{
131+
return meter->CreateDoubleCounter(kMetricCpythonGcUncollectableObjects,
132+
descrMetricCpythonGcUncollectableObjects,
133+
unitMetricCpythonGcUncollectableObjects);
134+
}
135+
136+
static inline nostd::shared_ptr<metrics::ObservableInstrument>
137+
CreateAsyncInt64MetricCpythonGcUncollectableObjects(metrics::Meter *meter)
138+
{
139+
return meter->CreateInt64ObservableCounter(kMetricCpythonGcUncollectableObjects,
140+
descrMetricCpythonGcUncollectableObjects,
141+
unitMetricCpythonGcUncollectableObjects);
142+
}
143+
144+
static inline nostd::shared_ptr<metrics::ObservableInstrument>
145+
CreateAsyncDoubleMetricCpythonGcUncollectableObjects(metrics::Meter *meter)
146+
{
147+
return meter->CreateDoubleObservableCounter(kMetricCpythonGcUncollectableObjects,
148+
descrMetricCpythonGcUncollectableObjects,
149+
unitMetricCpythonGcUncollectableObjects);
150+
}
151+
152+
} // namespace cpython
153+
} // namespace semconv
154+
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/semconv/incubating/db_attributes.h

+19-2
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ static constexpr const char *kDbOperationBatchSize = "db.operation.batch.size";
343343
* The operation name SHOULD NOT be extracted from @code db.query.text @endcode,
344344
* when the database system supports cross-table queries in non-batch operations.
345345
* <p>
346+
* If spaces can occur in the operation name, multiple consecutive spaces
347+
* SHOULD be normalized to a single space.
348+
* <p>
346349
* For batch operations, if the individual operations are known to have the same operation name
347350
* then that operation name SHOULD be used prepended by @code BATCH @endcode,
348351
* otherwise @code db.operation.name @endcode SHOULD be @code BATCH @endcode or some other database
@@ -357,6 +360,7 @@ static constexpr const char *kDbOperationName = "db.operation.name";
357360
* index. If @code db.query.text @endcode is also captured, then @code db.operation.parameter.<key>
358361
* @endcode SHOULD match up with the parameterized placeholders present in @code db.query.text
359362
* @endcode.
363+
* @code db.operation.parameter.<key> @endcode SHOULD NOT be captured on batch operations.
360364
*/
361365
static constexpr const char *kDbOperationParameter = "db.operation.parameter";
362366

@@ -422,10 +426,12 @@ static constexpr const char *kDbResponseReturnedRows = "db.response.returned_row
422426
static constexpr const char *kDbResponseStatusCode = "db.response.status_code";
423427

424428
/**
425-
* Deprecated, use @code db.collection.name @endcode instead.
429+
* Deprecated, use @code db.collection.name @endcode instead, but only if not extracting the value
430+
* from @code db.query.text @endcode.
426431
*
427432
* @deprecated
428-
* {"note": "Replaced by @code db.collection.name @endcode.", "reason": "uncategorized"}
433+
* {"note": "Replaced by @code db.collection.name @endcode, but only if not extracting the value
434+
* from @code db.query.text @endcode.", "reason": "uncategorized"}
429435
*/
430436
OPENTELEMETRY_DEPRECATED static constexpr const char *kDbSqlTable = "db.sql.table";
431437

@@ -437,6 +443,17 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbSqlTable = "db.sql.tabl
437443
*/
438444
OPENTELEMETRY_DEPRECATED static constexpr const char *kDbStatement = "db.statement";
439445

446+
/**
447+
* The name of a stored procedure within the database.
448+
* <p>
449+
* It is RECOMMENDED to capture the value as provided by the application
450+
* without attempting to do any case normalization.
451+
* <p>
452+
* For batch operations, if the individual operations are known to have the same
453+
* stored procedure name then that stored procedure name SHOULD be used.
454+
*/
455+
static constexpr const char *kDbStoredProcedureName = "db.stored_procedure.name";
456+
440457
/**
441458
* Deprecated, use @code db.system.name @endcode instead.
442459
*

api/include/opentelemetry/semconv/incubating/device_attributes.h

+18-11
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,24 @@ namespace device
2222
/**
2323
* A unique identifier representing the device
2424
* <p>
25-
* The device identifier MUST only be defined using the values outlined below. This value is not an
26-
* advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value
27-
* MUST be equal to the <a
28-
* href="https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor">vendor
29-
* identifier</a>. On Android (Java or Kotlin), this value MUST be equal to the Firebase
30-
* Installation ID or a globally unique UUID which is persisted across sessions in your application.
31-
* More information can be found <a
32-
* href="https://developer.android.com/training/articles/user-data-ids">here</a> on best practices
33-
* and exact implementation details. Caution should be taken when storing personal data or anything
34-
* which can identify a user. GDPR and data protection laws may apply, ensure you do your own due
35-
* diligence.
25+
* Its value SHOULD be identical for all apps on a device and it SHOULD NOT change if an app is
26+
* uninstalled and re-installed. However, it might be resettable by the user for all apps on a
27+
* device. Hardware IDs (e.g. vendor-specific serial number, IMEI or MAC address) MAY be used as
28+
* values. <p> More information about Android identifier best practices can be found <a
29+
* href="https://developer.android.com/training/articles/user-data-ids">here</a>. <blockquote>
30+
* [!WARNING]
31+
* <p>
32+
* This attribute may contain sensitive (PII) information. Caution should be taken when storing
33+
* personal data or anything which can identify a user. GDPR and data protection laws may apply,
34+
* ensure you do your own due diligence.
35+
* <p>
36+
* Due to these reasons, this identifier is not recommended for consumer applications and will
37+
* likely result in rejection from both Google Play and App Store. However, it may be appropriate
38+
* for specific enterprise scenarios, such as kiosk devices or enterprise-managed devices, with
39+
* appropriate compliance clearance. Any instrumentation providing this identifier MUST implement it
40+
* as an opt-in feature. <p> See <a
41+
* href="/docs/attributes-registry/app.md#app-installation-id">@code app.installation.id
42+
* @endcode</a> for a more privacy-preserving alternative.</blockquote>
3643
*/
3744
static constexpr const char *kDeviceId = "device.id";
3845

api/include/opentelemetry/semconv/incubating/error_attributes.h

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ namespace semconv
1919
namespace error
2020
{
2121

22+
/**
23+
* A message providing more detail about an error in human-readable form.
24+
* <p>
25+
* @code error.message @endcode should provide additional context and detail about an error.
26+
* It is NOT RECOMMENDED to duplicate the value of @code error.type @endcode in @code error.message
27+
* @endcode. It is also NOT RECOMMENDED to duplicate the value of @code exception.message @endcode
28+
* in @code error.message @endcode. <p>
29+
* @code error.message @endcode is NOT RECOMMENDED for metrics or spans due to its unbounded
30+
* cardinality and overlap with span status.
31+
*/
32+
static constexpr const char *kErrorMessage = "error.message";
33+
2234
/**
2335
* Describes a class of error the operation ended with.
2436
* <p>

0 commit comments

Comments
 (0)