Skip to content

Commit bed8e48

Browse files
authored
Merge pull request #869 from typelevel/update/opentelemetry-semconv-1.29.0-alpha
Update opentelemetry-semconv to 1.29.0-alpha
2 parents b71f939 + 76464b7 commit bed8e48

42 files changed

Lines changed: 2136 additions & 544 deletions

File tree

Some content is hidden

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

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ val MUnitScalaCheckEffectVersion = "2.0.0-M2"
8787
val OpenTelemetryVersion = "1.45.0"
8888
val OpenTelemetryInstrumentationVersion = "2.10.0"
8989
val OpenTelemetryInstrumentationAlphaVersion = "2.10.0-alpha"
90-
val OpenTelemetrySemConvVersion = "1.28.0-alpha"
90+
val OpenTelemetrySemConvVersion = "1.29.0-alpha"
9191
val OpenTelemetryProtoVersion = "1.4.0-alpha"
9292
val PekkoStreamVersion = "1.1.2"
9393
val PekkoHttpVersion = "1.1.0"

buildscripts/semantic-convention/templates/registry/otel4s/metrics/SemanticMetrics.scala.j2

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
{%- endmacro -%}
5858

5959
{%- macro stability(type) -%}
60-
{%- if type == "experimental" -%} Stability.experimental
60+
{%- if type == "development" -%} Stability.development
61+
{%- elif not type -%} Stability.development
6162
{%- elif type == "stable" -%} Stability.stable
6263
{%- else -%} _unknown_stability_type_{{ type }}
6364
{%- endif -%}
@@ -68,7 +69,11 @@
6869
{%- elif type == "double" -%} {{ input }}
6970
{%- elif type == "boolean" -%} {{ input }}
7071
{%- elif type == "string" -%} "{{ input }}"
71-
{%- else -%} _unknown type_{{ input }}
72+
{%- elif type == "int[]" -%} Seq({{ input | join(', ') }})
73+
{%- elif type == "double[]" -%} Seq({{ input | join(', ') }})
74+
{%- elif type == "boolean[]" -%} Seq({{ input | join(', ') }})
75+
{%- elif type == "string[]" -%} Seq({{ input | map('tojson') | join(', ') }})
76+
{%- else -%} _unknown type_{{ type }}_{{ input }}
7277
{%- endif -%}
7378
{% endmacro %}
7479

@@ -132,7 +137,7 @@ import org.typelevel.otel4s.metrics._
132137
{%- if required_imports.stable == true %}
133138
import org.typelevel.otel4s.semconv.attributes._
134139
{%- endif %}
135-
{%- if required_imports.experimental == true %}
140+
{%- if required_imports.experimental == true and params.experimental == true %}
136141
import org.typelevel.otel4s.semconv.experimental.attributes._
137142
{%- endif %}
138143

@@ -161,16 +166,20 @@ object {{ object_name }} {
161166
@deprecated("Use stable `{{ stableRef(metric) }}` instead.", "")
162167
{%- endif %}
163168
object {{ objectName(metric) }} extends MetricSpec {
164-
169+
{%- if params.experimental == true -%}
170+
{%- set metric_attributes = metric.attributes %}
171+
{% else %}
172+
{%- set metric_attributes = metric.attributes | selectattr("stability", "equalto", "stable") | list %}
173+
{% endif %}
165174
val name: String = "{{ metric.metric_name }}"
166175
val description: String = "{{ metric.brief }}"
167176
val unit: String = "{{ metric.unit }}"
168177
val stability: Stability = {{ stability(metric.stability) }}
169-
val attributeSpecs: List[AttributeSpec[_]] = {% if metric.attributes | length > 0 %}AttributeSpecs.specs{% else %}Nil{% endif %}
178+
val attributeSpecs: List[AttributeSpec[_]] = {% if metric_attributes | length > 0 %}AttributeSpecs.specs{% else %}Nil{% endif %}
170179

171-
{% if metric.attributes | length > 0 %}
180+
{% if metric_attributes | length > 0 %}
172181
object AttributeSpecs {
173-
{% for attribute in metric.attributes | sort(attribute='name') %}
182+
{% for attribute in metric_attributes | sort(attribute='name') %}
174183
{{ [attribute.brief, concat_if("\n\n@note\n\n", attribute.note)] | comment(indent=6) | replace('$', "$$")}}
175184
{%- if attribute is deprecated %}
176185
@deprecated("{{ attribute.deprecated }}", "")
@@ -186,7 +195,7 @@ object {{ object_name }} {
186195
)
187196
{% endfor %}
188197
val specs: List[AttributeSpec[_]] =
189-
List({%- for attribute in metric.attributes | sort(attribute='name') %}
198+
List({%- for attribute in metric_attributes | sort(attribute='name') %}
190199
{{ attribute.name | camel_case }},{% endfor %}
191200
)
192201
}

project/SemanticConventionsGenerator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.sys.process._
33

44
object SemanticConventionsGenerator {
55

6-
private val generatorVersion = "v0.9.1"
6+
private val generatorVersion = "v0.12.0"
77

88
// generates semantic conventions by using `otel/weaver` in docker
99
def generate(version: String, rootDir: File): Unit = {

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/AwsExperimentalAttributes.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ object AwsExperimentalAttributes {
235235
* @note
236236
* <p> The `copy_source` attribute applies to S3 copy operations and corresponds to the `--copy-source` parameter
237237
* of the <a href="https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html">copy-object operation
238-
* within the S3 API</a>. This applies in particular to the following operations: <p> <ul> <li><a
238+
* within the S3 API</a>. This applies in particular to the following operations: <ul> <li><a
239239
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html">copy-object</a> <li><a
240240
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html">upload-part-copy</a> </ul>
241241
*/
@@ -257,7 +257,7 @@ object AwsExperimentalAttributes {
257257
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html">S3 API</a> operations. <p>
258258
* @note
259259
* <p> The `key` attribute is applicable to all object-related S3 operations, i.e. that require the object key as a
260-
* mandatory parameter. This applies in particular to the following operations: <p> <ul> <li><a
260+
* mandatory parameter. This applies in particular to the following operations: <ul> <li><a
261261
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html">copy-object</a> <li><a
262262
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html">delete-object</a> <li><a
263263
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html">get-object</a> <li><a
@@ -295,7 +295,7 @@ object AwsExperimentalAttributes {
295295
* @note
296296
* <p> The `upload_id` attribute applies to S3 multipart-upload operations and corresponds to the `--upload-id`
297297
* parameter of the <a href="https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html">S3 API</a>
298-
* multipart operations. This applies in particular to the following operations: <p> <ul> <li><a
298+
* multipart operations. This applies in particular to the following operations: <ul> <li><a
299299
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html">abort-multipart-upload</a>
300300
* <li><a
301301
* href="https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html">complete-multipart-upload</a>

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/CicdExperimentalAttributes.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ object CicdExperimentalAttributes {
3232
AttributeKey("cicd.pipeline.run.id")
3333

3434
/** The human readable name of a task within a pipeline. Task here most closely aligns with a <a
35-
* href="https://en.wikipedia.org/wiki/Pipeline_(computing)">computing process</a> in a pipeline. Other terms for
36-
* tasks include commands, steps, and procedures.
35+
* href="https://wikipedia.org/wiki/Pipeline_(computing)">computing process</a> in a pipeline. Other terms for tasks
36+
* include commands, steps, and procedures.
3737
*/
3838
val CicdPipelineTaskName: AttributeKey[String] =
3939
AttributeKey("cicd.pipeline.task.name")
@@ -43,8 +43,8 @@ object CicdExperimentalAttributes {
4343
val CicdPipelineTaskRunId: AttributeKey[String] =
4444
AttributeKey("cicd.pipeline.task.run.id")
4545

46-
/** The <a href="https://en.wikipedia.org/wiki/URL">URL</a> of the pipeline run providing the complete address in
47-
* order to locate and identify the pipeline run.
46+
/** The <a href="https://wikipedia.org/wiki/URL">URL</a> of the pipeline run providing the complete address in order
47+
* to locate and identify the pipeline run.
4848
*/
4949
val CicdPipelineTaskRunUrlFull: AttributeKey[String] =
5050
AttributeKey("cicd.pipeline.task.run.url.full")

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/CloudExperimentalAttributes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ object CloudExperimentalAttributes {
6767
* <p> On some cloud providers, it may not be possible to determine the full ID at startup, so it may be necessary
6868
* to set `cloud.resource_id` as a span attribute instead. <p> The exact value to use for `cloud.resource_id`
6969
* depends on the cloud provider. The following well-known definitions MUST be used if you set this attribute and
70-
* they apply: <p> <ul> <li><strong>AWS Lambda:</strong> The function <a
70+
* they apply: <ul> <li><strong>AWS Lambda:</strong> The function <a
7171
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>. Take care not to use
7272
* the "invoked ARN" directly but replace any <a
7373
* href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html">alias suffix</a> with the

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/CloudfoundryExperimentalAttributes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object CloudfoundryExperimentalAttributes {
3232
/** The index of the application instance. 0 when just one instance is active. <p>
3333
* @note
3434
* <p> CloudFoundry defines the `instance_id` in the <a
35-
* href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggegator v2 envelope</a>. It is used for
35+
* href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggregator v2 envelope</a>. It is used for
3636
* logs and metrics emitted by CloudFoundry. It is supposed to contain the application instance index for
3737
* applications deployed on the runtime. <p> Application instrumentation should use the value from environment
3838
* variable `CF_INSTANCE_INDEX`.

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/DbExperimentalAttributes.scala

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ object DbExperimentalAttributes {
8888
/** The name of a collection (table, container) within the database. <p>
8989
* @note
9090
* <p> It is RECOMMENDED to capture the value as provided by the application without attempting to do any case
91-
* normalization. If the collection name is parsed from the query text, it SHOULD be the first collection name
92-
* found in the query and it SHOULD match the value provided in the query text including any schema and database
93-
* name prefix. For batch operations, if the individual operations are known to have the same collection name then
94-
* that collection name SHOULD be used, otherwise `db.collection.name` SHOULD NOT be captured. This attribute has
91+
* normalization. <p> The collection name SHOULD NOT be extracted from `db.query.text`, unless the query format is
92+
* known to only ever have a single collection name present. <p> For batch operations, if the individual operations
93+
* are known to have the same collection name then that collection name SHOULD be used. <p> This attribute has
9594
* stability level RELEASE CANDIDATE.
9695
*/
9796
val DbCollectionName: AttributeKey[String] =
@@ -113,23 +112,39 @@ object DbExperimentalAttributes {
113112
val DbCosmosdbConnectionMode: AttributeKey[String] =
114113
AttributeKey("db.cosmosdb.connection_mode")
115114

115+
/** Account or request <a href="https://learn.microsoft.com/azure/cosmos-db/consistency-levels">consistency level</a>.
116+
*/
117+
val DbCosmosdbConsistencyLevel: AttributeKey[String] =
118+
AttributeKey("db.cosmosdb.consistency_level")
119+
116120
/** Deprecated, use `db.collection.name` instead.
117121
*/
118122
@deprecated("Replaced by `db.collection.name`.", "")
119123
val DbCosmosdbContainer: AttributeKey[String] =
120124
AttributeKey("db.cosmosdb.container")
121125

122-
/** Cosmos DB Operation Type.
126+
/** Deprecated, no replacement at this time.
123127
*/
128+
@deprecated("No replacement at this time.", "")
124129
val DbCosmosdbOperationType: AttributeKey[String] =
125130
AttributeKey("db.cosmosdb.operation_type")
126131

127-
/** RU consumed for that operation
132+
/** List of regions contacted during operation in the order that they were contacted. If there is more than one region
133+
* listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. <p>
134+
* @note
135+
* <p> Region name matches the format of `displayName` in <a
136+
* href="https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location">Azure
137+
* Location API</a>
138+
*/
139+
val DbCosmosdbRegionsContacted: AttributeKey[Seq[String]] =
140+
AttributeKey("db.cosmosdb.regions_contacted")
141+
142+
/** Request units consumed for the operation.
128143
*/
129144
val DbCosmosdbRequestCharge: AttributeKey[Double] =
130145
AttributeKey("db.cosmosdb.request_charge")
131146

132-
/** Request payload size in bytes
147+
/** Request payload size in bytes.
133148
*/
134149
val DbCosmosdbRequestContentLength: AttributeKey[Long] =
135150
AttributeKey("db.cosmosdb.request_content_length")
@@ -230,25 +245,44 @@ object DbExperimentalAttributes {
230245
/** The name of the operation or command being executed. <p>
231246
* @note
232247
* <p> It is RECOMMENDED to capture the value as provided by the application without attempting to do any case
233-
* normalization. If the operation name is parsed from the query text, it SHOULD be the first operation name found
234-
* in the query. For batch operations, if the individual operations are known to have the same operation name then
235-
* that operation name SHOULD be used prepended by `BATCH `, otherwise `db.operation.name` SHOULD be `BATCH` or
236-
* some other database system specific term if more applicable. This attribute has stability level RELEASE
237-
* CANDIDATE.
248+
* normalization. <p> The operation name SHOULD NOT be extracted from `db.query.text`, unless the query format is
249+
* known to only ever have a single operation name present. <p> For batch operations, if the individual operations
250+
* are known to have the same operation name then that operation name SHOULD be used prepended by `BATCH `,
251+
* otherwise `db.operation.name` SHOULD be `BATCH` or some other database system specific term if more applicable.
252+
* <p> This attribute has stability level RELEASE CANDIDATE.
238253
*/
239254
val DbOperationName: AttributeKey[String] =
240255
AttributeKey("db.operation.name")
241256

242-
/** A query parameter used in `db.query.text`, with `<key>` being the parameter name, and the attribute value being a
243-
* string representation of the parameter value. <p>
257+
/** A database operation parameter, with `<key>` being the parameter name, and the attribute value being a string
258+
* representation of the parameter value. <p>
244259
* @note
245-
* <p> Query parameters should only be captured when `db.query.text` is parameterized with placeholders. If a
246-
* parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based index. This
247-
* attribute has stability level RELEASE CANDIDATE.
260+
* <p> If a parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based
261+
* index. If `db.query.text` is also captured, then `db.operation.parameter.<key>` SHOULD match up with the
262+
* parameterized placeholders present in `db.query.text`. This attribute has stability level RELEASE CANDIDATE.
263+
*/
264+
val DbOperationParameter: AttributeKey[String] =
265+
AttributeKey("db.operation.parameter")
266+
267+
/** A query parameter used in `db.query.text`, with `<key>` being the parameter name, and the attribute value being a
268+
* string representation of the parameter value.
248269
*/
270+
@deprecated("Replaced by `db.operation.parameter`.", "")
249271
val DbQueryParameter: AttributeKey[String] =
250272
AttributeKey("db.query.parameter")
251273

274+
/** Low cardinality representation of a database query text. <p>
275+
* @note
276+
* <p> `db.query.summary` provides static summary of the query text. It describes a class of database queries and
277+
* is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries.
278+
* Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not
279+
* available, instrumentations that support query parsing SHOULD generate a summary following <a
280+
* href="../../docs/database/database-spans.md#generating-a-summary-of-the-query-text">Generating query summary</a>
281+
* section. This attribute has stability level RELEASE CANDIDATE.
282+
*/
283+
val DbQuerySummary: AttributeKey[String] =
284+
AttributeKey("db.query.summary")
285+
252286
/** The database query being executed. <p>
253287
* @note
254288
* <p> For sanitization see <a
@@ -269,6 +303,11 @@ object DbExperimentalAttributes {
269303
val DbRedisDatabaseIndex: AttributeKey[Long] =
270304
AttributeKey("db.redis.database_index")
271305

306+
/** Number of rows returned by the operation.
307+
*/
308+
val DbResponseReturnedRows: AttributeKey[Long] =
309+
AttributeKey("db.response.returned_rows")
310+
272311
/** Database response status code. <p>
273312
* @note
274313
* <p> The status code returned by the database. Usually it represents an error code, but may also represent
@@ -391,7 +430,7 @@ object DbExperimentalAttributes {
391430
abstract class DbCosmosdbConnectionModeValue(val value: String)
392431
object DbCosmosdbConnectionModeValue {
393432

394-
/** Gateway (HTTP) connections mode
433+
/** Gateway (HTTP) connection.
395434
*/
396435
case object Gateway extends DbCosmosdbConnectionModeValue("gateway")
397436

@@ -400,9 +439,37 @@ object DbExperimentalAttributes {
400439
case object Direct extends DbCosmosdbConnectionModeValue("direct")
401440
}
402441

442+
/** Values for [[DbCosmosdbConsistencyLevel]].
443+
*/
444+
abstract class DbCosmosdbConsistencyLevelValue(val value: String)
445+
object DbCosmosdbConsistencyLevelValue {
446+
447+
/** strong.
448+
*/
449+
case object Strong extends DbCosmosdbConsistencyLevelValue("Strong")
450+
451+
/** bounded_staleness.
452+
*/
453+
case object BoundedStaleness extends DbCosmosdbConsistencyLevelValue("BoundedStaleness")
454+
455+
/** session.
456+
*/
457+
case object Session extends DbCosmosdbConsistencyLevelValue("Session")
458+
459+
/** eventual.
460+
*/
461+
case object Eventual extends DbCosmosdbConsistencyLevelValue("Eventual")
462+
463+
/** consistent_prefix.
464+
*/
465+
case object ConsistentPrefix extends DbCosmosdbConsistencyLevelValue("ConsistentPrefix")
466+
}
467+
403468
/** Values for [[DbCosmosdbOperationType]].
404469
*/
470+
@deprecated("No replacement at this time.", "")
405471
abstract class DbCosmosdbOperationTypeValue(val value: String)
472+
@annotation.nowarn("cat=deprecation")
406473
object DbCosmosdbOperationTypeValue {
407474

408475
/** batch.

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/DeploymentExperimentalAttributes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object DeploymentExperimentalAttributes {
3232
* @note
3333
* <p> `deployment.environment.name` does not affect the uniqueness constraints defined through the
3434
* `service.namespace`, `service.name` and `service.instance.id` resource attributes. This implies that resources
35-
* carrying the following attribute combinations MUST be considered to be identifying the same service: <p> <ul>
35+
* carrying the following attribute combinations MUST be considered to be identifying the same service: <ul>
3636
* <li>`service.name=frontend`, `deployment.environment.name=production` <li>`service.name=frontend`,
3737
* `deployment.environment.name=staging`. </ul>
3838
*/

semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/ErrorExperimentalAttributes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object ErrorExperimentalAttributes {
3030
* instrumentation libraries and applications should be prepared for `error.type` to have high cardinality at query
3131
* time when no additional filters are applied. <p> If the operation has completed successfully, instrumentations
3232
* SHOULD NOT set `error.type`. <p> If a specific domain defines its own set of error identifiers (such as HTTP or
33-
* gRPC status codes), it's RECOMMENDED to: <p> <ul> <li>Use a domain-specific attribute <li>Set `error.type` to
33+
* gRPC status codes), it's RECOMMENDED to: <ul> <li>Use a domain-specific attribute <li>Set `error.type` to
3434
* capture all errors, regardless of whether they are defined within the domain-specific set or not. </ul>
3535
*/
3636
@deprecated(

0 commit comments

Comments
 (0)