Skip to content

Commit

Permalink
[SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.29.0 (#3182)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Dec 2, 2024
1 parent ac4bba7 commit 150256c
Show file tree
Hide file tree
Showing 23 changed files with 1,680 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a
* href="https://en.wikipedia.org/wiki/Pipeline_(computing)">computing process</a> in a pipeline.
* Other terms for tasks include commands, steps, and procedures.
* href="https://wikipedia.org/wiki/Pipeline_(computing)">computing process</a> in a pipeline. Other
* terms for tasks include commands, steps, and procedures.
*/
static constexpr const char *kCicdPipelineTaskName = "cicd.pipeline.task.name";

Expand All @@ -42,8 +42,8 @@ static constexpr const char *kCicdPipelineTaskName = "cicd.pipeline.task.name";
static constexpr const char *kCicdPipelineTaskRunId = "cicd.pipeline.task.run.id";

/**
* The <a href="https://en.wikipedia.org/wiki/URL">URL</a> of the pipeline run providing the
* complete address in order to locate and identify the pipeline run.
* The <a href="https://wikipedia.org/wiki/URL">URL</a> 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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* CloudFoundry defines the @code instance_id @endcode in the <a
* href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggegator v2 envelope</a>. 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. <p> 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</a>.
* 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.
* <p>
* Application instrumentation should use the value from environment
* variable @code CF_INSTANCE_INDEX @endcode.
*/
static constexpr const char *kCloudfoundryAppInstanceId = "cloudfoundry.app.instance.id";

Expand Down
42 changes: 42 additions & 0 deletions api/include/opentelemetry/semconv/incubating/container_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,48 @@ CreateAsyncDoubleMetricContainerNetworkIo(metrics::Meter *meter)
kMetricContainerNetworkIo, descrMetricContainerNetworkIo, unitMetricContainerNetworkIo);
}

/**
* The time the container has been running
* <p>
* 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. <p> 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<metrics::Gauge<int64_t>> CreateSyncInt64MetricContainerUptime(
metrics::Meter *meter)
{
return meter->CreateInt64Gauge(kMetricContainerUptime, descrMetricContainerUptime,
unitMetricContainerUptime);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricContainerUptime(
metrics::Meter *meter)
{
return meter->CreateDoubleGauge(kMetricContainerUptime, descrMetricContainerUptime,
unitMetricContainerUptime);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricContainerUptime(metrics::Meter *meter)
{
return meter->CreateInt64ObservableGauge(kMetricContainerUptime, descrMetricContainerUptime,
unitMetricContainerUptime);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricContainerUptime(metrics::Meter *meter)
{
return meter->CreateDoubleObservableGauge(kMetricContainerUptime, descrMetricContainerUptime,
unitMetricContainerUptime);
}

} // namespace container
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
122 changes: 102 additions & 20 deletions api/include/opentelemetry/semconv/incubating/db_attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ static constexpr const char *kDbClientConnectionsState = "db.client.connections.
* The name of a collection (table, container) within the database.
* <p>
* 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. <p> 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.
* <p>
* For batch operations, if the individual operations are known to have the same collection name
* then that collection name SHOULD be used.
* <p>
* This attribute has stability level RELEASE CANDIDATE.
*/
static constexpr const char *kDbCollectionName = "db.collection.name";

Expand All @@ -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 <a
* href="https://learn.microsoft.com/azure/cosmos-db/consistency-levels">consistency level</a>.
*/
static constexpr const char *kDbCosmosdbConsistencyLevel = "db.cosmosdb.consistency_level";

/**
* Deprecated, use @code db.collection.name @endcode instead.
* <p>
Expand All @@ -136,17 +143,30 @@ OPENTELEMETRY_DEPRECATED
static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container";

/**
* Cosmos DB Operation Type.
* Deprecated, no replacement at this time.
* <p>
* @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. <p> Region name matches the format of @code displayName @endcode in <a
* href="https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location">Azure
* Location API</a>
*/
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";

Expand Down Expand Up @@ -270,25 +290,53 @@ static constexpr const char *kDbOperationBatchSize = "db.operation.batch.size";
/**
* The name of the operation or command being executed.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.
* <p>
* This attribute has stability level RELEASE CANDIDATE.
*/
static constexpr const char *kDbOperationName = "db.operation.name";

/**
* A database operation parameter, with @code <key> @endcode being the parameter name, and the
* attribute value being a string representation of the parameter value. <p> If a parameter has no
* name and instead is referenced only by index, then @code <key> @endcode SHOULD be the 0-based
* index. If @code db.query.text @endcode is also captured, then @code db.operation.parameter.<key>
* @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 <key> @endcode being the
* parameter name, and the attribute value being a string representation of the parameter value. <p>
* 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
* <key> @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.
* <p>
* @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 <a
* href="../../docs/database/database-spans.md#generating-a-summary-of-the-query-text">Generating
* query summary</a> section. This attribute has stability level RELEASE CANDIDATE.
*/
static constexpr const char *kDbQuerySummary = "db.query.summary";

/**
* The database query being executed.
* <p>
Expand All @@ -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.
* <p>
Expand Down Expand Up @@ -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";

Expand All @@ -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
{
/**
Expand Down
Loading

1 comment on commit 150256c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 150256c Previous: ac4bba7 Ratio
BM_ProcYieldSpinLockThrashing/2/process_time/real_time 0.6241955107926203 ms/iter 0.23663238338802173 ms/iter 2.64
BM_ProcYieldSpinLockThrashing/4/process_time/real_time 2.134737968444824 ms/iter 0.990656233325447 ms/iter 2.15
BM_NaiveSpinLockThrashing/1/process_time/real_time 0.4215977191925049 ms/iter 0.09964600660334039 ms/iter 4.23
BM_NaiveSpinLockThrashing/2/process_time/real_time 1.53975210328033 ms/iter 0.20650855633391052 ms/iter 7.46
BM_NaiveSpinLockThrashing/4/process_time/real_time 5.230300566729377 ms/iter 0.81296658886529 ms/iter 6.43

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.