From 150256c1720b279a1dfc7c380d17e13e90cee15d Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 3 Dec 2024 00:29:24 +0100 Subject: [PATCH] [SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.29.0 (#3182) --- .../semconv/incubating/cicd_attributes.h | 8 +- .../incubating/cloudfoundry_attributes.h | 11 +- .../semconv/incubating/container_metrics.h | 42 ++ .../semconv/incubating/db_attributes.h | 122 +++++- .../semconv/incubating/db_metrics.h | 409 +++++++++++------- .../incubating/feature_flag_attributes.h | 92 +++- .../semconv/incubating/gen_ai_attributes.h | 38 +- .../semconv/incubating/geo_attributes.h | 102 +++++ .../semconv/incubating/k8s_metrics.h | 232 ++++++++++ .../semconv/incubating/network_attributes.h | 11 +- .../semconv/incubating/process_attributes.h | 20 + .../semconv/incubating/process_metrics.h | 28 +- .../semconv/incubating/service_attributes.h | 26 +- .../semconv/incubating/system_metrics.h | 42 ++ .../semconv/incubating/test_attributes.h | 4 +- .../semconv/incubating/url_attributes.h | 45 +- .../incubating/user_agent_attributes.h | 26 ++ .../semconv/incubating/vcs_attributes.h | 218 +++++++++- .../semconv/incubating/vcs_metrics.h | 394 +++++++++++++++++ .../semconv/network_attributes.h | 11 +- .../opentelemetry/semconv/schema_url.h | 2 +- .../opentelemetry/semconv/url_attributes.h | 45 +- buildscripts/semantic-convention/generate.sh | 2 +- 23 files changed, 1680 insertions(+), 250 deletions(-) create mode 100644 api/include/opentelemetry/semconv/incubating/geo_attributes.h create mode 100644 api/include/opentelemetry/semconv/incubating/vcs_metrics.h diff --git a/api/include/opentelemetry/semconv/incubating/cicd_attributes.h b/api/include/opentelemetry/semconv/incubating/cicd_attributes.h index 246563a8e8..622de977ce 100644 --- a/api/include/opentelemetry/semconv/incubating/cicd_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/cicd_attributes.h @@ -31,8 +31,8 @@ static constexpr const char *kCicdPipelineRunId = "cicd.pipeline.run.id"; /** * The human readable name of a task within a pipeline. Task here most closely aligns with a computing process in a pipeline. - * Other terms for tasks include commands, steps, and procedures. + * href="https://wikipedia.org/wiki/Pipeline_(computing)">computing process in a pipeline. Other + * terms for tasks include commands, steps, and procedures. */ static constexpr const char *kCicdPipelineTaskName = "cicd.pipeline.task.name"; @@ -42,8 +42,8 @@ static constexpr const char *kCicdPipelineTaskName = "cicd.pipeline.task.name"; static constexpr const char *kCicdPipelineTaskRunId = "cicd.pipeline.task.run.id"; /** - * The URL of the pipeline run providing the - * complete address in order to locate and identify the pipeline run. + * The URL of the pipeline run providing the complete + * address in order to locate and identify the pipeline run. */ static constexpr const char *kCicdPipelineTaskRunUrlFull = "cicd.pipeline.task.run.url.full"; diff --git a/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h b/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h index 0eda006baa..a0740e5b38 100644 --- a/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h @@ -32,10 +32,13 @@ static constexpr const char *kCloudfoundryAppId = "cloudfoundry.app.id"; * The index of the application instance. 0 when just one instance is active. *

* CloudFoundry defines the @code instance_id @endcode in the Loggegator v2 envelope. It - * is used for logs and metrics emitted by CloudFoundry. It is supposed to contain the application - * instance index for applications deployed on the runtime.

Application instrumentation should - * use the value from environment variable @code CF_INSTANCE_INDEX @endcode. + * href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggregator v2 envelope. + * It is used for logs and metrics emitted by CloudFoundry. It is + * supposed to contain the application instance index for applications + * deployed on the runtime. + *

+ * Application instrumentation should use the value from environment + * variable @code CF_INSTANCE_INDEX @endcode. */ static constexpr const char *kCloudfoundryAppInstanceId = "cloudfoundry.app.instance.id"; diff --git a/api/include/opentelemetry/semconv/incubating/container_metrics.h b/api/include/opentelemetry/semconv/incubating/container_metrics.h index 8fa2541b32..ef3d9fa71d 100644 --- a/api/include/opentelemetry/semconv/incubating/container_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/container_metrics.h @@ -219,6 +219,48 @@ CreateAsyncDoubleMetricContainerNetworkIo(metrics::Meter *meter) kMetricContainerNetworkIo, descrMetricContainerNetworkIo, unitMetricContainerNetworkIo); } +/** + * The time the container has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricContainerUptime = "metric.container.uptime"; +static constexpr const char *descrMetricContainerUptime = "The time the container has been running"; +static constexpr const char *unitMetricContainerUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricContainerUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricContainerUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerUptime(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerUptime(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricContainerUptime, descrMetricContainerUptime, + unitMetricContainerUptime); +} + } // namespace container } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/db_attributes.h b/api/include/opentelemetry/semconv/incubating/db_attributes.h index 7c5d3304bb..22148fed13 100644 --- a/api/include/opentelemetry/semconv/incubating/db_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/db_attributes.h @@ -98,12 +98,13 @@ static constexpr const char *kDbClientConnectionsState = "db.client.connections. * The name of a collection (table, container) within the database. *

* It is RECOMMENDED to capture the value as provided by the application without attempting to do - * any case normalization. If the collection name is parsed from the query text, it SHOULD be the - * first collection name found in the query and it SHOULD match the value provided in the query text - * including any schema and database name prefix. For batch operations, if the individual operations - * are known to have the same collection name then that collection name SHOULD be used, otherwise - * @code db.collection.name @endcode SHOULD NOT be captured. This attribute has stability level - * RELEASE CANDIDATE. + * any case normalization.

The collection name SHOULD NOT be extracted from @code db.query.text + * @endcode, unless the query format is known to only ever have a single collection name present. + *

+ * For batch operations, if the individual operations are known to have the same collection name + * then that collection name SHOULD be used. + *

+ * This attribute has stability level RELEASE CANDIDATE. */ static constexpr const char *kDbCollectionName = "db.collection.name"; @@ -126,6 +127,12 @@ static constexpr const char *kDbCosmosdbClientId = "db.cosmosdb.client_id"; */ static constexpr const char *kDbCosmosdbConnectionMode = "db.cosmosdb.connection_mode"; +/** + * Account or request consistency level. + */ +static constexpr const char *kDbCosmosdbConsistencyLevel = "db.cosmosdb.consistency_level"; + /** * Deprecated, use @code db.collection.name @endcode instead. *

@@ -136,17 +143,30 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; /** - * Cosmos DB Operation Type. + * Deprecated, no replacement at this time. + *

+ * @deprecated + * No replacement at this time. */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kDbCosmosdbOperationType = "db.cosmosdb.operation_type"; /** - * RU consumed for that operation + * List of regions contacted during operation in the order that they were contacted. If there is + * more than one region listed, it indicates that the operation was performed on multiple regions + * i.e. cross-regional call.

Region name matches the format of @code displayName @endcode in Azure + * Location API + */ +static constexpr const char *kDbCosmosdbRegionsContacted = "db.cosmosdb.regions_contacted"; + +/** + * Request units consumed for the operation. */ static constexpr const char *kDbCosmosdbRequestCharge = "db.cosmosdb.request_charge"; /** - * Request payload size in bytes + * Request payload size in bytes. */ static constexpr const char *kDbCosmosdbRequestContentLength = "db.cosmosdb.request_content_length"; @@ -270,25 +290,53 @@ static constexpr const char *kDbOperationBatchSize = "db.operation.batch.size"; /** * The name of the operation or command being executed. *

- * It is RECOMMENDED to capture the value as provided by the application without attempting to do - * any case normalization. If the operation name is parsed from the query text, it SHOULD be the - * first operation name found in the query. For batch operations, if the individual operations are - * known to have the same operation name then that operation name SHOULD be used prepended by @code - * BATCH @endcode, otherwise @code db.operation.name @endcode SHOULD be @code BATCH @endcode or - * some other database system specific term if more applicable. This attribute has stability level - * RELEASE CANDIDATE. + * It is RECOMMENDED to capture the value as provided by the application + * without attempting to do any case normalization. + *

+ * The operation name SHOULD NOT be extracted from @code db.query.text @endcode, + * unless the query format is known to only ever have a single operation name present. + *

+ * For batch operations, if the individual operations are known to have the same operation name + * then that operation name SHOULD be used prepended by @code BATCH @endcode, + * otherwise @code db.operation.name @endcode SHOULD be @code BATCH @endcode or some other database + * system specific term if more applicable. + *

+ * This attribute has stability level RELEASE CANDIDATE. */ static constexpr const char *kDbOperationName = "db.operation.name"; +/** + * A database operation parameter, with @code @endcode being the parameter name, and the + * attribute value being a string representation of the parameter value.

If a parameter has no + * name and instead is referenced only by index, then @code @endcode SHOULD be the 0-based + * index. If @code db.query.text @endcode is also captured, then @code db.operation.parameter. + * @endcode SHOULD match up with the parameterized placeholders present in @code db.query.text + * @endcode. This attribute has stability level RELEASE CANDIDATE. + */ +static constexpr const char *kDbOperationParameter = "db.operation.parameter"; + /** * A query parameter used in @code db.query.text @endcode, with @code @endcode being the * parameter name, and the attribute value being a string representation of the parameter value.

- * Query parameters should only be captured when @code db.query.text @endcode is parameterized with - * placeholders. If a parameter has no name and instead is referenced only by index, then @code - * @endcode SHOULD be the 0-based index. This attribute has stability level RELEASE CANDIDATE. + * @deprecated + * Replaced by @code db.operation.parameter @endcode. */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kDbQueryParameter = "db.query.parameter"; +/** + * Low cardinality representation of a database query text. + *

+ * @code db.query.summary @endcode provides static summary of the query text. It describes a class + * of database queries and is useful as a grouping key, especially when analyzing telemetry for + * database calls involving complex queries. Summary may be available to the instrumentation through + * instrumentation hooks or other means. If it is not available, instrumentations that support query + * parsing SHOULD generate a summary following Generating + * query summary section. This attribute has stability level RELEASE CANDIDATE. + */ +static constexpr const char *kDbQuerySummary = "db.query.summary"; + /** * The database query being executed. *

@@ -314,6 +362,11 @@ static constexpr const char *kDbQueryText = "db.query.text"; OPENTELEMETRY_DEPRECATED static constexpr const char *kDbRedisDatabaseIndex = "db.redis.database_index"; +/** + * Number of rows returned by the operation. + */ +static constexpr const char *kDbResponseReturnedRows = "db.response.returned_rows"; + /** * Database response status code. *

@@ -452,7 +505,7 @@ static constexpr const char *kUsed = "used"; namespace DbCosmosdbConnectionModeValues { /** - * Gateway (HTTP) connections mode + * Gateway (HTTP) connection. */ static constexpr const char *kGateway = "gateway"; @@ -463,6 +516,35 @@ static constexpr const char *kDirect = "direct"; } // namespace DbCosmosdbConnectionModeValues +namespace DbCosmosdbConsistencyLevelValues +{ +/** + * none + */ +static constexpr const char *kStrong = "Strong"; + +/** + * none + */ +static constexpr const char *kBoundedStaleness = "BoundedStaleness"; + +/** + * none + */ +static constexpr const char *kSession = "Session"; + +/** + * none + */ +static constexpr const char *kEventual = "Eventual"; + +/** + * none + */ +static constexpr const char *kConsistentPrefix = "ConsistentPrefix"; + +} // namespace DbCosmosdbConsistencyLevelValues + namespace DbCosmosdbOperationTypeValues { /** diff --git a/api/include/opentelemetry/semconv/incubating/db_metrics.h b/api/include/opentelemetry/semconv/incubating/db_metrics.h index d3dd52190e..9543a70baa 100644 --- a/api/include/opentelemetry/semconv/incubating/db_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/db_metrics.h @@ -365,31 +365,31 @@ CreateSyncDoubleMetricDbClientConnectionWaitTime(metrics::Meter *meter) * @code ms @endcode to @code s @endcode.

histogram */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsCreateTimeDeprecated = - "metric.db.client.connections.create_time.deprecated"; +static constexpr const char *kMetricDbClientConnectionsCreateTime = + "metric.db.client.connections.create_time"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsCreateTimeDeprecated = +static constexpr const char *descrMetricDbClientConnectionsCreateTime = "Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from " "`ms` to `s`."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsCreateTimeDeprecated = "ms"; +static constexpr const char *unitMetricDbClientConnectionsCreateTime = "ms"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsCreateTime(metrics::Meter *meter) { - return meter->CreateUInt64Histogram(kMetricDbClientConnectionsCreateTimeDeprecated, - descrMetricDbClientConnectionsCreateTimeDeprecated, - unitMetricDbClientConnectionsCreateTimeDeprecated); + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsCreateTime, + descrMetricDbClientConnectionsCreateTime, + unitMetricDbClientConnectionsCreateTime); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsCreateTime(metrics::Meter *meter) { - return meter->CreateDoubleHistogram(kMetricDbClientConnectionsCreateTimeDeprecated, - descrMetricDbClientConnectionsCreateTimeDeprecated, - unitMetricDbClientConnectionsCreateTimeDeprecated); + return meter->CreateDoubleHistogram(kMetricDbClientConnectionsCreateTime, + descrMetricDbClientConnectionsCreateTime, + unitMetricDbClientConnectionsCreateTime); } /** @@ -401,48 +401,48 @@ CreateSyncDoubleMetricDbClientConnectionsCreateTimeDeprecated(metrics::Meter *me * updowncounter */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsIdleMaxDeprecated = - "metric.db.client.connections.idle.max.deprecated"; +static constexpr const char *kMetricDbClientConnectionsIdleMax = + "metric.db.client.connections.idle.max"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsIdleMaxDeprecated = +static constexpr const char *descrMetricDbClientConnectionsIdleMax = "Deprecated, use `db.client.connection.idle.max` instead."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsIdleMaxDeprecated = "{connection}"; +static constexpr const char *unitMetricDbClientConnectionsIdleMax = "{connection}"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsIdleMax(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, - descrMetricDbClientConnectionsIdleMaxDeprecated, - unitMetricDbClientConnectionsIdleMaxDeprecated); + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsIdleMax(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, - descrMetricDbClientConnectionsIdleMaxDeprecated, - unitMetricDbClientConnectionsIdleMaxDeprecated); + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncInt64MetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +CreateAsyncInt64MetricDbClientConnectionsIdleMax(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, - descrMetricDbClientConnectionsIdleMaxDeprecated, - unitMetricDbClientConnectionsIdleMaxDeprecated); + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncDoubleMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *meter) +CreateAsyncDoubleMetricDbClientConnectionsIdleMax(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsIdleMaxDeprecated, - descrMetricDbClientConnectionsIdleMaxDeprecated, - unitMetricDbClientConnectionsIdleMaxDeprecated); + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsIdleMax, + descrMetricDbClientConnectionsIdleMax, + unitMetricDbClientConnectionsIdleMax); } /** @@ -454,48 +454,48 @@ CreateAsyncDoubleMetricDbClientConnectionsIdleMaxDeprecated(metrics::Meter *mete * updowncounter */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsIdleMinDeprecated = - "metric.db.client.connections.idle.min.deprecated"; +static constexpr const char *kMetricDbClientConnectionsIdleMin = + "metric.db.client.connections.idle.min"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsIdleMinDeprecated = +static constexpr const char *descrMetricDbClientConnectionsIdleMin = "Deprecated, use `db.client.connection.idle.min` instead."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsIdleMinDeprecated = "{connection}"; +static constexpr const char *unitMetricDbClientConnectionsIdleMin = "{connection}"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsIdleMin(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, - descrMetricDbClientConnectionsIdleMinDeprecated, - unitMetricDbClientConnectionsIdleMinDeprecated); + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsIdleMin(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, - descrMetricDbClientConnectionsIdleMinDeprecated, - unitMetricDbClientConnectionsIdleMinDeprecated); + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncInt64MetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +CreateAsyncInt64MetricDbClientConnectionsIdleMin(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, - descrMetricDbClientConnectionsIdleMinDeprecated, - unitMetricDbClientConnectionsIdleMinDeprecated); + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncDoubleMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *meter) +CreateAsyncDoubleMetricDbClientConnectionsIdleMin(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsIdleMinDeprecated, - descrMetricDbClientConnectionsIdleMinDeprecated, - unitMetricDbClientConnectionsIdleMinDeprecated); + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsIdleMin, + descrMetricDbClientConnectionsIdleMin, + unitMetricDbClientConnectionsIdleMin); } /** @@ -507,48 +507,47 @@ CreateAsyncDoubleMetricDbClientConnectionsIdleMinDeprecated(metrics::Meter *mete * updowncounter */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsMaxDeprecated = - "metric.db.client.connections.max.deprecated"; +static constexpr const char *kMetricDbClientConnectionsMax = "metric.db.client.connections.max"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsMaxDeprecated = +static constexpr const char *descrMetricDbClientConnectionsMax = "Deprecated, use `db.client.connection.max` instead."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsMaxDeprecated = "{connection}"; +static constexpr const char *unitMetricDbClientConnectionsMax = "{connection}"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsMax(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsMaxDeprecated, - descrMetricDbClientConnectionsMaxDeprecated, - unitMetricDbClientConnectionsMaxDeprecated); + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsMax(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsMaxDeprecated, - descrMetricDbClientConnectionsMaxDeprecated, - unitMetricDbClientConnectionsMaxDeprecated); + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncInt64MetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +CreateAsyncInt64MetricDbClientConnectionsMax(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsMaxDeprecated, - descrMetricDbClientConnectionsMaxDeprecated, - unitMetricDbClientConnectionsMaxDeprecated); + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncDoubleMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) +CreateAsyncDoubleMetricDbClientConnectionsMax(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsMaxDeprecated, - descrMetricDbClientConnectionsMaxDeprecated, - unitMetricDbClientConnectionsMaxDeprecated); + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsMax, + descrMetricDbClientConnectionsMax, + unitMetricDbClientConnectionsMax); } /** @@ -560,50 +559,48 @@ CreateAsyncDoubleMetricDbClientConnectionsMaxDeprecated(metrics::Meter *meter) * updowncounter */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsPendingRequestsDeprecated = - "metric.db.client.connections.pending_requests.deprecated"; +static constexpr const char *kMetricDbClientConnectionsPendingRequests = + "metric.db.client.connections.pending_requests"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsPendingRequestsDeprecated = +static constexpr const char *descrMetricDbClientConnectionsPendingRequests = "Deprecated, use `db.client.connection.pending_requests` instead."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsPendingRequestsDeprecated = "{request}"; +static constexpr const char *unitMetricDbClientConnectionsPendingRequests = "{request}"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsPendingRequests(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsPendingRequestsDeprecated, - descrMetricDbClientConnectionsPendingRequestsDeprecated, - unitMetricDbClientConnectionsPendingRequestsDeprecated); + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsPendingRequests(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsPendingRequestsDeprecated, - descrMetricDbClientConnectionsPendingRequestsDeprecated, - unitMetricDbClientConnectionsPendingRequestsDeprecated); + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncInt64MetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +CreateAsyncInt64MetricDbClientConnectionsPendingRequests(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter( - kMetricDbClientConnectionsPendingRequestsDeprecated, - descrMetricDbClientConnectionsPendingRequestsDeprecated, - unitMetricDbClientConnectionsPendingRequestsDeprecated); + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncDoubleMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Meter *meter) +CreateAsyncDoubleMetricDbClientConnectionsPendingRequests(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter( - kMetricDbClientConnectionsPendingRequestsDeprecated, - descrMetricDbClientConnectionsPendingRequestsDeprecated, - unitMetricDbClientConnectionsPendingRequestsDeprecated); + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsPendingRequests, + descrMetricDbClientConnectionsPendingRequests, + unitMetricDbClientConnectionsPendingRequests); } /** @@ -615,48 +612,48 @@ CreateAsyncDoubleMetricDbClientConnectionsPendingRequestsDeprecated(metrics::Met * counter */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsTimeoutsDeprecated = - "metric.db.client.connections.timeouts.deprecated"; +static constexpr const char *kMetricDbClientConnectionsTimeouts = + "metric.db.client.connections.timeouts"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsTimeoutsDeprecated = +static constexpr const char *descrMetricDbClientConnectionsTimeouts = "Deprecated, use `db.client.connection.timeouts` instead."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsTimeoutsDeprecated = "{timeout}"; +static constexpr const char *unitMetricDbClientConnectionsTimeouts = "{timeout}"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsTimeouts(metrics::Meter *meter) { - return meter->CreateUInt64Counter(kMetricDbClientConnectionsTimeoutsDeprecated, - descrMetricDbClientConnectionsTimeoutsDeprecated, - unitMetricDbClientConnectionsTimeoutsDeprecated); + return meter->CreateUInt64Counter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsTimeouts(metrics::Meter *meter) { - return meter->CreateDoubleCounter(kMetricDbClientConnectionsTimeoutsDeprecated, - descrMetricDbClientConnectionsTimeoutsDeprecated, - unitMetricDbClientConnectionsTimeoutsDeprecated); + return meter->CreateDoubleCounter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncInt64MetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +CreateAsyncInt64MetricDbClientConnectionsTimeouts(metrics::Meter *meter) { - return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionsTimeoutsDeprecated, - descrMetricDbClientConnectionsTimeoutsDeprecated, - unitMetricDbClientConnectionsTimeoutsDeprecated); + return meter->CreateInt64ObservableCounter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncDoubleMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *meter) +CreateAsyncDoubleMetricDbClientConnectionsTimeouts(metrics::Meter *meter) { - return meter->CreateDoubleObservableCounter(kMetricDbClientConnectionsTimeoutsDeprecated, - descrMetricDbClientConnectionsTimeoutsDeprecated, - unitMetricDbClientConnectionsTimeoutsDeprecated); + return meter->CreateDoubleObservableCounter(kMetricDbClientConnectionsTimeouts, + descrMetricDbClientConnectionsTimeouts, + unitMetricDbClientConnectionsTimeouts); } /** @@ -668,48 +665,47 @@ CreateAsyncDoubleMetricDbClientConnectionsTimeoutsDeprecated(metrics::Meter *met * updowncounter */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsCountDeprecated = - "metric.db.client.connections.count.deprecated"; +static constexpr const char *kMetricDbClientConnectionsUsage = "metric.db.client.connections.usage"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsCountDeprecated = +static constexpr const char *descrMetricDbClientConnectionsUsage = "Deprecated, use `db.client.connection.count` instead."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsCountDeprecated = "{connection}"; +static constexpr const char *unitMetricDbClientConnectionsUsage = "{connection}"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsUsage(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsCountDeprecated, - descrMetricDbClientConnectionsCountDeprecated, - unitMetricDbClientConnectionsCountDeprecated); + return meter->CreateInt64UpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsUsage(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsCountDeprecated, - descrMetricDbClientConnectionsCountDeprecated, - unitMetricDbClientConnectionsCountDeprecated); + return meter->CreateDoubleUpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncInt64MetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +CreateAsyncInt64MetricDbClientConnectionsUsage(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsCountDeprecated, - descrMetricDbClientConnectionsCountDeprecated, - unitMetricDbClientConnectionsCountDeprecated); + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); } OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr -CreateAsyncDoubleMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) +CreateAsyncDoubleMetricDbClientConnectionsUsage(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsCountDeprecated, - descrMetricDbClientConnectionsCountDeprecated, - unitMetricDbClientConnectionsCountDeprecated); + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientConnectionsUsage, + descrMetricDbClientConnectionsUsage, + unitMetricDbClientConnectionsUsage); } /** @@ -720,31 +716,31 @@ CreateAsyncDoubleMetricDbClientConnectionsCountDeprecated(metrics::Meter *meter) * ms @endcode to @code s @endcode.

histogram */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsUseTimeDeprecated = - "metric.db.client.connections.use_time.deprecated"; +static constexpr const char *kMetricDbClientConnectionsUseTime = + "metric.db.client.connections.use_time"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsUseTimeDeprecated = +static constexpr const char *descrMetricDbClientConnectionsUseTime = "Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from " "`ms` to `s`."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsUseTimeDeprecated = "ms"; +static constexpr const char *unitMetricDbClientConnectionsUseTime = "ms"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsUseTime(metrics::Meter *meter) { - return meter->CreateUInt64Histogram(kMetricDbClientConnectionsUseTimeDeprecated, - descrMetricDbClientConnectionsUseTimeDeprecated, - unitMetricDbClientConnectionsUseTimeDeprecated); + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsUseTime, + descrMetricDbClientConnectionsUseTime, + unitMetricDbClientConnectionsUseTime); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsUseTime(metrics::Meter *meter) { - return meter->CreateDoubleHistogram(kMetricDbClientConnectionsUseTimeDeprecated, - descrMetricDbClientConnectionsUseTimeDeprecated, - unitMetricDbClientConnectionsUseTimeDeprecated); + return meter->CreateDoubleHistogram(kMetricDbClientConnectionsUseTime, + descrMetricDbClientConnectionsUseTime, + unitMetricDbClientConnectionsUseTime); } /** @@ -755,31 +751,101 @@ CreateSyncDoubleMetricDbClientConnectionsUseTimeDeprecated(metrics::Meter *meter * ms @endcode to @code s @endcode.

histogram */ OPENTELEMETRY_DEPRECATED -static constexpr const char *kMetricDbClientConnectionsWaitTimeDeprecated = - "metric.db.client.connections.wait_time.deprecated"; +static constexpr const char *kMetricDbClientConnectionsWaitTime = + "metric.db.client.connections.wait_time"; OPENTELEMETRY_DEPRECATED -static constexpr const char *descrMetricDbClientConnectionsWaitTimeDeprecated = +static constexpr const char *descrMetricDbClientConnectionsWaitTime = "Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from " "`ms` to `s`."; OPENTELEMETRY_DEPRECATED -static constexpr const char *unitMetricDbClientConnectionsWaitTimeDeprecated = "ms"; +static constexpr const char *unitMetricDbClientConnectionsWaitTime = "ms"; OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncInt64MetricDbClientConnectionsWaitTimeDeprecated(metrics::Meter *meter) +CreateSyncInt64MetricDbClientConnectionsWaitTime(metrics::Meter *meter) { - return meter->CreateUInt64Histogram(kMetricDbClientConnectionsWaitTimeDeprecated, - descrMetricDbClientConnectionsWaitTimeDeprecated, - unitMetricDbClientConnectionsWaitTimeDeprecated); + return meter->CreateUInt64Histogram(kMetricDbClientConnectionsWaitTime, + descrMetricDbClientConnectionsWaitTime, + unitMetricDbClientConnectionsWaitTime); } OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> -CreateSyncDoubleMetricDbClientConnectionsWaitTimeDeprecated(metrics::Meter *meter) +CreateSyncDoubleMetricDbClientConnectionsWaitTime(metrics::Meter *meter) { - return meter->CreateDoubleHistogram(kMetricDbClientConnectionsWaitTimeDeprecated, - descrMetricDbClientConnectionsWaitTimeDeprecated, - unitMetricDbClientConnectionsWaitTimeDeprecated); + return meter->CreateDoubleHistogram(kMetricDbClientConnectionsWaitTime, + descrMetricDbClientConnectionsWaitTime, + unitMetricDbClientConnectionsWaitTime); +} + +/** + * Number of active client instances + *

+ * updowncounter + */ +static constexpr const char *kMetricDbClientCosmosdbActiveInstanceCount = + "metric.db.client.cosmosdb.active_instance.count"; +static constexpr const char *descrMetricDbClientCosmosdbActiveInstanceCount = + "Number of active client instances"; +static constexpr const char *unitMetricDbClientCosmosdbActiveInstanceCount = "{instance}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricDbClientCosmosdbActiveInstanceCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricDbClientCosmosdbActiveInstanceCount, + descrMetricDbClientCosmosdbActiveInstanceCount, + unitMetricDbClientCosmosdbActiveInstanceCount); +} + +/** + * Request charge consumed + * by the operation

histogram + */ +static constexpr const char *kMetricDbClientCosmosdbOperationRequestCharge = + "metric.db.client.cosmosdb.operation.request_charge"; +static constexpr const char *descrMetricDbClientCosmosdbOperationRequestCharge = + "[Request charge](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the " + "operation"; +static constexpr const char *unitMetricDbClientCosmosdbOperationRequestCharge = "{request_unit}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientCosmosdbOperationRequestCharge(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientCosmosdbOperationRequestCharge, + descrMetricDbClientCosmosdbOperationRequestCharge, + unitMetricDbClientCosmosdbOperationRequestCharge); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientCosmosdbOperationRequestCharge(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientCosmosdbOperationRequestCharge, + descrMetricDbClientCosmosdbOperationRequestCharge, + unitMetricDbClientCosmosdbOperationRequestCharge); } /** @@ -811,6 +877,33 @@ CreateSyncDoubleMetricDbClientOperationDuration(metrics::Meter *meter) unitMetricDbClientOperationDuration); } +/** + * The actual number of records returned by the database operation. + *

+ * histogram + */ +static constexpr const char *kMetricDbClientResponseReturnedRows = + "metric.db.client.response.returned_rows"; +static constexpr const char *descrMetricDbClientResponseReturnedRows = + "The actual number of records returned by the database operation."; +static constexpr const char *unitMetricDbClientResponseReturnedRows = "{row}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricDbClientResponseReturnedRows(metrics::Meter *meter) +{ + return meter->CreateUInt64Histogram(kMetricDbClientResponseReturnedRows, + descrMetricDbClientResponseReturnedRows, + unitMetricDbClientResponseReturnedRows); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricDbClientResponseReturnedRows(metrics::Meter *meter) +{ + return meter->CreateDoubleHistogram(kMetricDbClientResponseReturnedRows, + descrMetricDbClientResponseReturnedRows, + unitMetricDbClientResponseReturnedRows); +} + } // namespace db } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h b/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h index 3cd8b8eb2c..9616fc14e0 100644 --- a/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/feature_flag_attributes.h @@ -20,28 +20,104 @@ namespace feature_flag { /** - * The unique identifier of the feature flag. + * The unique identifier for the flag evaluation context. For example, the targeting key. + */ +static constexpr const char *kFeatureFlagContextId = "feature_flag.context.id"; + +/** + * A message explaining the nature of an error occurring during flag evaluation. + */ +static constexpr const char *kFeatureFlagEvaluationErrorMessage = + "feature_flag.evaluation.error.message"; + +/** + * The reason code which shows how a feature flag value was determined. + */ +static constexpr const char *kFeatureFlagEvaluationReason = "feature_flag.evaluation.reason"; + +/** + * The lookup key of the feature flag. */ static constexpr const char *kFeatureFlagKey = "feature_flag.key"; /** - * The name of the service provider that performs the flag evaluation. + * Identifies the feature flag provider. */ static constexpr const char *kFeatureFlagProviderName = "feature_flag.provider_name"; /** - * SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the - * value can be used.

A semantic identifier, commonly referred to as a variant, provides a means + * The identifier of the flag + * set to which the feature flag belongs. + */ +static constexpr const char *kFeatureFlagSetId = "feature_flag.set.id"; + +/** + * A semantic identifier for an evaluated flag value. + *

+ * A semantic identifier, commonly referred to as a variant, provides a means * for referring to a value without including the value itself. This can * provide additional context for understanding the meaning behind a value. * For example, the variant @code red @endcode maybe be used for the value @code #c05543 @endcode. - *

- * A stringified version of the value can be used in situations where a - * semantic identifier is unavailable. String representation of the value - * should be determined by the implementer. */ static constexpr const char *kFeatureFlagVariant = "feature_flag.variant"; +/** + * The version of the ruleset used during the evaluation. This may be any stable value which + * uniquely identifies the ruleset. + */ +static constexpr const char *kFeatureFlagVersion = "feature_flag.version"; + +namespace FeatureFlagEvaluationReasonValues +{ +/** + * The resolved value is static (no dynamic evaluation). + */ +static constexpr const char *kStatic = "static"; + +/** + * The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic + * evaluation yielded no result). + */ +static constexpr const char *kDefault = "default"; + +/** + * The resolved value was the result of a dynamic evaluation, such as a rule or specific + * user-targeting. + */ +static constexpr const char *kTargetingMatch = "targeting_match"; + +/** + * The resolved value was the result of pseudorandom assignment. + */ +static constexpr const char *kSplit = "split"; + +/** + * The resolved value was retrieved from cache. + */ +static constexpr const char *kCached = "cached"; + +/** + * The resolved value was the result of the flag being disabled in the management system. + */ +static constexpr const char *kDisabled = "disabled"; + +/** + * The reason for the resolved value could not be determined. + */ +static constexpr const char *kUnknown = "unknown"; + +/** + * The resolved value is non-authoritative or possibly out of date + */ +static constexpr const char *kStale = "stale"; + +/** + * The resolved value was the result of an error. + */ +static constexpr const char *kError = "error"; + +} // namespace FeatureFlagEvaluationReasonValues + } // namespace feature_flag } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h index ce4a939d07..b56e98f178 100644 --- a/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h @@ -40,7 +40,7 @@ static constexpr const char *kGenAiOpenaiRequestResponseFormat = static constexpr const char *kGenAiOpenaiRequestSeed = "gen_ai.openai.request.seed"; /** - * The service tier requested. May be a specific tier, detault, or auto. + * The service tier requested. May be a specific tier, default, or auto. */ static constexpr const char *kGenAiOpenaiRequestServiceTier = "gen_ai.openai.request.service_tier"; @@ -50,6 +50,12 @@ static constexpr const char *kGenAiOpenaiRequestServiceTier = "gen_ai.openai.req static constexpr const char *kGenAiOpenaiResponseServiceTier = "gen_ai.openai.response.service_tier"; +/** + * A fingerprint to track any eventual change in the Generative AI environment. + */ +static constexpr const char *kGenAiOpenaiResponseSystemFingerprint = + "gen_ai.openai.response.system_fingerprint"; + /** * The name of the operation being performed. *

@@ -69,6 +75,14 @@ static constexpr const char *kGenAiOperationName = "gen_ai.operation.name"; OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiPrompt = "gen_ai.prompt"; +/** + * The encoding formats requested in an embeddings operation, if specified. + *

+ * In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems + * only accept a single format per request. + */ +static constexpr const char *kGenAiRequestEncodingFormats = "gen_ai.request.encoding_formats"; + /** * The frequency penalty setting for the GenAI request. */ @@ -218,6 +232,13 @@ static constexpr const char *kChat = "chat"; */ static constexpr const char *kTextCompletion = "text_completion"; +/** + * Embeddings operation such as OpenAI Create embeddings + * API + */ +static constexpr const char *kEmbeddings = "embeddings"; + } // namespace GenAiOperationNameValues namespace GenAiSystemValues @@ -242,6 +263,21 @@ static constexpr const char *kAnthropic = "anthropic"; */ static constexpr const char *kCohere = "cohere"; +/** + * Azure AI Inference + */ +static constexpr const char *kAzAiInference = "az.ai.inference"; + +/** + * IBM Watsonx AI + */ +static constexpr const char *kIbmWatsonxAi = "ibm.watsonx.ai"; + +/** + * AWS Bedrock + */ +static constexpr const char *kAwsBedrock = "aws.bedrock"; + } // namespace GenAiSystemValues namespace GenAiTokenTypeValues diff --git a/api/include/opentelemetry/semconv/incubating/geo_attributes.h b/api/include/opentelemetry/semconv/incubating/geo_attributes.h new file mode 100644 index 0000000000..b50240e228 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/geo_attributes.h @@ -0,0 +1,102 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace geo +{ + +/** + * Two-letter code representing continent’s name. + */ +static constexpr const char *kGeoContinentCode = "geo.continent.code"; + +/** + * Two-letter ISO Country Code (ISO 3166-1 + * alpha2). + */ +static constexpr const char *kGeoCountryIsoCode = "geo.country.iso_code"; + +/** + * Locality name. Represents the name of a city, town, village, or similar populated place. + */ +static constexpr const char *kGeoLocalityName = "geo.locality.name"; + +/** + * Latitude of the geo location in WGS84. + */ +static constexpr const char *kGeoLocationLat = "geo.location.lat"; + +/** + * Longitude of the geo location in WGS84. + */ +static constexpr const char *kGeoLocationLon = "geo.location.lon"; + +/** + * Postal code associated with the location. Values appropriate for this field may also be known as + * a postcode or ZIP code and will vary widely from country to country. + */ +static constexpr const char *kGeoPostalCode = "geo.postal_code"; + +/** + * Region ISO code (ISO 3166-2). + */ +static constexpr const char *kGeoRegionIsoCode = "geo.region.iso_code"; + +namespace GeoContinentCodeValues +{ +/** + * Africa + */ +static constexpr const char *kAf = "AF"; + +/** + * Antarctica + */ +static constexpr const char *kAn = "AN"; + +/** + * Asia + */ +static constexpr const char *kAs = "AS"; + +/** + * Europe + */ +static constexpr const char *kEu = "EU"; + +/** + * North America + */ +static constexpr const char *kNa = "NA"; + +/** + * Oceania + */ +static constexpr const char *kOc = "OC"; + +/** + * South America + */ +static constexpr const char *kSa = "SA"; + +} // namespace GeoContinentCodeValues + +} // namespace geo +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/k8s_metrics.h b/api/include/opentelemetry/semconv/incubating/k8s_metrics.h index 2753ba4be1..2495f0bc70 100644 --- a/api/include/opentelemetry/semconv/incubating/k8s_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/k8s_metrics.h @@ -144,6 +144,122 @@ CreateAsyncDoubleMetricK8sNodeMemoryUsage(metrics::Meter *meter) kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, unitMetricK8sNodeMemoryUsage); } +/** + * Node network errors + *

+ * counter + */ +static constexpr const char *kMetricK8sNodeNetworkErrors = "metric.k8s.node.network.errors"; +static constexpr const char *descrMetricK8sNodeNetworkErrors = "Node network errors"; +static constexpr const char *unitMetricK8sNodeNetworkErrors = "{error}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, + unitMetricK8sNodeNetworkErrors); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, + unitMetricK8sNodeNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, unitMetricK8sNodeNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricK8sNodeNetworkErrors, descrMetricK8sNodeNetworkErrors, unitMetricK8sNodeNetworkErrors); +} + +/** + * Network bytes for the Node + *

+ * counter + */ +static constexpr const char *kMetricK8sNodeNetworkIo = "metric.k8s.node.network.io"; +static constexpr const char *descrMetricK8sNodeNetworkIo = "Network bytes for the Node"; +static constexpr const char *unitMetricK8sNodeNetworkIo = "By"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sNodeNetworkIo, descrMetricK8sNodeNetworkIo, + unitMetricK8sNodeNetworkIo); +} + +/** + * The time the Node has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricK8sNodeUptime = "metric.k8s.node.uptime"; +static constexpr const char *descrMetricK8sNodeUptime = "The time the Node has been running"; +static constexpr const char *unitMetricK8sNodeUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sNodeUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sNodeUptime, descrMetricK8sNodeUptime, + unitMetricK8sNodeUptime); +} + /** * Total CPU time consumed *

@@ -268,6 +384,122 @@ CreateAsyncDoubleMetricK8sPodMemoryUsage(metrics::Meter *meter) unitMetricK8sPodMemoryUsage); } +/** + * Pod network errors + *

+ * counter + */ +static constexpr const char *kMetricK8sPodNetworkErrors = "metric.k8s.pod.network.errors"; +static constexpr const char *descrMetricK8sPodNetworkErrors = "Pod network errors"; +static constexpr const char *unitMetricK8sPodNetworkErrors = "{error}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, + unitMetricK8sPodNetworkErrors); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodNetworkErrors( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, + unitMetricK8sPodNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, unitMetricK8sPodNetworkErrors); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodNetworkErrors(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricK8sPodNetworkErrors, descrMetricK8sPodNetworkErrors, unitMetricK8sPodNetworkErrors); +} + +/** + * Network bytes for the Pod + *

+ * counter + */ +static constexpr const char *kMetricK8sPodNetworkIo = "metric.k8s.pod.network.io"; +static constexpr const char *descrMetricK8sPodNetworkIo = "Network bytes for the Pod"; +static constexpr const char *unitMetricK8sPodNetworkIo = "By"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodNetworkIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodNetworkIo(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodNetworkIo(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sPodNetworkIo, descrMetricK8sPodNetworkIo, + unitMetricK8sPodNetworkIo); +} + +/** + * The time the Pod has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricK8sPodUptime = "metric.k8s.pod.uptime"; +static constexpr const char *descrMetricK8sPodUptime = "The time the Pod has been running"; +static constexpr const char *unitMetricK8sPodUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sPodUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sPodUptime, descrMetricK8sPodUptime, + unitMetricK8sPodUptime); +} + } // namespace k8s } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/network_attributes.h b/api/include/opentelemetry/semconv/incubating/network_attributes.h index ea855c5735..5096937112 100644 --- a/api/include/opentelemetry/semconv/incubating/network_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/network_attributes.h @@ -50,6 +50,11 @@ static constexpr const char *kNetworkConnectionSubtype = "network.connection.sub */ static constexpr const char *kNetworkConnectionType = "network.connection.type"; +/** + * The network interface name. + */ +static constexpr const char *kNetworkInterfaceName = "network.interface.name"; + /** * The network IO operation direction. */ @@ -76,7 +81,7 @@ static constexpr const char *kNetworkPeerAddress = "network.peer.address"; static constexpr const char *kNetworkPeerPort = "network.peer.port"; /** - * OSI application layer or non-OSI + * OSI application layer or non-OSI * equivalent.

The value SHOULD be normalized to lowercase. */ static constexpr const char *kNetworkProtocolName = "network.protocol.name"; @@ -92,7 +97,7 @@ static constexpr const char *kNetworkProtocolName = "network.protocol.name"; static constexpr const char *kNetworkProtocolVersion = "network.protocol.version"; /** - * OSI transport layer or OSI transport layer or inter-process communication * method.

The value SHOULD be normalized to lowercase.

Consider always setting the * transport when setting a port number, since a port number is ambiguous without knowing the @@ -102,7 +107,7 @@ static constexpr const char *kNetworkProtocolVersion = "network.protocol.version static constexpr const char *kNetworkTransport = "network.transport"; /** - * OSI network layer or non-OSI equivalent. + * OSI network layer or non-OSI equivalent. *

* The value SHOULD be normalized to lowercase. */ diff --git a/api/include/opentelemetry/semconv/incubating/process_attributes.h b/api/include/opentelemetry/semconv/incubating/process_attributes.h index de81b12c38..f211c3e41a 100644 --- a/api/include/opentelemetry/semconv/incubating/process_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/process_attributes.h @@ -82,6 +82,16 @@ static constexpr const char *kProcessExecutableBuildIdGo = "process.executable.b * Profiling specific build ID for executables. See the OTel specification for Profiles for more * information. */ +static constexpr const char *kProcessExecutableBuildIdHtlhash = + "process.executable.build_id.htlhash"; + +/** + * "Deprecated, use @code process.executable.build_id.htlhash @endcode instead." + *

+ * @deprecated + * Replaced by @code process.executable.build_id.htlhash @endcode + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kProcessExecutableBuildIdProfiling = "process.executable.build_id.profiling"; @@ -119,6 +129,16 @@ static constexpr const char *kProcessGroupLeaderPid = "process.group_leader.pid" */ static constexpr const char *kProcessInteractive = "process.interactive"; +/** + * The control group associated with the process. + *

+ * Control groups (cgroups) are a kernel feature used to organize and manage process resources. This + * attribute provides the path(s) to the cgroup(s) associated with the process, which should match + * the contents of the /proc//cgroup file. + */ +static constexpr const char *kProcessLinuxCgroup = "process.linux.cgroup"; + /** * The username of the user that owns the process. */ diff --git a/api/include/opentelemetry/semconv/incubating/process_metrics.h b/api/include/opentelemetry/semconv/incubating/process_metrics.h index 5f851a2d41..a8bb4cb637 100644 --- a/api/include/opentelemetry/semconv/incubating/process_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/process_metrics.h @@ -414,39 +414,43 @@ CreateAsyncDoubleMetricProcessThreadCount(metrics::Meter *meter) /** * The time the process has been running. *

- * Instrumentations SHOULD use counter with type @code double @endcode and measure uptime with at - * least millisecond precision

counter + * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge */ static constexpr const char *kMetricProcessUptime = "metric.process.uptime"; static constexpr const char *descrMetricProcessUptime = "The time the process has been running."; static constexpr const char *unitMetricProcessUptime = "s"; -static inline nostd::unique_ptr> CreateSyncInt64MetricProcessUptime( +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricProcessUptime( metrics::Meter *meter) { - return meter->CreateUInt64Counter(kMetricProcessUptime, descrMetricProcessUptime, - unitMetricProcessUptime); + return meter->CreateInt64Gauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); } -static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessUptime( +static inline nostd::unique_ptr> CreateSyncDoubleMetricProcessUptime( metrics::Meter *meter) { - return meter->CreateDoubleCounter(kMetricProcessUptime, descrMetricProcessUptime, - unitMetricProcessUptime); + return meter->CreateDoubleGauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); } +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ static inline nostd::shared_ptr CreateAsyncInt64MetricProcessUptime( metrics::Meter *meter) { - return meter->CreateInt64ObservableCounter(kMetricProcessUptime, descrMetricProcessUptime, - unitMetricProcessUptime); + return meter->CreateInt64ObservableGauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); } static inline nostd::shared_ptr CreateAsyncDoubleMetricProcessUptime( metrics::Meter *meter) { - return meter->CreateDoubleObservableCounter(kMetricProcessUptime, descrMetricProcessUptime, - unitMetricProcessUptime); + return meter->CreateDoubleObservableGauge(kMetricProcessUptime, descrMetricProcessUptime, + unitMetricProcessUptime); } } // namespace process diff --git a/api/include/opentelemetry/semconv/incubating/service_attributes.h b/api/include/opentelemetry/semconv/incubating/service_attributes.h index 7582c19868..4ff3f1ab97 100644 --- a/api/include/opentelemetry/semconv/incubating/service_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/service_attributes.h @@ -34,19 +34,19 @@ namespace service * 4d63009a-8d0f-11ee-aad7-4c796ed8e320 @endcode.

UUIDs are typically recommended, as only an * opaque value for the purposes of identifying a service instance is needed. Similar to what can be * seen in the man page for the @code /etc/machine-id - * @endcode file, the underlying data, such as pod name and namespace should be treated as - * confidential, being the user's choice to expose it or not via another resource attribute.

For - * applications running behind an application server (like unicorn), we do not recommend using one - * identifier for all processes participating in the application. Instead, it's recommended each - * division (e.g. a worker thread in unicorn) to have its own instance.id.

It's not recommended - * for a Collector to set @code service.instance.id @endcode if it can't unambiguously determine the - * service instance that is generating that telemetry. For instance, creating an UUID based on @code - * pod.name @endcode will likely be wrong, as the Collector might not know from which container - * within that pod the telemetry originated. However, Collectors can set the @code - * service.instance.id @endcode if they can unambiguously determine the service instance for that - * telemetry. This is typically the case for scraping receivers, as they know the target address and - * port. + * href="https://www.freedesktop.org/software/systemd/man/latest/machine-id.html">@code + * /etc/machine-id @endcode file, the underlying data, such as pod name and namespace should be + * treated as confidential, being the user's choice to expose it or not via another resource + * attribute.

For applications running behind an application server (like unicorn), we do not + * recommend using one identifier for all processes participating in the application. Instead, it's + * recommended each division (e.g. a worker thread in unicorn) to have its own instance.id.

It's + * not recommended for a Collector to set @code service.instance.id @endcode if it can't + * unambiguously determine the service instance that is generating that telemetry. For instance, + * creating an UUID based on @code pod.name @endcode will likely be wrong, as the Collector might + * not know from which container within that pod the telemetry originated. However, Collectors can + * set the @code service.instance.id @endcode if they can unambiguously determine the service + * instance for that telemetry. This is typically the case for scraping receivers, as they know the + * target address and port. */ static constexpr const char *kServiceInstanceId = "service.instance.id"; diff --git a/api/include/opentelemetry/semconv/incubating/system_metrics.h b/api/include/opentelemetry/semconv/incubating/system_metrics.h index a23a8ae4d0..37ea70a213 100644 --- a/api/include/opentelemetry/semconv/incubating/system_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/system_metrics.h @@ -1279,6 +1279,48 @@ CreateAsyncDoubleMetricSystemProcessCreated(metrics::Meter *meter) kMetricSystemProcessCreated, descrMetricSystemProcessCreated, unitMetricSystemProcessCreated); } +/** + * The time the system has been running + *

+ * Instrumentations SHOULD use a gauge with type @code double @endcode and measure uptime in seconds + * as a floating point number with the highest precision available. The actual accuracy would depend + * on the instrumentation and operating system.

gauge + */ +static constexpr const char *kMetricSystemUptime = "metric.system.uptime"; +static constexpr const char *descrMetricSystemUptime = "The time the system has been running"; +static constexpr const char *unitMetricSystemUptime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricSystemUptime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricSystemUptime, descrMetricSystemUptime, + unitMetricSystemUptime); +} + } // namespace system } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/test_attributes.h b/api/include/opentelemetry/semconv/incubating/test_attributes.h index dce482055c..228f0bb273 100644 --- a/api/include/opentelemetry/semconv/incubating/test_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/test_attributes.h @@ -21,7 +21,7 @@ namespace test /** * The fully qualified human readable name of the test case. + * href="https://wikipedia.org/wiki/Test_case">test case. */ static constexpr const char *kTestCaseName = "test.case.name"; @@ -31,7 +31,7 @@ static constexpr const char *kTestCaseName = "test.case.name"; static constexpr const char *kTestCaseResultStatus = "test.case.result.status"; /** - * The human readable name of a test suite. + * The human readable name of a test suite. */ static constexpr const char *kTestSuiteName = "test.suite.name"; diff --git a/api/include/opentelemetry/semconv/incubating/url_attributes.h b/api/include/opentelemetry/semconv/incubating/url_attributes.h index fb3418e26a..781521fa03 100644 --- a/api/include/opentelemetry/semconv/incubating/url_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/url_attributes.h @@ -48,14 +48,33 @@ static constexpr const char *kUrlFragment = "url.fragment"; * Absolute URL describing a network resource according to RFC3986

For network calls, URL usually has * @code scheme://host[:port][path][?query][#fragment] @endcode format, where the fragment is not - * transmitted over HTTP, but if it is known, it SHOULD be included nevertheless. + * transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.

* @code url.full @endcode MUST NOT contain credentials passed via URL in form of @code * https://username:password@www.example.com/ @endcode. In such case username and password SHOULD be * redacted and attribute's value SHOULD be @code https://REDACTED:REDACTED@www.example.com/ - * @endcode. + * @endcode.

* @code url.full @endcode SHOULD capture the absolute URL when it is available (or can be - * reconstructed). Sensitive content provided in @code url.full @endcode SHOULD be scrubbed when - * instrumentations can identify it. + * reconstructed).

Sensitive content provided in @code url.full @endcode SHOULD be scrubbed when + * instrumentations can identify it.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode: + *

+ *

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code https://www.example.com/path?color=blue&sig=REDACTED @endcode. */ static constexpr const char *kUrlFull = "url.full"; @@ -88,7 +107,23 @@ static constexpr const char *kUrlPort = "url.port"; * The URI query component *

* Sensitive content provided in @code url.query @endcode SHOULD be scrubbed when instrumentations - * can identify it. + * can identify it.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode:

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code q=OpenTelemetry&sig=REDACTED @endcode. */ static constexpr const char *kUrlQuery = "url.query"; diff --git a/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h b/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h index 738bb6de15..1ebffd13ec 100644 --- a/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/user_agent_attributes.h @@ -35,6 +35,18 @@ static constexpr const char *kUserAgentName = "user_agent.name"; */ static constexpr const char *kUserAgentOriginal = "user_agent.original"; +/** + * Specifies the category of synthetic traffic, such as tests or bots. + *

+ * This attribute MAY be derived from the contents of the @code user_agent.original @endcode + * attribute. Components that populate the attribute are responsible for determining what they + * consider to be synthetic bot or test traffic. This attribute can either be set for + * self-identification purposes, or on telemetry detected to be generated as a result of a synthetic + * request. This attribute is useful for distinguishing between genuine client traffic and synthetic + * traffic generated by bots or tests. + */ +static constexpr const char *kUserAgentSyntheticType = "user_agent.synthetic.type"; + /** * Version of the user-agent extracted from original. Usually refers to the browser's version *

@@ -46,6 +58,20 @@ static constexpr const char *kUserAgentOriginal = "user_agent.original"; */ static constexpr const char *kUserAgentVersion = "user_agent.version"; +namespace UserAgentSyntheticTypeValues +{ +/** + * Bot source. + */ +static constexpr const char *kBot = "bot"; + +/** + * Synthetic test source. + */ +static constexpr const char *kTest = "test"; + +} // namespace UserAgentSyntheticTypeValues + } // namespace user_agent } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/vcs_attributes.h b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h index cc38902e88..b5f05d38da 100644 --- a/api/include/opentelemetry/semconv/incubating/vcs_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h @@ -20,22 +20,32 @@ namespace vcs { /** - * The ID of the change (pull request/merge request) if applicable. This is usually a unique (within - * repository) identifier generated by the VCS system. + * The ID of the change (pull request/merge request/changelist) if applicable. This is usually a + * unique (within repository) identifier generated by the VCS system. */ -static constexpr const char *kVcsRepositoryChangeId = "vcs.repository.change.id"; +static constexpr const char *kVcsChangeId = "vcs.change.id"; /** - * The human readable title of the change (pull request/merge request). This title is often a brief - * summary of the change and may get merged in to a ref as the commit summary. + * The state of the change (pull request/merge request/changelist). */ -static constexpr const char *kVcsRepositoryChangeTitle = "vcs.repository.change.title"; +static constexpr const char *kVcsChangeState = "vcs.change.state"; + +/** + * The human readable title of the change (pull request/merge request/changelist). This title is + * often a brief summary of the change and may get merged in to a ref as the commit summary. + */ +static constexpr const char *kVcsChangeTitle = "vcs.change.title"; + +/** + * The type of line change being measured on a branch or change. + */ +static constexpr const char *kVcsLineChangeType = "vcs.line_change.type"; /** * The name of the reference such as * branch or tag in the repository. */ -static constexpr const char *kVcsRepositoryRefName = "vcs.repository.ref.name"; +static constexpr const char *kVcsRefBaseName = "vcs.ref.base.name"; /** * The revision, literally revised @@ -47,24 +57,198 @@ static constexpr const char *kVcsRepositoryRefName = "vcs.repository.ref.name"; * not necessarily have to be a hash; it can simply define a * revision number * which is an integer that is monotonically increasing. In cases where - * it is identical to the @code ref.name @endcode, it SHOULD still be included. It is + * it is identical to the @code ref.base.name @endcode, it SHOULD still be included. It is * up to the implementer to decide which value to set as the revision * based on the VCS system and situational context. */ -static constexpr const char *kVcsRepositoryRefRevision = "vcs.repository.ref.revision"; +static constexpr const char *kVcsRefBaseRevision = "vcs.ref.base.revision"; + +/** + * The type of the reference in the + * repository. + */ +static constexpr const char *kVcsRefBaseType = "vcs.ref.base.type"; + +/** + * The name of the reference such as + * branch or tag in the repository. + */ +static constexpr const char *kVcsRefHeadName = "vcs.ref.head.name"; + +/** + * The revision, literally revised + * version, The revision most often refers to a commit object in Git, or a revision number in + * SVN.

The revision can be a full hash value (see glossary), + * of the recorded change to a ref within a repository pointing to a + * commit commit object. It does + * not necessarily have to be a hash; it can simply define a + * revision number + * which is an integer that is monotonically increasing. In cases where + * it is identical to the @code ref.head.name @endcode, it SHOULD still be included. It is + * up to the implementer to decide which value to set as the revision + * based on the VCS system and situational context. + */ +static constexpr const char *kVcsRefHeadRevision = "vcs.ref.head.revision"; /** * The type of the reference in the * repository. */ +static constexpr const char *kVcsRefHeadType = "vcs.ref.head.type"; + +/** + * The type of the reference in the + * repository. + */ +static constexpr const char *kVcsRefType = "vcs.ref.type"; + +/** + * Deprecated, use @code vcs.change.id @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.change.id @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryChangeId = "vcs.repository.change.id"; + +/** + * Deprecated, use @code vcs.change.title @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.change.title @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryChangeTitle = "vcs.repository.change.title"; + +/** + * Deprecated, use @code vcs.ref.head.name @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.ref.head.name @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryRefName = "vcs.repository.ref.name"; + +/** + * Deprecated, use @code vcs.ref.head.revision @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.ref.head.revision @endcode instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kVcsRepositoryRefRevision = "vcs.repository.ref.revision"; + +/** + * Deprecated, use @code vcs.ref.head.type @endcode instead. + *

+ * @deprecated + * Deprecated, use @code vcs.ref.head.type @endcode instead. + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kVcsRepositoryRefType = "vcs.repository.ref.type"; /** - * The URL of the repository providing the complete + * The URL of the repository providing the complete * address in order to locate and identify the repository. */ static constexpr const char *kVcsRepositoryUrlFull = "vcs.repository.url.full"; +/** + * The type of revision comparison. + */ +static constexpr const char *kVcsRevisionDeltaDirection = "vcs.revision_delta.direction"; + +namespace VcsChangeStateValues +{ +/** + * Open means the change is currently active and under review. It hasn't been merged into the target + * branch yet, and it's still possible to make changes or add comments. + */ +static constexpr const char *kOpen = "open"; + +/** + * WIP (work-in-progress, draft) means the change is still in progress and not yet ready for a full + * review. It might still undergo significant changes. + */ +static constexpr const char *kWip = "wip"; + +/** + * Closed means the merge request has been closed without merging. This can happen for various + * reasons, such as the changes being deemed unnecessary, the issue being resolved in another way, + * or the author deciding to withdraw the request. + */ +static constexpr const char *kClosed = "closed"; + +/** + * Merged indicates that the change has been successfully integrated into the target codebase. + */ +static constexpr const char *kMerged = "merged"; + +} // namespace VcsChangeStateValues + +namespace VcsLineChangeTypeValues +{ +/** + * How many lines were added. + */ +static constexpr const char *kAdded = "added"; + +/** + * How many lines were removed. + */ +static constexpr const char *kRemoved = "removed"; + +} // namespace VcsLineChangeTypeValues + +namespace VcsRefBaseTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRefBaseTypeValues + +namespace VcsRefHeadTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRefHeadTypeValues + +namespace VcsRefTypeValues +{ +/** + * branch + */ +static constexpr const char *kBranch = "branch"; + +/** + * tag + */ +static constexpr const char *kTag = "tag"; + +} // namespace VcsRefTypeValues + namespace VcsRepositoryRefTypeValues { /** @@ -81,6 +265,20 @@ static constexpr const char *kTag = "tag"; } // namespace VcsRepositoryRefTypeValues +namespace VcsRevisionDeltaDirectionValues +{ +/** + * How many revisions the change is behind the target ref. + */ +static constexpr const char *kBehind = "behind"; + +/** + * How many revisions the change is ahead of the target ref. + */ +static constexpr const char *kAhead = "ahead"; + +} // namespace VcsRevisionDeltaDirectionValues + } // namespace vcs } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/vcs_metrics.h b/api/include/opentelemetry/semconv/incubating/vcs_metrics.h new file mode 100644 index 0000000000..ef5749fabe --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/vcs_metrics.h @@ -0,0 +1,394 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace vcs +{ + +/** + * The number of changes (pull requests/merge requests/changelists) in a repository, categorized by + * their state (e.g. open or merged)

updowncounter + */ +static constexpr const char *kMetricVcsChangeCount = "metric.vcs.change.count"; +static constexpr const char *descrMetricVcsChangeCount = + "The number of changes (pull requests/merge requests/changelists) in a repository, categorized " + "by their state (e.g. open or merged)"; +static constexpr const char *unitMetricVcsChangeCount = "{change}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricVcsChangeCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount, + unitMetricVcsChangeCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricVcsChangeCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount, + unitMetricVcsChangeCount); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricVcsChangeCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount, + unitMetricVcsChangeCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsChangeCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricVcsChangeCount, descrMetricVcsChangeCount, unitMetricVcsChangeCount); +} + +/** + * The time duration a change (pull request/merge request/changelist) has been in a given state. + *

+ * gauge + */ +static constexpr const char *kMetricVcsChangeDuration = "metric.vcs.change.duration"; +static constexpr const char *descrMetricVcsChangeDuration = + "The time duration a change (pull request/merge request/changelist) has been in a given state."; +static constexpr const char *unitMetricVcsChangeDuration = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsChangeDuration( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsChangeDuration( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsChangeDuration(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsChangeDuration(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration, + unitMetricVcsChangeDuration); +} + +/** + * The amount of time since its creation it took a change (pull request/merge request/changelist) to + * get the first approval

gauge + */ +static constexpr const char *kMetricVcsChangeTimeToApproval = "metric.vcs.change.time_to_approval"; +static constexpr const char *descrMetricVcsChangeTimeToApproval = + "The amount of time since its creation it took a change (pull request/merge " + "request/changelist) to get the first approval"; +static constexpr const char *unitMetricVcsChangeTimeToApproval = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsChangeTimeToApproval, descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsChangeTimeToApproval, + descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsChangeTimeToApproval, + descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsChangeTimeToApproval(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsChangeTimeToApproval, + descrMetricVcsChangeTimeToApproval, + unitMetricVcsChangeTimeToApproval); +} + +/** + * The number of unique contributors to a repository + *

+ * gauge + */ +static constexpr const char *kMetricVcsContributorCount = "metric.vcs.contributor.count"; +static constexpr const char *descrMetricVcsContributorCount = + "The number of unique contributors to a repository"; +static constexpr const char *unitMetricVcsContributorCount = "{contributor}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsContributorCount( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsContributorCount, descrMetricVcsContributorCount, + unitMetricVcsContributorCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsContributorCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsContributorCount, descrMetricVcsContributorCount, + unitMetricVcsContributorCount); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsContributorCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge( + kMetricVcsContributorCount, descrMetricVcsContributorCount, unitMetricVcsContributorCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsContributorCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + kMetricVcsContributorCount, descrMetricVcsContributorCount, unitMetricVcsContributorCount); +} + +/** + * The number of refs of type branch or tag in a repository + *

+ * updowncounter + */ +static constexpr const char *kMetricVcsRefCount = "metric.vcs.ref.count"; +static constexpr const char *descrMetricVcsRefCount = + "The number of refs of type branch or tag in a repository"; +static constexpr const char *unitMetricVcsRefCount = "{ref}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricVcsRefCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount, + unitMetricVcsRefCount); +} + +/** + * The number of lines added/removed in a ref (branch) relative to the ref from the @code + * vcs.ref.base.name @endcode attribute

This metric should be reported for each @code + * vcs.line_change.type @endcode value. For example if a ref added 3 lines and removed 2 lines, + * instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers). + * If number of lines added/removed should be calculated from the start of time, then @code + * vcs.ref.base.name @endcode SHOULD be set to an empty string.

gauge + */ +static constexpr const char *kMetricVcsRefLinesDelta = "metric.vcs.ref.lines_delta"; +static constexpr const char *descrMetricVcsRefLinesDelta = + "The number of lines added/removed in a ref (branch) relative to the ref from the " + "`vcs.ref.base.name` attribute"; +static constexpr const char *unitMetricVcsRefLinesDelta = "{line}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefLinesDelta( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefLinesDelta( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsRefLinesDelta(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsRefLinesDelta(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta, + unitMetricVcsRefLinesDelta); +} + +/** + * The number of revisions (commits) a ref (branch) is ahead/behind the branch from the @code + * vcs.ref.base.name @endcode attribute

This metric should be reported for each @code + * vcs.revision_delta.direction @endcode value. For example if branch @code a @endcode is 3 commits + * behind and 2 commits ahead of @code trunk @endcode, instrumentation SHOULD report two + * measurements: 3 and 2 (both positive numbers) and @code vcs.ref.base.name @endcode is set to + * @code trunk @endcode.

gauge + */ +static constexpr const char *kMetricVcsRefRevisionsDelta = "metric.vcs.ref.revisions_delta"; +static constexpr const char *descrMetricVcsRefRevisionsDelta = + "The number of revisions (commits) a ref (branch) is ahead/behind the branch from the " + "`vcs.ref.base.name` attribute"; +static constexpr const char *unitMetricVcsRefRevisionsDelta = "{revision}"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefRevisionsDelta( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, + unitMetricVcsRefRevisionsDelta); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefRevisionsDelta( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, + unitMetricVcsRefRevisionsDelta); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsRefRevisionsDelta(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge( + kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, unitMetricVcsRefRevisionsDelta); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsRefRevisionsDelta(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, unitMetricVcsRefRevisionsDelta); +} + +/** + * Time a ref (branch) created from the default branch (trunk) has existed. The @code ref.type + * @endcode attribute will always be @code branch @endcode

gauge + */ +static constexpr const char *kMetricVcsRefTime = "metric.vcs.ref.time"; +static constexpr const char *descrMetricVcsRefTime = + "Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` " + "attribute will always be `branch`"; +static constexpr const char *unitMetricVcsRefTime = "s"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> CreateSyncInt64MetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricVcsRefTime, descrMetricVcsRefTime, unitMetricVcsRefTime); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricVcsRefTime, descrMetricVcsRefTime, unitMetricVcsRefTime); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr CreateAsyncInt64MetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricVcsRefTime, descrMetricVcsRefTime, + unitMetricVcsRefTime); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricVcsRefTime( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricVcsRefTime, descrMetricVcsRefTime, + unitMetricVcsRefTime); +} + +/** + * The number of repositories in an organization + *

+ * updowncounter + */ +static constexpr const char *kMetricVcsRepositoryCount = "metric.vcs.repository.count"; +static constexpr const char *descrMetricVcsRepositoryCount = + "The number of repositories in an organization"; +static constexpr const char *unitMetricVcsRepositoryCount = "{repository}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, + unitMetricVcsRepositoryCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, + unitMetricVcsRepositoryCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, unitMetricVcsRepositoryCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricVcsRepositoryCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, unitMetricVcsRepositoryCount); +} + +} // namespace vcs +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/network_attributes.h b/api/include/opentelemetry/semconv/network_attributes.h index 7e965e6a6e..832a343a66 100644 --- a/api/include/opentelemetry/semconv/network_attributes.h +++ b/api/include/opentelemetry/semconv/network_attributes.h @@ -19,6 +19,11 @@ namespace semconv namespace network { +/** + * The network interface name. + */ +static constexpr const char *kNetworkInterfaceName = "network.interface.name"; + /** * Local address of the network connection - IP address or Unix domain socket name. */ @@ -40,7 +45,7 @@ static constexpr const char *kNetworkPeerAddress = "network.peer.address"; static constexpr const char *kNetworkPeerPort = "network.peer.port"; /** - * OSI application layer or non-OSI + * OSI application layer or non-OSI * equivalent.

The value SHOULD be normalized to lowercase. */ static constexpr const char *kNetworkProtocolName = "network.protocol.name"; @@ -56,7 +61,7 @@ static constexpr const char *kNetworkProtocolName = "network.protocol.name"; static constexpr const char *kNetworkProtocolVersion = "network.protocol.version"; /** - * OSI transport layer or OSI transport layer or inter-process communication * method.

The value SHOULD be normalized to lowercase.

Consider always setting the * transport when setting a port number, since a port number is ambiguous without knowing the @@ -66,7 +71,7 @@ static constexpr const char *kNetworkProtocolVersion = "network.protocol.version static constexpr const char *kNetworkTransport = "network.transport"; /** - * OSI network layer or non-OSI equivalent. + * OSI network layer or non-OSI equivalent. *

* The value SHOULD be normalized to lowercase. */ diff --git a/api/include/opentelemetry/semconv/schema_url.h b/api/include/opentelemetry/semconv/schema_url.h index a25e28b5ea..ca35597ba4 100644 --- a/api/include/opentelemetry/semconv/schema_url.h +++ b/api/include/opentelemetry/semconv/schema_url.h @@ -19,6 +19,6 @@ namespace semconv /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.28.0"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.29.0"; } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/url_attributes.h b/api/include/opentelemetry/semconv/url_attributes.h index 25ed5b03ab..9a9c2bb671 100644 --- a/api/include/opentelemetry/semconv/url_attributes.h +++ b/api/include/opentelemetry/semconv/url_attributes.h @@ -28,14 +28,33 @@ static constexpr const char *kUrlFragment = "url.fragment"; * Absolute URL describing a network resource according to RFC3986

For network calls, URL usually has * @code scheme://host[:port][path][?query][#fragment] @endcode format, where the fragment is not - * transmitted over HTTP, but if it is known, it SHOULD be included nevertheless. + * transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.

* @code url.full @endcode MUST NOT contain credentials passed via URL in form of @code * https://username:password@www.example.com/ @endcode. In such case username and password SHOULD be * redacted and attribute's value SHOULD be @code https://REDACTED:REDACTED@www.example.com/ - * @endcode. + * @endcode.

* @code url.full @endcode SHOULD capture the absolute URL when it is available (or can be - * reconstructed). Sensitive content provided in @code url.full @endcode SHOULD be scrubbed when - * instrumentations can identify it. + * reconstructed).

Sensitive content provided in @code url.full @endcode SHOULD be scrubbed when + * instrumentations can identify it.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode: + *

+ *

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code https://www.example.com/path?color=blue&sig=REDACTED @endcode. */ static constexpr const char *kUrlFull = "url.full"; @@ -51,7 +70,23 @@ static constexpr const char *kUrlPath = "url.path"; * The URI query component *

* Sensitive content provided in @code url.query @endcode SHOULD be scrubbed when instrumentations - * can identify it. + * can identify it.

+ * + * Query string values for the following keys SHOULD be redacted by default and replaced by the + * value @code REDACTED @endcode:

+ * This list is subject to change over time. + *

+ * When a query string value is redacted, the query string key SHOULD still be preserved, e.g. + * @code q=OpenTelemetry&sig=REDACTED @endcode. */ static constexpr const char *kUrlQuery = "url.query"; diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index b6fecb4459..ac9023d188 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -16,7 +16,7 @@ ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec & generator tools versions to make the generation reproducible # repository: https://github.com/open-telemetry/semantic-conventions -SEMCONV_VERSION=1.28.0 +SEMCONV_VERSION=1.29.0 # repository: https://github.com/open-telemetry/weaver WEAVER_VERSION=0.10.0