From 3192be4d2f8bde5eb6eebb40dd4f69622b337e67 Mon Sep 17 00:00:00 2001 From: Nev <54870357+MSNev@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:52:26 -0700 Subject: [PATCH] feat: Add support for event body fields (#297) * feat: Add support for event body fields * feat: Add event body spec to schema files * - address review comments * Update body definition to include - type - brief - note - stability - examples * Refactor Body to AnyValue * Remove allow_custom_values, deprecated and type_display * remove resolved and resolver `any_value.rs` just use AnyValueSpec in resolved schema - simplify validate_any_value_examples - Reduce the test yaml events to smaller set - Removed observed file * remove UnresolvedBody error and update ChangeLog.md --- .gitignore | 3 + CHANGELOG.md | 1 + Cargo.lock | 1 + crates/weaver_forge/data/exception.yaml | 54 ++ crates/weaver_forge/data/mobile-events.yaml | 63 +- crates/weaver_forge/data/trace-exception.yaml | 16 + .../semconv_jq_fn/semconv_attributes.json | 2 +- .../semconv_jq_fn/semconv_events.json | 1 + .../semconv_grouped_attributes.json | 2 +- ...ouped_attributes_without_experimental.json | 2 +- .../test/attribute_group/exception.md | 79 ++ .../expected_output/test/attribute_groups.md | 83 ++ .../expected_output/test/event/device_app.md | 16 + .../expected_output/test/event/lifecycle.md | 57 -- .../expected_output/test/event/other.md | 92 +++ .../expected_output/test/events.md | 96 ++- .../expected_output/test/registry.md | 5 +- .../whitespace_control/registry.md | 5 +- crates/weaver_forge/src/registry.rs | 8 + .../semconv_jq_fn/semconv_events.json | 1 + .../templates/semconv_jq_fn/weaver.yaml | 9 + crates/weaver_forge/templates/test/event.md | 6 +- crates/weaver_forge/templates/test/events.md | 4 +- .../weaver_forge/templates/test/weaver.yaml | 22 +- crates/weaver_resolved_schema/src/error.rs | 5 +- crates/weaver_resolved_schema/src/lib.rs | 2 +- crates/weaver_resolved_schema/src/registry.rs | 5 + crates/weaver_resolved_schema/src/signal.rs | 31 +- .../expected-attribute-catalog.json | 269 +++++-- .../expected-events.json | 214 +++++ .../expected-registry.json | 466 ++++++++++- .../registry/log-events.yaml | 248 ++++++ .../registry/log-feature_flag.yaml | 11 - .../registry/mobile-events.yaml | 72 -- .../registry/referenced-attributes.yaml | 82 ++ ...ce-feature-flag.yaml => trace-events.yaml} | 42 +- crates/weaver_resolver/src/attribute.rs | 11 +- crates/weaver_resolver/src/registry.rs | 1 + crates/weaver_semconv/Cargo.toml | 3 + crates/weaver_semconv/data/event.yaml | 179 +++++ .../data/expected/any_value.json | 1 + .../data/expected/any_value.yaml | 101 +++ crates/weaver_semconv/src/any_value.rs | 734 ++++++++++++++++++ crates/weaver_semconv/src/attribute.rs | 68 ++ crates/weaver_semconv/src/group.rs | 272 ++++++- crates/weaver_semconv/src/lib.rs | 16 + crates/weaver_semconv/src/registry.rs | 2 + schemas/semconv-syntax.md | 127 ++- schemas/semconv.schema.json | 230 +++++- 49 files changed, 3460 insertions(+), 360 deletions(-) create mode 100644 crates/weaver_forge/data/exception.yaml create mode 100644 crates/weaver_forge/data/trace-exception.yaml create mode 100644 crates/weaver_forge/expected_output/semconv_jq_fn/semconv_events.json create mode 100644 crates/weaver_forge/expected_output/test/attribute_group/exception.md create mode 100644 crates/weaver_forge/expected_output/test/event/device_app.md delete mode 100644 crates/weaver_forge/expected_output/test/event/lifecycle.md create mode 100644 crates/weaver_forge/expected_output/test/event/other.md create mode 100644 crates/weaver_forge/templates/semconv_jq_fn/semconv_events.json create mode 100644 crates/weaver_resolver/data/registry-test-4-events/expected-events.json create mode 100644 crates/weaver_resolver/data/registry-test-4-events/registry/log-events.yaml delete mode 100644 crates/weaver_resolver/data/registry-test-4-events/registry/log-feature_flag.yaml delete mode 100644 crates/weaver_resolver/data/registry-test-4-events/registry/mobile-events.yaml create mode 100644 crates/weaver_resolver/data/registry-test-4-events/registry/referenced-attributes.yaml rename crates/weaver_resolver/data/registry-test-4-events/registry/{trace-feature-flag.yaml => trace-events.yaml} (51%) create mode 100644 crates/weaver_semconv/data/event.yaml create mode 100644 crates/weaver_semconv/data/expected/any_value.json create mode 100644 crates/weaver_semconv/data/expected/any_value.yaml create mode 100644 crates/weaver_semconv/src/any_value.rs diff --git a/.gitignore b/.gitignore index 18f2c1c9..a5dffafe 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,9 @@ just.zsh .vscode/ .devcontainer/ +# Visual Studio +.vs/ + # Emacs *~ \#*\# diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c7af8d3..6edd1e38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ What's changed * Add `enforce_trailing_dots` into the `comment_formats` configuration. ([#XXX](...) by lquerel). * Add support for `indent_type` in both the comment filter and the `comment_formats` configuration. ([#XXX](...) by lquerel). * Add `regex_replace` filter to support replacing text using regex. ([#XXX](...) by lquerel). +* Add support log based `event` definitions with a `body` of new `AnyValue` type. ([#XXX](...) by MSNev). ## [0.9.2] - 2024-09-09 diff --git a/Cargo.lock b/Cargo.lock index 647da046..6c671a52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4335,6 +4335,7 @@ dependencies = [ "ordered-float", "schemars", "serde", + "serde_json", "serde_yaml", "thiserror", "ureq", diff --git a/crates/weaver_forge/data/exception.yaml b/crates/weaver_forge/data/exception.yaml new file mode 100644 index 00000000..70dea3d5 --- /dev/null +++ b/crates/weaver_forge/data/exception.yaml @@ -0,0 +1,54 @@ +groups: + - id: registry.exception + type: attribute_group + prefix: exception + brief: > + This document defines the shared attributes used to + report a single exception associated with a span or log. + attributes: + - id: type + type: string + stability: stable + brief: > + The type of the exception (its fully-qualified class name, if applicable). + The dynamic type of the exception should be preferred over the static type + in languages that support it. + examples: ["java.net.ConnectException", "OSError"] + - id: message + type: string + stability: stable + brief: The exception message. + examples: ["Division by zero", "Can't convert 'int' object to str implicitly"] + - id: stacktrace + type: string + stability: stable + brief: > + A stacktrace as a string in the natural representation for the language runtime. + The representation is to be determined and documented by each language SIG. + examples: 'Exception in thread "main" java.lang.RuntimeException: Test exception\n + at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n + at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n + at com.example.GenerateTrace.main(GenerateTrace.java:5)' + - id: escaped + type: boolean + stability: stable + brief: > + SHOULD be set to true if the exception event is recorded at a point where + it is known that the exception is escaping the scope of the span. + note: |- + An exception is considered to have escaped (or left) the scope of a span, + if that span is ended while the exception is still logically "in flight". + This may be actually "in flight" in some languages (e.g. if the exception + is passed to a Context manager's `__exit__` method in Python) but will + usually be caught at the point of recording the exception in most languages. + + It is usually not possible to determine at the point where an exception is thrown + whether it will escape the scope of a span. + However, it is trivial to know that an exception + will escape, if one checks for an active exception just before ending the span, + as done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). + + It follows that an exception may still escape the scope of the span + even if the `exception.escaped` attribute was not set or set to false, + since the event might have been recorded at a time where it was not + clear whether the exception will escape. diff --git a/crates/weaver_forge/data/mobile-events.yaml b/crates/weaver_forge/data/mobile-events.yaml index 9f0af378..503b045d 100644 --- a/crates/weaver_forge/data/mobile-events.yaml +++ b/crates/weaver_forge/data/mobile-events.yaml @@ -1,21 +1,29 @@ groups: - - id: ios.lifecycle.events + - id: device.app.lifecycle + stability: experimental type: event - prefix: ios name: device.app.lifecycle brief: > - This event represents an occurrence of a lifecycle transition on the iOS platform. - attributes: - - id: state - stability: experimental - requirement_level: "required" - note: > - The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), - and from which the `OS terminology` column values are derived. - brief: > - This attribute represents the state the application has transitioned into at the occurrence of the event. - type: - allow_custom_values: false + This event represents an occurrence of a lifecycle transition on Android or iOS platform. + note: > + This event identifies the fields that are common to all lifecycle events for android and iOS using + the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are + mutually exclusive. + body: + type: map + id: device.app.lifecycle.fields + requirement_level: required + fields: + - id: ios.state + stability: experimental + requirement_level: + conditionally_required: if and only if `os.name` is `ios` + note: > + The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + and from which the `OS terminology` column values are derived. + brief: > + This attribute represents the state the application has transitioned into at the occurrence of the event. + type: enum members: - id: active value: 'active' @@ -39,23 +47,16 @@ groups: value: 'terminate' brief: > The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`. - - id: android.lifecycle.events - type: event - prefix: android - name: device.app.lifecycle - brief: > - This event represents an occurrence of a lifecycle transition on the Android platform. - attributes: - - id: state - stability: experimental - requirement_level: required - brief: > - This attribute represents the state the application has transitioned into at the occurrence of the event. - note: > - The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), - and from which the `OS identifiers` are derived. - type: - allow_custom_values: false + - id: android.state + stability: experimental + requirement_level: + conditionally_required: if and only if `os.name` is `android` + brief: > + This attribute represents the state the application has transitioned into at the occurrence of the event. + note: > + The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + and from which the `OS identifiers` are derived. + type: enum members: - id: created value: 'created' diff --git a/crates/weaver_forge/data/trace-exception.yaml b/crates/weaver_forge/data/trace-exception.yaml new file mode 100644 index 00000000..32c53f4b --- /dev/null +++ b/crates/weaver_forge/data/trace-exception.yaml @@ -0,0 +1,16 @@ +groups: + - id: trace-exception + prefix: exception + type: event + brief: > + This document defines the attributes used to + report a single exception associated with a span. + attributes: + - ref: exception.type + requirement_level: + conditionally_required: Required if `exception.message` is not set, recommended otherwise. + - ref: exception.message + requirement_level: + conditionally_required: Required if `exception.type` is not set, recommended otherwise. + - ref: exception.stacktrace + - ref: exception.escaped diff --git a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_attributes.json b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_attributes.json index f3b7465b..d398e239 100644 --- a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_attributes.json +++ b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_attributes.json @@ -1 +1 @@ -[{"brief":"The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n","name":"db.cassandra.consistency_level","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"all","note":null,"stability":null,"value":"all"},{"brief":null,"deprecated":null,"id":"each_quorum","note":null,"stability":null,"value":"each_quorum"},{"brief":null,"deprecated":null,"id":"quorum","note":null,"stability":null,"value":"quorum"},{"brief":null,"deprecated":null,"id":"local_quorum","note":null,"stability":null,"value":"local_quorum"},{"brief":null,"deprecated":null,"id":"one","note":null,"stability":null,"value":"one"},{"brief":null,"deprecated":null,"id":"two","note":null,"stability":null,"value":"two"},{"brief":null,"deprecated":null,"id":"three","note":null,"stability":null,"value":"three"},{"brief":null,"deprecated":null,"id":"local_one","note":null,"stability":null,"value":"local_one"},{"brief":null,"deprecated":null,"id":"any","note":null,"stability":null,"value":"any"},{"brief":null,"deprecated":null,"id":"serial","note":null,"stability":null,"value":"serial"},{"brief":null,"deprecated":null,"id":"local_serial","note":null,"stability":null,"value":"local_serial"}]}},{"brief":"The data center of the coordinating node for a query.\n","examples":"us-west-2","name":"db.cassandra.coordinator.dc","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The ID of the coordinating node for a query.\n","examples":"be13faa2-8574-4d71-926d-27f16cf8a7af","name":"db.cassandra.coordinator.id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"Whether or not the query is idempotent.\n","name":"db.cassandra.idempotence","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"boolean"},{"brief":"The fetch size used for paging, i.e. how many rows will be returned at once.\n","examples":[5000],"name":"db.cassandra.page_size","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n","examples":[0,2],"name":"db.cassandra.speculative_execution_count","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).","examples":"mytable","name":"db.cassandra.table","note":"This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The connection string used to connect to the database. It is recommended to remove embedded credentials.\n","examples":"Server=(localdb)\\v11.0;Integrated Security=true;","name":"db.connection_string","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"Unique Cosmos client instance id.","examples":"3ba4827d-4422-483f-b59f-85b74211c11d","name":"db.cosmosdb.client_id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"Cosmos client connection mode.","name":"db.cosmosdb.connection_mode","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":false,"members":[{"brief":"Gateway (HTTP) connections mode","deprecated":null,"id":"gateway","note":null,"stability":null,"value":"gateway"},{"brief":"Direct connection.","deprecated":null,"id":"direct","note":null,"stability":null,"value":"direct"}]}},{"brief":"Cosmos DB container name.","examples":"anystring","name":"db.cosmosdb.container","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"CosmosDB Operation Type.","name":"db.cosmosdb.operation_type","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"invalid","note":null,"stability":null,"value":"Invalid"},{"brief":null,"deprecated":null,"id":"create","note":null,"stability":null,"value":"Create"},{"brief":null,"deprecated":null,"id":"patch","note":null,"stability":null,"value":"Patch"},{"brief":null,"deprecated":null,"id":"read","note":null,"stability":null,"value":"Read"},{"brief":null,"deprecated":null,"id":"read_feed","note":null,"stability":null,"value":"ReadFeed"},{"brief":null,"deprecated":null,"id":"delete","note":null,"stability":null,"value":"Delete"},{"brief":null,"deprecated":null,"id":"replace","note":null,"stability":null,"value":"Replace"},{"brief":null,"deprecated":null,"id":"execute","note":null,"stability":null,"value":"Execute"},{"brief":null,"deprecated":null,"id":"query","note":null,"stability":null,"value":"Query"},{"brief":null,"deprecated":null,"id":"head","note":null,"stability":null,"value":"Head"},{"brief":null,"deprecated":null,"id":"head_feed","note":null,"stability":null,"value":"HeadFeed"},{"brief":null,"deprecated":null,"id":"upsert","note":null,"stability":null,"value":"Upsert"},{"brief":null,"deprecated":null,"id":"batch","note":null,"stability":null,"value":"Batch"},{"brief":null,"deprecated":null,"id":"query_plan","note":null,"stability":null,"value":"QueryPlan"},{"brief":null,"deprecated":null,"id":"execute_javascript","note":null,"stability":null,"value":"ExecuteJavaScript"}]}},{"brief":"RU consumed for that operation","examples":[46.18,1.0],"name":"db.cosmosdb.request_charge","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"double"},{"brief":"Request payload size in bytes","name":"db.cosmosdb.request_content_length","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB status code.","examples":[200,201],"name":"db.cosmosdb.status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB sub status code.","examples":[1000,1002],"name":"db.cosmosdb.sub_status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Represents the identifier of an Elasticsearch cluster.\n","examples":["e9106fc68e3044f0b1475b04bf4ffd5f"],"name":"db.elasticsearch.cluster.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"Represents the human-readable identifier of the node/instance to which a request was routed.\n","examples":["instance-0000000001"],"name":"db.elasticsearch.node.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"A dynamic value in the url path.\n","examples":["db.elasticsearch.path_parts.index=test-index","db.elasticsearch.path_parts.doc_id=123"],"name":"db.elasticsearch.path_parts","note":"Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.\u003ckey\u003e`, where `\u003ckey\u003e` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"template[string]"},{"brief":"An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.\n","examples":"mysql-e26b99z.example.com","name":"db.instance.id","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n","examples":["org.postgresql.Driver","com.microsoft.sqlserver.jdbc.SQLServerDriver"],"name":"db.jdbc.driver_classname","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-jdbc","type":"string"},{"brief":"The MongoDB collection being accessed within the database stated in `db.name`.\n","examples":["customers","products"],"name":"db.mongodb.collection","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mongodb","type":"string"},{"brief":"The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n","examples":"MSSQLSERVER","name":"db.mssql.instance_name","note":"If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mssql","type":"string"},{"brief":"This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n","examples":["customers","main"],"name":"db.name","note":"In some SQL databases, the database name to be used is called \"schema name\". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n","examples":["findAndModify","HMSET","SELECT"],"name":"db.operation","note":"When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n","examples":[0,1,15],"name":"db.redis.database_index","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-redis","type":"int"},{"brief":"The name of the primary table that the operation is acting upon, including the database name (if applicable).","examples":["public.users","customers"],"name":"db.sql.table","note":"It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-sql","type":"string"},{"brief":"The database statement being executed.\n","examples":["SELECT * FROM wuser_table","SET mykey \"WuValue\""],"name":"db.statement","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.","name":"db.system","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":{"allow_custom_values":true,"members":[{"brief":"Some other SQL database. Fallback only. See notes.","deprecated":null,"id":"other_sql","note":null,"stability":null,"value":"other_sql"},{"brief":"Microsoft SQL Server","deprecated":null,"id":"mssql","note":null,"stability":null,"value":"mssql"},{"brief":"Microsoft SQL Server Compact","deprecated":null,"id":"mssqlcompact","note":null,"stability":null,"value":"mssqlcompact"},{"brief":"MySQL","deprecated":null,"id":"mysql","note":null,"stability":null,"value":"mysql"},{"brief":"Oracle Database","deprecated":null,"id":"oracle","note":null,"stability":null,"value":"oracle"},{"brief":"IBM Db2","deprecated":null,"id":"db2","note":null,"stability":null,"value":"db2"},{"brief":"PostgreSQL","deprecated":null,"id":"postgresql","note":null,"stability":null,"value":"postgresql"},{"brief":"Amazon Redshift","deprecated":null,"id":"redshift","note":null,"stability":null,"value":"redshift"},{"brief":"Apache Hive","deprecated":null,"id":"hive","note":null,"stability":null,"value":"hive"},{"brief":"Cloudscape","deprecated":null,"id":"cloudscape","note":null,"stability":null,"value":"cloudscape"},{"brief":"HyperSQL DataBase","deprecated":null,"id":"hsqldb","note":null,"stability":null,"value":"hsqldb"},{"brief":"Progress Database","deprecated":null,"id":"progress","note":null,"stability":null,"value":"progress"},{"brief":"SAP MaxDB","deprecated":null,"id":"maxdb","note":null,"stability":null,"value":"maxdb"},{"brief":"SAP HANA","deprecated":null,"id":"hanadb","note":null,"stability":null,"value":"hanadb"},{"brief":"Ingres","deprecated":null,"id":"ingres","note":null,"stability":null,"value":"ingres"},{"brief":"FirstSQL","deprecated":null,"id":"firstsql","note":null,"stability":null,"value":"firstsql"},{"brief":"EnterpriseDB","deprecated":null,"id":"edb","note":null,"stability":null,"value":"edb"},{"brief":"InterSystems Caché","deprecated":null,"id":"cache","note":null,"stability":null,"value":"cache"},{"brief":"Adabas (Adaptable Database System)","deprecated":null,"id":"adabas","note":null,"stability":null,"value":"adabas"},{"brief":"Firebird","deprecated":null,"id":"firebird","note":null,"stability":null,"value":"firebird"},{"brief":"Apache Derby","deprecated":null,"id":"derby","note":null,"stability":null,"value":"derby"},{"brief":"FileMaker","deprecated":null,"id":"filemaker","note":null,"stability":null,"value":"filemaker"},{"brief":"Informix","deprecated":null,"id":"informix","note":null,"stability":null,"value":"informix"},{"brief":"InstantDB","deprecated":null,"id":"instantdb","note":null,"stability":null,"value":"instantdb"},{"brief":"InterBase","deprecated":null,"id":"interbase","note":null,"stability":null,"value":"interbase"},{"brief":"MariaDB","deprecated":null,"id":"mariadb","note":null,"stability":null,"value":"mariadb"},{"brief":"Netezza","deprecated":null,"id":"netezza","note":null,"stability":null,"value":"netezza"},{"brief":"Pervasive PSQL","deprecated":null,"id":"pervasive","note":null,"stability":null,"value":"pervasive"},{"brief":"PointBase","deprecated":null,"id":"pointbase","note":null,"stability":null,"value":"pointbase"},{"brief":"SQLite","deprecated":null,"id":"sqlite","note":null,"stability":null,"value":"sqlite"},{"brief":"Sybase","deprecated":null,"id":"sybase","note":null,"stability":null,"value":"sybase"},{"brief":"Teradata","deprecated":null,"id":"teradata","note":null,"stability":null,"value":"teradata"},{"brief":"Vertica","deprecated":null,"id":"vertica","note":null,"stability":null,"value":"vertica"},{"brief":"H2","deprecated":null,"id":"h2","note":null,"stability":null,"value":"h2"},{"brief":"ColdFusion IMQ","deprecated":null,"id":"coldfusion","note":null,"stability":null,"value":"coldfusion"},{"brief":"Apache Cassandra","deprecated":null,"id":"cassandra","note":null,"stability":null,"value":"cassandra"},{"brief":"Apache HBase","deprecated":null,"id":"hbase","note":null,"stability":null,"value":"hbase"},{"brief":"MongoDB","deprecated":null,"id":"mongodb","note":null,"stability":null,"value":"mongodb"},{"brief":"Redis","deprecated":null,"id":"redis","note":null,"stability":null,"value":"redis"},{"brief":"Couchbase","deprecated":null,"id":"couchbase","note":null,"stability":null,"value":"couchbase"},{"brief":"CouchDB","deprecated":null,"id":"couchdb","note":null,"stability":null,"value":"couchdb"},{"brief":"Microsoft Azure Cosmos DB","deprecated":null,"id":"cosmosdb","note":null,"stability":null,"value":"cosmosdb"},{"brief":"Amazon DynamoDB","deprecated":null,"id":"dynamodb","note":null,"stability":null,"value":"dynamodb"},{"brief":"Neo4j","deprecated":null,"id":"neo4j","note":null,"stability":null,"value":"neo4j"},{"brief":"Apache Geode","deprecated":null,"id":"geode","note":null,"stability":null,"value":"geode"},{"brief":"Elasticsearch","deprecated":null,"id":"elasticsearch","note":null,"stability":null,"value":"elasticsearch"},{"brief":"Memcached","deprecated":null,"id":"memcached","note":null,"stability":null,"value":"memcached"},{"brief":"CockroachDB","deprecated":null,"id":"cockroachdb","note":null,"stability":null,"value":"cockroachdb"},{"brief":"OpenSearch","deprecated":null,"id":"opensearch","note":null,"stability":null,"value":"opensearch"},{"brief":"ClickHouse","deprecated":null,"id":"clickhouse","note":null,"stability":null,"value":"clickhouse"},{"brief":"Cloud Spanner","deprecated":null,"id":"spanner","note":null,"stability":null,"value":"spanner"},{"brief":"Trino","deprecated":null,"id":"trino","note":null,"stability":null,"value":"trino"}]}},{"brief":"Username for accessing the database.\n","examples":["readonly_user","reporting_user"],"name":"db.user","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.request.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP request headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.request.header.content-type=[\"application/json\"]","http.request.header.x-forwarded-for=[\"1.2.3.4\", \"1.2.3.5\"]"],"name":"http.request.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nThe `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"HTTP request method.","examples":["GET","POST","HEAD"],"name":"http.request.method","note":"HTTP request method value SHOULD be \"known\" to the instrumentation.\nBy default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)\nand the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).\n\nIf the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.\n\nIf the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override\nthe list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named\nOTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n\nHTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.\nInstrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.\nTracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"CONNECT method.","deprecated":null,"id":"connect","note":null,"stability":null,"value":"CONNECT"},{"brief":"DELETE method.","deprecated":null,"id":"delete","note":null,"stability":null,"value":"DELETE"},{"brief":"GET method.","deprecated":null,"id":"get","note":null,"stability":null,"value":"GET"},{"brief":"HEAD method.","deprecated":null,"id":"head","note":null,"stability":null,"value":"HEAD"},{"brief":"OPTIONS method.","deprecated":null,"id":"options","note":null,"stability":null,"value":"OPTIONS"},{"brief":"PATCH method.","deprecated":null,"id":"patch","note":null,"stability":null,"value":"PATCH"},{"brief":"POST method.","deprecated":null,"id":"post","note":null,"stability":null,"value":"POST"},{"brief":"PUT method.","deprecated":null,"id":"put","note":null,"stability":null,"value":"PUT"},{"brief":"TRACE method.","deprecated":null,"id":"trace","note":null,"stability":null,"value":"TRACE"},{"brief":"Any HTTP method that the instrumentation has no prior knowledge of.","deprecated":null,"id":"other","note":null,"stability":null,"value":"_OTHER"}]}},{"brief":"Original HTTP method sent by the client in the request line.","examples":["GeT","ACL","foo"],"name":"http.request.method_original","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ordinal number of request resending attempt (for any reason, including redirects).\n","examples":3,"name":"http.request.resend_count","note":"The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.response.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP response headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.response.header.content-type=[\"application/json\"]","http.response.header.my-custom-header=[\"abc\", \"def\"]"],"name":"http.response.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nUsers MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).","examples":[200],"name":"http.response.status_code","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The matched route, that is, the path template in the format used by the respective server framework.\n","examples":["/users/:userID?","{controller}/{action}/{id?}"],"name":"http.route","note":"MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\nSHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.","examples":"DE","name":"network.carrier.icc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier country code.","examples":"310","name":"network.carrier.mcc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier network code.","examples":"001","name":"network.carrier.mnc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The name of the mobile carrier.","examples":"sprint","name":"network.carrier.name","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.","examples":"LTE","name":"network.connection.subtype","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":"GPRS","deprecated":null,"id":"gprs","note":null,"stability":null,"value":"gprs"},{"brief":"EDGE","deprecated":null,"id":"edge","note":null,"stability":null,"value":"edge"},{"brief":"UMTS","deprecated":null,"id":"umts","note":null,"stability":null,"value":"umts"},{"brief":"CDMA","deprecated":null,"id":"cdma","note":null,"stability":null,"value":"cdma"},{"brief":"EVDO Rel. 0","deprecated":null,"id":"evdo_0","note":null,"stability":null,"value":"evdo_0"},{"brief":"EVDO Rev. A","deprecated":null,"id":"evdo_a","note":null,"stability":null,"value":"evdo_a"},{"brief":"CDMA2000 1XRTT","deprecated":null,"id":"cdma2000_1xrtt","note":null,"stability":null,"value":"cdma2000_1xrtt"},{"brief":"HSDPA","deprecated":null,"id":"hsdpa","note":null,"stability":null,"value":"hsdpa"},{"brief":"HSUPA","deprecated":null,"id":"hsupa","note":null,"stability":null,"value":"hsupa"},{"brief":"HSPA","deprecated":null,"id":"hspa","note":null,"stability":null,"value":"hspa"},{"brief":"IDEN","deprecated":null,"id":"iden","note":null,"stability":null,"value":"iden"},{"brief":"EVDO Rev. B","deprecated":null,"id":"evdo_b","note":null,"stability":null,"value":"evdo_b"},{"brief":"LTE","deprecated":null,"id":"lte","note":null,"stability":null,"value":"lte"},{"brief":"EHRPD","deprecated":null,"id":"ehrpd","note":null,"stability":null,"value":"ehrpd"},{"brief":"HSPAP","deprecated":null,"id":"hspap","note":null,"stability":null,"value":"hspap"},{"brief":"GSM","deprecated":null,"id":"gsm","note":null,"stability":null,"value":"gsm"},{"brief":"TD-SCDMA","deprecated":null,"id":"td_scdma","note":null,"stability":null,"value":"td_scdma"},{"brief":"IWLAN","deprecated":null,"id":"iwlan","note":null,"stability":null,"value":"iwlan"},{"brief":"5G NR (New Radio)","deprecated":null,"id":"nr","note":null,"stability":null,"value":"nr"},{"brief":"5G NRNSA (New Radio Non-Standalone)","deprecated":null,"id":"nrnsa","note":null,"stability":null,"value":"nrnsa"},{"brief":"LTE CA","deprecated":null,"id":"lte_ca","note":null,"stability":null,"value":"lte_ca"}]}},{"brief":"The internet connection type.","examples":"wifi","name":"network.connection.type","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"wifi","note":null,"stability":null,"value":"wifi"},{"brief":null,"deprecated":null,"id":"wired","note":null,"stability":null,"value":"wired"},{"brief":null,"deprecated":null,"id":"cell","note":null,"stability":null,"value":"cell"},{"brief":null,"deprecated":null,"id":"unavailable","note":null,"stability":null,"value":"unavailable"},{"brief":null,"deprecated":null,"id":"unknown","note":null,"stability":null,"value":"unknown"}]}},{"brief":"The network IO operation direction.","examples":["transmit"],"name":"network.io.direction","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":false,"members":[{"brief":null,"deprecated":null,"id":"transmit","note":null,"stability":null,"value":"transmit"},{"brief":null,"deprecated":null,"id":"receive","note":null,"stability":null,"value":"receive"}]}},{"brief":"Local address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.local.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Local port number of the network connection.","examples":[65123],"name":"network.local.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"Peer address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.peer.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Peer port number of the network connection.","examples":[65123],"name":"network.peer.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"[OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent.","examples":["amqp","http","mqtt"],"name":"network.protocol.name","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Version of the protocol specified in `network.protocol.name`.","examples":"3.1.1","name":"network.protocol.version","note":"`network.protocol.version` refers to the version of the protocol used and might be different from the protocol client\u0027s version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"[OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n","examples":["tcp","udp"],"name":"network.transport","note":"The value SHOULD be normalized to lowercase.\n\nConsider always setting the transport when setting a port number, since\na port number is ambiguous without knowing the transport. For example\ndifferent processes could be listening on TCP port 12345 and UDP port 12345.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"TCP","deprecated":null,"id":"tcp","note":null,"stability":null,"value":"tcp"},{"brief":"UDP","deprecated":null,"id":"udp","note":null,"stability":null,"value":"udp"},{"brief":"Named or anonymous pipe.","deprecated":null,"id":"pipe","note":null,"stability":null,"value":"pipe"},{"brief":"Unix domain socket","deprecated":null,"id":"unix","note":null,"stability":null,"value":"unix"}]}},{"brief":"[OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent.","examples":["ipv4","ipv6"],"name":"network.type","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"IPv4","deprecated":null,"id":"ipv4","note":null,"stability":null,"value":"ipv4"},{"brief":"IPv6","deprecated":null,"id":"ipv6","note":null,"stability":null,"value":"ipv6"}]}},{"brief":"The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component","examples":["SemConv"],"name":"url.fragment","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)","examples":["https://www.foo.bar/search?q=OpenTelemetry#SemConv","//localhost"],"name":"url.full","note":"For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.\n`url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password SHOULD be redacted and attribute\u0027s value SHOULD be `https://REDACTED:REDACTED@www.example.com/`.\n`url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes.\n","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component","examples":["/search"],"name":"url.path","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component","examples":["q=OpenTelemetry"],"name":"url.query","note":"Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it.","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.","examples":["https","ftp","telnet"],"name":"url.scheme","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n","examples":["CERN-LineMode/2.15 libwww/2.17b3","Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1"],"name":"user_agent.original","requirement_level":"recommended","root_namespace":"user_agent","stability":"stable","type":"string"}] \ No newline at end of file +[{"brief":"The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n","name":"db.cassandra.consistency_level","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"all","note":null,"stability":null,"value":"all"},{"brief":null,"deprecated":null,"id":"each_quorum","note":null,"stability":null,"value":"each_quorum"},{"brief":null,"deprecated":null,"id":"quorum","note":null,"stability":null,"value":"quorum"},{"brief":null,"deprecated":null,"id":"local_quorum","note":null,"stability":null,"value":"local_quorum"},{"brief":null,"deprecated":null,"id":"one","note":null,"stability":null,"value":"one"},{"brief":null,"deprecated":null,"id":"two","note":null,"stability":null,"value":"two"},{"brief":null,"deprecated":null,"id":"three","note":null,"stability":null,"value":"three"},{"brief":null,"deprecated":null,"id":"local_one","note":null,"stability":null,"value":"local_one"},{"brief":null,"deprecated":null,"id":"any","note":null,"stability":null,"value":"any"},{"brief":null,"deprecated":null,"id":"serial","note":null,"stability":null,"value":"serial"},{"brief":null,"deprecated":null,"id":"local_serial","note":null,"stability":null,"value":"local_serial"}]}},{"brief":"The data center of the coordinating node for a query.\n","examples":"us-west-2","name":"db.cassandra.coordinator.dc","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The ID of the coordinating node for a query.\n","examples":"be13faa2-8574-4d71-926d-27f16cf8a7af","name":"db.cassandra.coordinator.id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"Whether or not the query is idempotent.\n","name":"db.cassandra.idempotence","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"boolean"},{"brief":"The fetch size used for paging, i.e. how many rows will be returned at once.\n","examples":[5000],"name":"db.cassandra.page_size","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n","examples":[0,2],"name":"db.cassandra.speculative_execution_count","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).","examples":"mytable","name":"db.cassandra.table","note":"This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The connection string used to connect to the database. It is recommended to remove embedded credentials.\n","examples":"Server=(localdb)\\v11.0;Integrated Security=true;","name":"db.connection_string","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"Unique Cosmos client instance id.","examples":"3ba4827d-4422-483f-b59f-85b74211c11d","name":"db.cosmosdb.client_id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"Cosmos client connection mode.","name":"db.cosmosdb.connection_mode","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":false,"members":[{"brief":"Gateway (HTTP) connections mode","deprecated":null,"id":"gateway","note":null,"stability":null,"value":"gateway"},{"brief":"Direct connection.","deprecated":null,"id":"direct","note":null,"stability":null,"value":"direct"}]}},{"brief":"Cosmos DB container name.","examples":"anystring","name":"db.cosmosdb.container","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"CosmosDB Operation Type.","name":"db.cosmosdb.operation_type","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"invalid","note":null,"stability":null,"value":"Invalid"},{"brief":null,"deprecated":null,"id":"create","note":null,"stability":null,"value":"Create"},{"brief":null,"deprecated":null,"id":"patch","note":null,"stability":null,"value":"Patch"},{"brief":null,"deprecated":null,"id":"read","note":null,"stability":null,"value":"Read"},{"brief":null,"deprecated":null,"id":"read_feed","note":null,"stability":null,"value":"ReadFeed"},{"brief":null,"deprecated":null,"id":"delete","note":null,"stability":null,"value":"Delete"},{"brief":null,"deprecated":null,"id":"replace","note":null,"stability":null,"value":"Replace"},{"brief":null,"deprecated":null,"id":"execute","note":null,"stability":null,"value":"Execute"},{"brief":null,"deprecated":null,"id":"query","note":null,"stability":null,"value":"Query"},{"brief":null,"deprecated":null,"id":"head","note":null,"stability":null,"value":"Head"},{"brief":null,"deprecated":null,"id":"head_feed","note":null,"stability":null,"value":"HeadFeed"},{"brief":null,"deprecated":null,"id":"upsert","note":null,"stability":null,"value":"Upsert"},{"brief":null,"deprecated":null,"id":"batch","note":null,"stability":null,"value":"Batch"},{"brief":null,"deprecated":null,"id":"query_plan","note":null,"stability":null,"value":"QueryPlan"},{"brief":null,"deprecated":null,"id":"execute_javascript","note":null,"stability":null,"value":"ExecuteJavaScript"}]}},{"brief":"RU consumed for that operation","examples":[46.18,1.0],"name":"db.cosmosdb.request_charge","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"double"},{"brief":"Request payload size in bytes","name":"db.cosmosdb.request_content_length","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB status code.","examples":[200,201],"name":"db.cosmosdb.status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB sub status code.","examples":[1000,1002],"name":"db.cosmosdb.sub_status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Represents the identifier of an Elasticsearch cluster.\n","examples":["e9106fc68e3044f0b1475b04bf4ffd5f"],"name":"db.elasticsearch.cluster.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"Represents the human-readable identifier of the node/instance to which a request was routed.\n","examples":["instance-0000000001"],"name":"db.elasticsearch.node.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"A dynamic value in the url path.\n","examples":["db.elasticsearch.path_parts.index=test-index","db.elasticsearch.path_parts.doc_id=123"],"name":"db.elasticsearch.path_parts","note":"Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.\u003ckey\u003e`, where `\u003ckey\u003e` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"template[string]"},{"brief":"An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.\n","examples":"mysql-e26b99z.example.com","name":"db.instance.id","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n","examples":["org.postgresql.Driver","com.microsoft.sqlserver.jdbc.SQLServerDriver"],"name":"db.jdbc.driver_classname","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-jdbc","type":"string"},{"brief":"The MongoDB collection being accessed within the database stated in `db.name`.\n","examples":["customers","products"],"name":"db.mongodb.collection","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mongodb","type":"string"},{"brief":"The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n","examples":"MSSQLSERVER","name":"db.mssql.instance_name","note":"If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mssql","type":"string"},{"brief":"This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n","examples":["customers","main"],"name":"db.name","note":"In some SQL databases, the database name to be used is called \"schema name\". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n","examples":["findAndModify","HMSET","SELECT"],"name":"db.operation","note":"When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n","examples":[0,1,15],"name":"db.redis.database_index","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-redis","type":"int"},{"brief":"The name of the primary table that the operation is acting upon, including the database name (if applicable).","examples":["public.users","customers"],"name":"db.sql.table","note":"It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-sql","type":"string"},{"brief":"The database statement being executed.\n","examples":["SELECT * FROM wuser_table","SET mykey \"WuValue\""],"name":"db.statement","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.","name":"db.system","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":{"allow_custom_values":true,"members":[{"brief":"Some other SQL database. Fallback only. See notes.","deprecated":null,"id":"other_sql","note":null,"stability":null,"value":"other_sql"},{"brief":"Microsoft SQL Server","deprecated":null,"id":"mssql","note":null,"stability":null,"value":"mssql"},{"brief":"Microsoft SQL Server Compact","deprecated":null,"id":"mssqlcompact","note":null,"stability":null,"value":"mssqlcompact"},{"brief":"MySQL","deprecated":null,"id":"mysql","note":null,"stability":null,"value":"mysql"},{"brief":"Oracle Database","deprecated":null,"id":"oracle","note":null,"stability":null,"value":"oracle"},{"brief":"IBM Db2","deprecated":null,"id":"db2","note":null,"stability":null,"value":"db2"},{"brief":"PostgreSQL","deprecated":null,"id":"postgresql","note":null,"stability":null,"value":"postgresql"},{"brief":"Amazon Redshift","deprecated":null,"id":"redshift","note":null,"stability":null,"value":"redshift"},{"brief":"Apache Hive","deprecated":null,"id":"hive","note":null,"stability":null,"value":"hive"},{"brief":"Cloudscape","deprecated":null,"id":"cloudscape","note":null,"stability":null,"value":"cloudscape"},{"brief":"HyperSQL DataBase","deprecated":null,"id":"hsqldb","note":null,"stability":null,"value":"hsqldb"},{"brief":"Progress Database","deprecated":null,"id":"progress","note":null,"stability":null,"value":"progress"},{"brief":"SAP MaxDB","deprecated":null,"id":"maxdb","note":null,"stability":null,"value":"maxdb"},{"brief":"SAP HANA","deprecated":null,"id":"hanadb","note":null,"stability":null,"value":"hanadb"},{"brief":"Ingres","deprecated":null,"id":"ingres","note":null,"stability":null,"value":"ingres"},{"brief":"FirstSQL","deprecated":null,"id":"firstsql","note":null,"stability":null,"value":"firstsql"},{"brief":"EnterpriseDB","deprecated":null,"id":"edb","note":null,"stability":null,"value":"edb"},{"brief":"InterSystems Caché","deprecated":null,"id":"cache","note":null,"stability":null,"value":"cache"},{"brief":"Adabas (Adaptable Database System)","deprecated":null,"id":"adabas","note":null,"stability":null,"value":"adabas"},{"brief":"Firebird","deprecated":null,"id":"firebird","note":null,"stability":null,"value":"firebird"},{"brief":"Apache Derby","deprecated":null,"id":"derby","note":null,"stability":null,"value":"derby"},{"brief":"FileMaker","deprecated":null,"id":"filemaker","note":null,"stability":null,"value":"filemaker"},{"brief":"Informix","deprecated":null,"id":"informix","note":null,"stability":null,"value":"informix"},{"brief":"InstantDB","deprecated":null,"id":"instantdb","note":null,"stability":null,"value":"instantdb"},{"brief":"InterBase","deprecated":null,"id":"interbase","note":null,"stability":null,"value":"interbase"},{"brief":"MariaDB","deprecated":null,"id":"mariadb","note":null,"stability":null,"value":"mariadb"},{"brief":"Netezza","deprecated":null,"id":"netezza","note":null,"stability":null,"value":"netezza"},{"brief":"Pervasive PSQL","deprecated":null,"id":"pervasive","note":null,"stability":null,"value":"pervasive"},{"brief":"PointBase","deprecated":null,"id":"pointbase","note":null,"stability":null,"value":"pointbase"},{"brief":"SQLite","deprecated":null,"id":"sqlite","note":null,"stability":null,"value":"sqlite"},{"brief":"Sybase","deprecated":null,"id":"sybase","note":null,"stability":null,"value":"sybase"},{"brief":"Teradata","deprecated":null,"id":"teradata","note":null,"stability":null,"value":"teradata"},{"brief":"Vertica","deprecated":null,"id":"vertica","note":null,"stability":null,"value":"vertica"},{"brief":"H2","deprecated":null,"id":"h2","note":null,"stability":null,"value":"h2"},{"brief":"ColdFusion IMQ","deprecated":null,"id":"coldfusion","note":null,"stability":null,"value":"coldfusion"},{"brief":"Apache Cassandra","deprecated":null,"id":"cassandra","note":null,"stability":null,"value":"cassandra"},{"brief":"Apache HBase","deprecated":null,"id":"hbase","note":null,"stability":null,"value":"hbase"},{"brief":"MongoDB","deprecated":null,"id":"mongodb","note":null,"stability":null,"value":"mongodb"},{"brief":"Redis","deprecated":null,"id":"redis","note":null,"stability":null,"value":"redis"},{"brief":"Couchbase","deprecated":null,"id":"couchbase","note":null,"stability":null,"value":"couchbase"},{"brief":"CouchDB","deprecated":null,"id":"couchdb","note":null,"stability":null,"value":"couchdb"},{"brief":"Microsoft Azure Cosmos DB","deprecated":null,"id":"cosmosdb","note":null,"stability":null,"value":"cosmosdb"},{"brief":"Amazon DynamoDB","deprecated":null,"id":"dynamodb","note":null,"stability":null,"value":"dynamodb"},{"brief":"Neo4j","deprecated":null,"id":"neo4j","note":null,"stability":null,"value":"neo4j"},{"brief":"Apache Geode","deprecated":null,"id":"geode","note":null,"stability":null,"value":"geode"},{"brief":"Elasticsearch","deprecated":null,"id":"elasticsearch","note":null,"stability":null,"value":"elasticsearch"},{"brief":"Memcached","deprecated":null,"id":"memcached","note":null,"stability":null,"value":"memcached"},{"brief":"CockroachDB","deprecated":null,"id":"cockroachdb","note":null,"stability":null,"value":"cockroachdb"},{"brief":"OpenSearch","deprecated":null,"id":"opensearch","note":null,"stability":null,"value":"opensearch"},{"brief":"ClickHouse","deprecated":null,"id":"clickhouse","note":null,"stability":null,"value":"clickhouse"},{"brief":"Cloud Spanner","deprecated":null,"id":"spanner","note":null,"stability":null,"value":"spanner"},{"brief":"Trino","deprecated":null,"id":"trino","note":null,"stability":null,"value":"trino"}]}},{"brief":"Username for accessing the database.\n","examples":["readonly_user","reporting_user"],"name":"db.user","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n","name":"exception.escaped","note":"An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically \"in flight\".\nThis may be actually \"in flight\" in some languages (e.g. if the exception\nis passed to a Context manager\u0027s `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"boolean"},{"brief":"The exception message.","examples":["Division by zero","Can\u0027t convert \u0027int\u0027 object to str implicitly"],"name":"exception.message","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n","examples":"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)","name":"exception.stacktrace","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n","examples":["java.net.ConnectException","OSError"],"name":"exception.type","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.request.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP request headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.request.header.content-type=[\"application/json\"]","http.request.header.x-forwarded-for=[\"1.2.3.4\", \"1.2.3.5\"]"],"name":"http.request.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nThe `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"HTTP request method.","examples":["GET","POST","HEAD"],"name":"http.request.method","note":"HTTP request method value SHOULD be \"known\" to the instrumentation.\nBy default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)\nand the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).\n\nIf the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.\n\nIf the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override\nthe list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named\nOTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n\nHTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.\nInstrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.\nTracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"CONNECT method.","deprecated":null,"id":"connect","note":null,"stability":null,"value":"CONNECT"},{"brief":"DELETE method.","deprecated":null,"id":"delete","note":null,"stability":null,"value":"DELETE"},{"brief":"GET method.","deprecated":null,"id":"get","note":null,"stability":null,"value":"GET"},{"brief":"HEAD method.","deprecated":null,"id":"head","note":null,"stability":null,"value":"HEAD"},{"brief":"OPTIONS method.","deprecated":null,"id":"options","note":null,"stability":null,"value":"OPTIONS"},{"brief":"PATCH method.","deprecated":null,"id":"patch","note":null,"stability":null,"value":"PATCH"},{"brief":"POST method.","deprecated":null,"id":"post","note":null,"stability":null,"value":"POST"},{"brief":"PUT method.","deprecated":null,"id":"put","note":null,"stability":null,"value":"PUT"},{"brief":"TRACE method.","deprecated":null,"id":"trace","note":null,"stability":null,"value":"TRACE"},{"brief":"Any HTTP method that the instrumentation has no prior knowledge of.","deprecated":null,"id":"other","note":null,"stability":null,"value":"_OTHER"}]}},{"brief":"Original HTTP method sent by the client in the request line.","examples":["GeT","ACL","foo"],"name":"http.request.method_original","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ordinal number of request resending attempt (for any reason, including redirects).\n","examples":3,"name":"http.request.resend_count","note":"The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.response.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP response headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.response.header.content-type=[\"application/json\"]","http.response.header.my-custom-header=[\"abc\", \"def\"]"],"name":"http.response.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nUsers MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).","examples":[200],"name":"http.response.status_code","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The matched route, that is, the path template in the format used by the respective server framework.\n","examples":["/users/:userID?","{controller}/{action}/{id?}"],"name":"http.route","note":"MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\nSHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.","examples":"DE","name":"network.carrier.icc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier country code.","examples":"310","name":"network.carrier.mcc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier network code.","examples":"001","name":"network.carrier.mnc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The name of the mobile carrier.","examples":"sprint","name":"network.carrier.name","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.","examples":"LTE","name":"network.connection.subtype","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":"GPRS","deprecated":null,"id":"gprs","note":null,"stability":null,"value":"gprs"},{"brief":"EDGE","deprecated":null,"id":"edge","note":null,"stability":null,"value":"edge"},{"brief":"UMTS","deprecated":null,"id":"umts","note":null,"stability":null,"value":"umts"},{"brief":"CDMA","deprecated":null,"id":"cdma","note":null,"stability":null,"value":"cdma"},{"brief":"EVDO Rel. 0","deprecated":null,"id":"evdo_0","note":null,"stability":null,"value":"evdo_0"},{"brief":"EVDO Rev. A","deprecated":null,"id":"evdo_a","note":null,"stability":null,"value":"evdo_a"},{"brief":"CDMA2000 1XRTT","deprecated":null,"id":"cdma2000_1xrtt","note":null,"stability":null,"value":"cdma2000_1xrtt"},{"brief":"HSDPA","deprecated":null,"id":"hsdpa","note":null,"stability":null,"value":"hsdpa"},{"brief":"HSUPA","deprecated":null,"id":"hsupa","note":null,"stability":null,"value":"hsupa"},{"brief":"HSPA","deprecated":null,"id":"hspa","note":null,"stability":null,"value":"hspa"},{"brief":"IDEN","deprecated":null,"id":"iden","note":null,"stability":null,"value":"iden"},{"brief":"EVDO Rev. B","deprecated":null,"id":"evdo_b","note":null,"stability":null,"value":"evdo_b"},{"brief":"LTE","deprecated":null,"id":"lte","note":null,"stability":null,"value":"lte"},{"brief":"EHRPD","deprecated":null,"id":"ehrpd","note":null,"stability":null,"value":"ehrpd"},{"brief":"HSPAP","deprecated":null,"id":"hspap","note":null,"stability":null,"value":"hspap"},{"brief":"GSM","deprecated":null,"id":"gsm","note":null,"stability":null,"value":"gsm"},{"brief":"TD-SCDMA","deprecated":null,"id":"td_scdma","note":null,"stability":null,"value":"td_scdma"},{"brief":"IWLAN","deprecated":null,"id":"iwlan","note":null,"stability":null,"value":"iwlan"},{"brief":"5G NR (New Radio)","deprecated":null,"id":"nr","note":null,"stability":null,"value":"nr"},{"brief":"5G NRNSA (New Radio Non-Standalone)","deprecated":null,"id":"nrnsa","note":null,"stability":null,"value":"nrnsa"},{"brief":"LTE CA","deprecated":null,"id":"lte_ca","note":null,"stability":null,"value":"lte_ca"}]}},{"brief":"The internet connection type.","examples":"wifi","name":"network.connection.type","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"wifi","note":null,"stability":null,"value":"wifi"},{"brief":null,"deprecated":null,"id":"wired","note":null,"stability":null,"value":"wired"},{"brief":null,"deprecated":null,"id":"cell","note":null,"stability":null,"value":"cell"},{"brief":null,"deprecated":null,"id":"unavailable","note":null,"stability":null,"value":"unavailable"},{"brief":null,"deprecated":null,"id":"unknown","note":null,"stability":null,"value":"unknown"}]}},{"brief":"The network IO operation direction.","examples":["transmit"],"name":"network.io.direction","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":false,"members":[{"brief":null,"deprecated":null,"id":"transmit","note":null,"stability":null,"value":"transmit"},{"brief":null,"deprecated":null,"id":"receive","note":null,"stability":null,"value":"receive"}]}},{"brief":"Local address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.local.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Local port number of the network connection.","examples":[65123],"name":"network.local.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"Peer address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.peer.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Peer port number of the network connection.","examples":[65123],"name":"network.peer.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"[OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent.","examples":["amqp","http","mqtt"],"name":"network.protocol.name","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Version of the protocol specified in `network.protocol.name`.","examples":"3.1.1","name":"network.protocol.version","note":"`network.protocol.version` refers to the version of the protocol used and might be different from the protocol client\u0027s version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"[OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n","examples":["tcp","udp"],"name":"network.transport","note":"The value SHOULD be normalized to lowercase.\n\nConsider always setting the transport when setting a port number, since\na port number is ambiguous without knowing the transport. For example\ndifferent processes could be listening on TCP port 12345 and UDP port 12345.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"TCP","deprecated":null,"id":"tcp","note":null,"stability":null,"value":"tcp"},{"brief":"UDP","deprecated":null,"id":"udp","note":null,"stability":null,"value":"udp"},{"brief":"Named or anonymous pipe.","deprecated":null,"id":"pipe","note":null,"stability":null,"value":"pipe"},{"brief":"Unix domain socket","deprecated":null,"id":"unix","note":null,"stability":null,"value":"unix"}]}},{"brief":"[OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent.","examples":["ipv4","ipv6"],"name":"network.type","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"IPv4","deprecated":null,"id":"ipv4","note":null,"stability":null,"value":"ipv4"},{"brief":"IPv6","deprecated":null,"id":"ipv6","note":null,"stability":null,"value":"ipv6"}]}},{"brief":"The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component","examples":["SemConv"],"name":"url.fragment","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)","examples":["https://www.foo.bar/search?q=OpenTelemetry#SemConv","//localhost"],"name":"url.full","note":"For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.\n`url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password SHOULD be redacted and attribute\u0027s value SHOULD be `https://REDACTED:REDACTED@www.example.com/`.\n`url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes.\n","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component","examples":["/search"],"name":"url.path","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component","examples":["q=OpenTelemetry"],"name":"url.query","note":"Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it.","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.","examples":["https","ftp","telnet"],"name":"url.scheme","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n","examples":["CERN-LineMode/2.15 libwww/2.17b3","Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1"],"name":"user_agent.original","requirement_level":"recommended","root_namespace":"user_agent","stability":"stable","type":"string"}] \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_events.json b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_events.json new file mode 100644 index 00000000..190149d8 --- /dev/null +++ b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_events.json @@ -0,0 +1 @@ +[{"attributes":[],"body":{"fields":[{"brief":"This attribute represents the state the application has transitioned into at the occurrence of the event.\n","id":"ios.state","members":[{"brief":"The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.\n","deprecated":null,"id":"active","note":null,"stability":null,"value":"active"},{"brief":"The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`.\n","deprecated":null,"id":"inactive","note":null,"stability":null,"value":"inactive"},{"brief":"The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground`.\n","deprecated":null,"id":"background","note":null,"stability":null,"value":"background"},{"brief":"The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground`.\n","deprecated":null,"id":"foreground","note":null,"stability":null,"value":"foreground"},{"brief":"The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.\n","deprecated":null,"id":"terminate","note":null,"stability":null,"value":"terminate"}],"note":"The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived.\n","requirement_level":{"conditionally_required":"if and only if `os.name` is `ios`"},"stability":"experimental","type":"enum"},{"brief":"This attribute represents the state the application has transitioned into at the occurrence of the event.\n","id":"android.state","members":[{"brief":"Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time.\n","deprecated":null,"id":"created","note":null,"stability":null,"value":"created"},{"brief":"Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state.\n","deprecated":null,"id":"background","note":null,"stability":null,"value":"background"},{"brief":"Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states.","deprecated":null,"id":"foreground","note":null,"stability":null,"value":"foreground"}],"note":"The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.\n","requirement_level":{"conditionally_required":"if and only if `os.name` is `android`"},"stability":"experimental","type":"enum"}],"id":"device.app.lifecycle.fields","requirement_level":"required","type":"map"},"brief":"This event represents an occurrence of a lifecycle transition on Android or iOS platform.\n","event_namespace":"device.app","events":[],"id":"device.app.lifecycle","instrument":null,"lineage":{"source_file":"data/mobile-events.yaml"},"metric_name":null,"name":"device.app.lifecycle","note":"This event identifies the fields that are common to all lifecycle events for android and iOS using the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are mutually exclusive.\n","span_kind":null,"stability":"experimental","type":"event","unit":null},{"attributes":[{"brief":"A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n","examples":"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)","name":"exception.stacktrace","requirement_level":"recommended","stability":"stable","type":"string"},{"brief":"SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n","name":"exception.escaped","note":"An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically \"in flight\".\nThis may be actually \"in flight\" in some languages (e.g. if the exception\nis passed to a Context manager\u0027s `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.","requirement_level":"recommended","stability":"stable","type":"boolean"},{"brief":"The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n","examples":["java.net.ConnectException","OSError"],"name":"exception.type","requirement_level":{"conditionally_required":"Required if `exception.message` is not set, recommended otherwise."},"stability":"stable","type":"string"},{"brief":"The exception message.","examples":["Division by zero","Can\u0027t convert \u0027int\u0027 object to str implicitly"],"name":"exception.message","requirement_level":{"conditionally_required":"Required if `exception.type` is not set, recommended otherwise."},"stability":"stable","type":"string"}],"brief":"This document defines the attributes used to report a single exception associated with a span.\n","event_namespace":"other","events":[],"id":"trace-exception","instrument":null,"lineage":{"attributes":{"exception.escaped":{"inherited_fields":["brief","note","requirement_level","stability"],"source_group":"registry.exception"},"exception.message":{"inherited_fields":["brief","examples","note","stability"],"locally_overridden_fields":["requirement_level"],"source_group":"registry.exception"},"exception.stacktrace":{"inherited_fields":["brief","examples","note","requirement_level","stability"],"source_group":"registry.exception"},"exception.type":{"inherited_fields":["brief","examples","note","stability"],"locally_overridden_fields":["requirement_level"],"source_group":"registry.exception"}},"source_file":"data/trace-exception.yaml"},"metric_name":null,"name":null,"prefix":"exception","span_kind":null,"type":"event","unit":null}] \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes.json b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes.json index 7239c2dd..5b741812 100644 --- a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes.json +++ b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes.json @@ -1 +1 @@ -[{"attributes":[{"brief":"The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n","name":"db.cassandra.consistency_level","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"all","note":null,"stability":null,"value":"all"},{"brief":null,"deprecated":null,"id":"each_quorum","note":null,"stability":null,"value":"each_quorum"},{"brief":null,"deprecated":null,"id":"quorum","note":null,"stability":null,"value":"quorum"},{"brief":null,"deprecated":null,"id":"local_quorum","note":null,"stability":null,"value":"local_quorum"},{"brief":null,"deprecated":null,"id":"one","note":null,"stability":null,"value":"one"},{"brief":null,"deprecated":null,"id":"two","note":null,"stability":null,"value":"two"},{"brief":null,"deprecated":null,"id":"three","note":null,"stability":null,"value":"three"},{"brief":null,"deprecated":null,"id":"local_one","note":null,"stability":null,"value":"local_one"},{"brief":null,"deprecated":null,"id":"any","note":null,"stability":null,"value":"any"},{"brief":null,"deprecated":null,"id":"serial","note":null,"stability":null,"value":"serial"},{"brief":null,"deprecated":null,"id":"local_serial","note":null,"stability":null,"value":"local_serial"}]}},{"brief":"The data center of the coordinating node for a query.\n","examples":"us-west-2","name":"db.cassandra.coordinator.dc","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The ID of the coordinating node for a query.\n","examples":"be13faa2-8574-4d71-926d-27f16cf8a7af","name":"db.cassandra.coordinator.id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"Whether or not the query is idempotent.\n","name":"db.cassandra.idempotence","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"boolean"},{"brief":"The fetch size used for paging, i.e. how many rows will be returned at once.\n","examples":[5000],"name":"db.cassandra.page_size","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n","examples":[0,2],"name":"db.cassandra.speculative_execution_count","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).","examples":"mytable","name":"db.cassandra.table","note":"This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The connection string used to connect to the database. It is recommended to remove embedded credentials.\n","examples":"Server=(localdb)\\v11.0;Integrated Security=true;","name":"db.connection_string","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"Unique Cosmos client instance id.","examples":"3ba4827d-4422-483f-b59f-85b74211c11d","name":"db.cosmosdb.client_id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"Cosmos client connection mode.","name":"db.cosmosdb.connection_mode","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":false,"members":[{"brief":"Gateway (HTTP) connections mode","deprecated":null,"id":"gateway","note":null,"stability":null,"value":"gateway"},{"brief":"Direct connection.","deprecated":null,"id":"direct","note":null,"stability":null,"value":"direct"}]}},{"brief":"Cosmos DB container name.","examples":"anystring","name":"db.cosmosdb.container","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"CosmosDB Operation Type.","name":"db.cosmosdb.operation_type","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"invalid","note":null,"stability":null,"value":"Invalid"},{"brief":null,"deprecated":null,"id":"create","note":null,"stability":null,"value":"Create"},{"brief":null,"deprecated":null,"id":"patch","note":null,"stability":null,"value":"Patch"},{"brief":null,"deprecated":null,"id":"read","note":null,"stability":null,"value":"Read"},{"brief":null,"deprecated":null,"id":"read_feed","note":null,"stability":null,"value":"ReadFeed"},{"brief":null,"deprecated":null,"id":"delete","note":null,"stability":null,"value":"Delete"},{"brief":null,"deprecated":null,"id":"replace","note":null,"stability":null,"value":"Replace"},{"brief":null,"deprecated":null,"id":"execute","note":null,"stability":null,"value":"Execute"},{"brief":null,"deprecated":null,"id":"query","note":null,"stability":null,"value":"Query"},{"brief":null,"deprecated":null,"id":"head","note":null,"stability":null,"value":"Head"},{"brief":null,"deprecated":null,"id":"head_feed","note":null,"stability":null,"value":"HeadFeed"},{"brief":null,"deprecated":null,"id":"upsert","note":null,"stability":null,"value":"Upsert"},{"brief":null,"deprecated":null,"id":"batch","note":null,"stability":null,"value":"Batch"},{"brief":null,"deprecated":null,"id":"query_plan","note":null,"stability":null,"value":"QueryPlan"},{"brief":null,"deprecated":null,"id":"execute_javascript","note":null,"stability":null,"value":"ExecuteJavaScript"}]}},{"brief":"RU consumed for that operation","examples":[46.18,1.0],"name":"db.cosmosdb.request_charge","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"double"},{"brief":"Request payload size in bytes","name":"db.cosmosdb.request_content_length","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB status code.","examples":[200,201],"name":"db.cosmosdb.status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB sub status code.","examples":[1000,1002],"name":"db.cosmosdb.sub_status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Represents the identifier of an Elasticsearch cluster.\n","examples":["e9106fc68e3044f0b1475b04bf4ffd5f"],"name":"db.elasticsearch.cluster.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"Represents the human-readable identifier of the node/instance to which a request was routed.\n","examples":["instance-0000000001"],"name":"db.elasticsearch.node.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"A dynamic value in the url path.\n","examples":["db.elasticsearch.path_parts.index=test-index","db.elasticsearch.path_parts.doc_id=123"],"name":"db.elasticsearch.path_parts","note":"Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.\u003ckey\u003e`, where `\u003ckey\u003e` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"template[string]"},{"brief":"An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.\n","examples":"mysql-e26b99z.example.com","name":"db.instance.id","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n","examples":["org.postgresql.Driver","com.microsoft.sqlserver.jdbc.SQLServerDriver"],"name":"db.jdbc.driver_classname","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-jdbc","type":"string"},{"brief":"The MongoDB collection being accessed within the database stated in `db.name`.\n","examples":["customers","products"],"name":"db.mongodb.collection","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mongodb","type":"string"},{"brief":"The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n","examples":"MSSQLSERVER","name":"db.mssql.instance_name","note":"If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mssql","type":"string"},{"brief":"This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n","examples":["customers","main"],"name":"db.name","note":"In some SQL databases, the database name to be used is called \"schema name\". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n","examples":["findAndModify","HMSET","SELECT"],"name":"db.operation","note":"When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n","examples":[0,1,15],"name":"db.redis.database_index","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-redis","type":"int"},{"brief":"The name of the primary table that the operation is acting upon, including the database name (if applicable).","examples":["public.users","customers"],"name":"db.sql.table","note":"It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-sql","type":"string"},{"brief":"The database statement being executed.\n","examples":["SELECT * FROM wuser_table","SET mykey \"WuValue\""],"name":"db.statement","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.","name":"db.system","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":{"allow_custom_values":true,"members":[{"brief":"Some other SQL database. Fallback only. See notes.","deprecated":null,"id":"other_sql","note":null,"stability":null,"value":"other_sql"},{"brief":"Microsoft SQL Server","deprecated":null,"id":"mssql","note":null,"stability":null,"value":"mssql"},{"brief":"Microsoft SQL Server Compact","deprecated":null,"id":"mssqlcompact","note":null,"stability":null,"value":"mssqlcompact"},{"brief":"MySQL","deprecated":null,"id":"mysql","note":null,"stability":null,"value":"mysql"},{"brief":"Oracle Database","deprecated":null,"id":"oracle","note":null,"stability":null,"value":"oracle"},{"brief":"IBM Db2","deprecated":null,"id":"db2","note":null,"stability":null,"value":"db2"},{"brief":"PostgreSQL","deprecated":null,"id":"postgresql","note":null,"stability":null,"value":"postgresql"},{"brief":"Amazon Redshift","deprecated":null,"id":"redshift","note":null,"stability":null,"value":"redshift"},{"brief":"Apache Hive","deprecated":null,"id":"hive","note":null,"stability":null,"value":"hive"},{"brief":"Cloudscape","deprecated":null,"id":"cloudscape","note":null,"stability":null,"value":"cloudscape"},{"brief":"HyperSQL DataBase","deprecated":null,"id":"hsqldb","note":null,"stability":null,"value":"hsqldb"},{"brief":"Progress Database","deprecated":null,"id":"progress","note":null,"stability":null,"value":"progress"},{"brief":"SAP MaxDB","deprecated":null,"id":"maxdb","note":null,"stability":null,"value":"maxdb"},{"brief":"SAP HANA","deprecated":null,"id":"hanadb","note":null,"stability":null,"value":"hanadb"},{"brief":"Ingres","deprecated":null,"id":"ingres","note":null,"stability":null,"value":"ingres"},{"brief":"FirstSQL","deprecated":null,"id":"firstsql","note":null,"stability":null,"value":"firstsql"},{"brief":"EnterpriseDB","deprecated":null,"id":"edb","note":null,"stability":null,"value":"edb"},{"brief":"InterSystems Caché","deprecated":null,"id":"cache","note":null,"stability":null,"value":"cache"},{"brief":"Adabas (Adaptable Database System)","deprecated":null,"id":"adabas","note":null,"stability":null,"value":"adabas"},{"brief":"Firebird","deprecated":null,"id":"firebird","note":null,"stability":null,"value":"firebird"},{"brief":"Apache Derby","deprecated":null,"id":"derby","note":null,"stability":null,"value":"derby"},{"brief":"FileMaker","deprecated":null,"id":"filemaker","note":null,"stability":null,"value":"filemaker"},{"brief":"Informix","deprecated":null,"id":"informix","note":null,"stability":null,"value":"informix"},{"brief":"InstantDB","deprecated":null,"id":"instantdb","note":null,"stability":null,"value":"instantdb"},{"brief":"InterBase","deprecated":null,"id":"interbase","note":null,"stability":null,"value":"interbase"},{"brief":"MariaDB","deprecated":null,"id":"mariadb","note":null,"stability":null,"value":"mariadb"},{"brief":"Netezza","deprecated":null,"id":"netezza","note":null,"stability":null,"value":"netezza"},{"brief":"Pervasive PSQL","deprecated":null,"id":"pervasive","note":null,"stability":null,"value":"pervasive"},{"brief":"PointBase","deprecated":null,"id":"pointbase","note":null,"stability":null,"value":"pointbase"},{"brief":"SQLite","deprecated":null,"id":"sqlite","note":null,"stability":null,"value":"sqlite"},{"brief":"Sybase","deprecated":null,"id":"sybase","note":null,"stability":null,"value":"sybase"},{"brief":"Teradata","deprecated":null,"id":"teradata","note":null,"stability":null,"value":"teradata"},{"brief":"Vertica","deprecated":null,"id":"vertica","note":null,"stability":null,"value":"vertica"},{"brief":"H2","deprecated":null,"id":"h2","note":null,"stability":null,"value":"h2"},{"brief":"ColdFusion IMQ","deprecated":null,"id":"coldfusion","note":null,"stability":null,"value":"coldfusion"},{"brief":"Apache Cassandra","deprecated":null,"id":"cassandra","note":null,"stability":null,"value":"cassandra"},{"brief":"Apache HBase","deprecated":null,"id":"hbase","note":null,"stability":null,"value":"hbase"},{"brief":"MongoDB","deprecated":null,"id":"mongodb","note":null,"stability":null,"value":"mongodb"},{"brief":"Redis","deprecated":null,"id":"redis","note":null,"stability":null,"value":"redis"},{"brief":"Couchbase","deprecated":null,"id":"couchbase","note":null,"stability":null,"value":"couchbase"},{"brief":"CouchDB","deprecated":null,"id":"couchdb","note":null,"stability":null,"value":"couchdb"},{"brief":"Microsoft Azure Cosmos DB","deprecated":null,"id":"cosmosdb","note":null,"stability":null,"value":"cosmosdb"},{"brief":"Amazon DynamoDB","deprecated":null,"id":"dynamodb","note":null,"stability":null,"value":"dynamodb"},{"brief":"Neo4j","deprecated":null,"id":"neo4j","note":null,"stability":null,"value":"neo4j"},{"brief":"Apache Geode","deprecated":null,"id":"geode","note":null,"stability":null,"value":"geode"},{"brief":"Elasticsearch","deprecated":null,"id":"elasticsearch","note":null,"stability":null,"value":"elasticsearch"},{"brief":"Memcached","deprecated":null,"id":"memcached","note":null,"stability":null,"value":"memcached"},{"brief":"CockroachDB","deprecated":null,"id":"cockroachdb","note":null,"stability":null,"value":"cockroachdb"},{"brief":"OpenSearch","deprecated":null,"id":"opensearch","note":null,"stability":null,"value":"opensearch"},{"brief":"ClickHouse","deprecated":null,"id":"clickhouse","note":null,"stability":null,"value":"clickhouse"},{"brief":"Cloud Spanner","deprecated":null,"id":"spanner","note":null,"stability":null,"value":"spanner"},{"brief":"Trino","deprecated":null,"id":"trino","note":null,"stability":null,"value":"trino"}]}},{"brief":"Username for accessing the database.\n","examples":["readonly_user","reporting_user"],"name":"db.user","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"}],"root_namespace":"db"},{"attributes":[{"brief":"The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.request.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP request headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.request.header.content-type=[\"application/json\"]","http.request.header.x-forwarded-for=[\"1.2.3.4\", \"1.2.3.5\"]"],"name":"http.request.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nThe `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"HTTP request method.","examples":["GET","POST","HEAD"],"name":"http.request.method","note":"HTTP request method value SHOULD be \"known\" to the instrumentation.\nBy default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)\nand the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).\n\nIf the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.\n\nIf the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override\nthe list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named\nOTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n\nHTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.\nInstrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.\nTracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"CONNECT method.","deprecated":null,"id":"connect","note":null,"stability":null,"value":"CONNECT"},{"brief":"DELETE method.","deprecated":null,"id":"delete","note":null,"stability":null,"value":"DELETE"},{"brief":"GET method.","deprecated":null,"id":"get","note":null,"stability":null,"value":"GET"},{"brief":"HEAD method.","deprecated":null,"id":"head","note":null,"stability":null,"value":"HEAD"},{"brief":"OPTIONS method.","deprecated":null,"id":"options","note":null,"stability":null,"value":"OPTIONS"},{"brief":"PATCH method.","deprecated":null,"id":"patch","note":null,"stability":null,"value":"PATCH"},{"brief":"POST method.","deprecated":null,"id":"post","note":null,"stability":null,"value":"POST"},{"brief":"PUT method.","deprecated":null,"id":"put","note":null,"stability":null,"value":"PUT"},{"brief":"TRACE method.","deprecated":null,"id":"trace","note":null,"stability":null,"value":"TRACE"},{"brief":"Any HTTP method that the instrumentation has no prior knowledge of.","deprecated":null,"id":"other","note":null,"stability":null,"value":"_OTHER"}]}},{"brief":"Original HTTP method sent by the client in the request line.","examples":["GeT","ACL","foo"],"name":"http.request.method_original","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ordinal number of request resending attempt (for any reason, including redirects).\n","examples":3,"name":"http.request.resend_count","note":"The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.response.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP response headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.response.header.content-type=[\"application/json\"]","http.response.header.my-custom-header=[\"abc\", \"def\"]"],"name":"http.response.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nUsers MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).","examples":[200],"name":"http.response.status_code","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The matched route, that is, the path template in the format used by the respective server framework.\n","examples":["/users/:userID?","{controller}/{action}/{id?}"],"name":"http.route","note":"MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\nSHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"}],"root_namespace":"http"},{"attributes":[{"brief":"The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.","examples":"DE","name":"network.carrier.icc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier country code.","examples":"310","name":"network.carrier.mcc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier network code.","examples":"001","name":"network.carrier.mnc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The name of the mobile carrier.","examples":"sprint","name":"network.carrier.name","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.","examples":"LTE","name":"network.connection.subtype","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":"GPRS","deprecated":null,"id":"gprs","note":null,"stability":null,"value":"gprs"},{"brief":"EDGE","deprecated":null,"id":"edge","note":null,"stability":null,"value":"edge"},{"brief":"UMTS","deprecated":null,"id":"umts","note":null,"stability":null,"value":"umts"},{"brief":"CDMA","deprecated":null,"id":"cdma","note":null,"stability":null,"value":"cdma"},{"brief":"EVDO Rel. 0","deprecated":null,"id":"evdo_0","note":null,"stability":null,"value":"evdo_0"},{"brief":"EVDO Rev. A","deprecated":null,"id":"evdo_a","note":null,"stability":null,"value":"evdo_a"},{"brief":"CDMA2000 1XRTT","deprecated":null,"id":"cdma2000_1xrtt","note":null,"stability":null,"value":"cdma2000_1xrtt"},{"brief":"HSDPA","deprecated":null,"id":"hsdpa","note":null,"stability":null,"value":"hsdpa"},{"brief":"HSUPA","deprecated":null,"id":"hsupa","note":null,"stability":null,"value":"hsupa"},{"brief":"HSPA","deprecated":null,"id":"hspa","note":null,"stability":null,"value":"hspa"},{"brief":"IDEN","deprecated":null,"id":"iden","note":null,"stability":null,"value":"iden"},{"brief":"EVDO Rev. B","deprecated":null,"id":"evdo_b","note":null,"stability":null,"value":"evdo_b"},{"brief":"LTE","deprecated":null,"id":"lte","note":null,"stability":null,"value":"lte"},{"brief":"EHRPD","deprecated":null,"id":"ehrpd","note":null,"stability":null,"value":"ehrpd"},{"brief":"HSPAP","deprecated":null,"id":"hspap","note":null,"stability":null,"value":"hspap"},{"brief":"GSM","deprecated":null,"id":"gsm","note":null,"stability":null,"value":"gsm"},{"brief":"TD-SCDMA","deprecated":null,"id":"td_scdma","note":null,"stability":null,"value":"td_scdma"},{"brief":"IWLAN","deprecated":null,"id":"iwlan","note":null,"stability":null,"value":"iwlan"},{"brief":"5G NR (New Radio)","deprecated":null,"id":"nr","note":null,"stability":null,"value":"nr"},{"brief":"5G NRNSA (New Radio Non-Standalone)","deprecated":null,"id":"nrnsa","note":null,"stability":null,"value":"nrnsa"},{"brief":"LTE CA","deprecated":null,"id":"lte_ca","note":null,"stability":null,"value":"lte_ca"}]}},{"brief":"The internet connection type.","examples":"wifi","name":"network.connection.type","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"wifi","note":null,"stability":null,"value":"wifi"},{"brief":null,"deprecated":null,"id":"wired","note":null,"stability":null,"value":"wired"},{"brief":null,"deprecated":null,"id":"cell","note":null,"stability":null,"value":"cell"},{"brief":null,"deprecated":null,"id":"unavailable","note":null,"stability":null,"value":"unavailable"},{"brief":null,"deprecated":null,"id":"unknown","note":null,"stability":null,"value":"unknown"}]}},{"brief":"The network IO operation direction.","examples":["transmit"],"name":"network.io.direction","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":false,"members":[{"brief":null,"deprecated":null,"id":"transmit","note":null,"stability":null,"value":"transmit"},{"brief":null,"deprecated":null,"id":"receive","note":null,"stability":null,"value":"receive"}]}},{"brief":"Local address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.local.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Local port number of the network connection.","examples":[65123],"name":"network.local.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"Peer address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.peer.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Peer port number of the network connection.","examples":[65123],"name":"network.peer.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"[OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent.","examples":["amqp","http","mqtt"],"name":"network.protocol.name","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Version of the protocol specified in `network.protocol.name`.","examples":"3.1.1","name":"network.protocol.version","note":"`network.protocol.version` refers to the version of the protocol used and might be different from the protocol client\u0027s version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"[OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n","examples":["tcp","udp"],"name":"network.transport","note":"The value SHOULD be normalized to lowercase.\n\nConsider always setting the transport when setting a port number, since\na port number is ambiguous without knowing the transport. For example\ndifferent processes could be listening on TCP port 12345 and UDP port 12345.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"TCP","deprecated":null,"id":"tcp","note":null,"stability":null,"value":"tcp"},{"brief":"UDP","deprecated":null,"id":"udp","note":null,"stability":null,"value":"udp"},{"brief":"Named or anonymous pipe.","deprecated":null,"id":"pipe","note":null,"stability":null,"value":"pipe"},{"brief":"Unix domain socket","deprecated":null,"id":"unix","note":null,"stability":null,"value":"unix"}]}},{"brief":"[OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent.","examples":["ipv4","ipv6"],"name":"network.type","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"IPv4","deprecated":null,"id":"ipv4","note":null,"stability":null,"value":"ipv4"},{"brief":"IPv6","deprecated":null,"id":"ipv6","note":null,"stability":null,"value":"ipv6"}]}}],"root_namespace":"network"},{"attributes":[{"brief":"The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component","examples":["SemConv"],"name":"url.fragment","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)","examples":["https://www.foo.bar/search?q=OpenTelemetry#SemConv","//localhost"],"name":"url.full","note":"For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.\n`url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password SHOULD be redacted and attribute\u0027s value SHOULD be `https://REDACTED:REDACTED@www.example.com/`.\n`url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes.\n","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component","examples":["/search"],"name":"url.path","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component","examples":["q=OpenTelemetry"],"name":"url.query","note":"Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it.","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.","examples":["https","ftp","telnet"],"name":"url.scheme","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"}],"root_namespace":"url"},{"attributes":[{"brief":"Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n","examples":["CERN-LineMode/2.15 libwww/2.17b3","Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1"],"name":"user_agent.original","requirement_level":"recommended","root_namespace":"user_agent","stability":"stable","type":"string"}],"root_namespace":"user_agent"}] \ No newline at end of file +[{"attributes":[{"brief":"The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n","name":"db.cassandra.consistency_level","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"all","note":null,"stability":null,"value":"all"},{"brief":null,"deprecated":null,"id":"each_quorum","note":null,"stability":null,"value":"each_quorum"},{"brief":null,"deprecated":null,"id":"quorum","note":null,"stability":null,"value":"quorum"},{"brief":null,"deprecated":null,"id":"local_quorum","note":null,"stability":null,"value":"local_quorum"},{"brief":null,"deprecated":null,"id":"one","note":null,"stability":null,"value":"one"},{"brief":null,"deprecated":null,"id":"two","note":null,"stability":null,"value":"two"},{"brief":null,"deprecated":null,"id":"three","note":null,"stability":null,"value":"three"},{"brief":null,"deprecated":null,"id":"local_one","note":null,"stability":null,"value":"local_one"},{"brief":null,"deprecated":null,"id":"any","note":null,"stability":null,"value":"any"},{"brief":null,"deprecated":null,"id":"serial","note":null,"stability":null,"value":"serial"},{"brief":null,"deprecated":null,"id":"local_serial","note":null,"stability":null,"value":"local_serial"}]}},{"brief":"The data center of the coordinating node for a query.\n","examples":"us-west-2","name":"db.cassandra.coordinator.dc","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The ID of the coordinating node for a query.\n","examples":"be13faa2-8574-4d71-926d-27f16cf8a7af","name":"db.cassandra.coordinator.id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"Whether or not the query is idempotent.\n","name":"db.cassandra.idempotence","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"boolean"},{"brief":"The fetch size used for paging, i.e. how many rows will be returned at once.\n","examples":[5000],"name":"db.cassandra.page_size","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n","examples":[0,2],"name":"db.cassandra.speculative_execution_count","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).","examples":"mytable","name":"db.cassandra.table","note":"This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The connection string used to connect to the database. It is recommended to remove embedded credentials.\n","examples":"Server=(localdb)\\v11.0;Integrated Security=true;","name":"db.connection_string","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"Unique Cosmos client instance id.","examples":"3ba4827d-4422-483f-b59f-85b74211c11d","name":"db.cosmosdb.client_id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"Cosmos client connection mode.","name":"db.cosmosdb.connection_mode","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":false,"members":[{"brief":"Gateway (HTTP) connections mode","deprecated":null,"id":"gateway","note":null,"stability":null,"value":"gateway"},{"brief":"Direct connection.","deprecated":null,"id":"direct","note":null,"stability":null,"value":"direct"}]}},{"brief":"Cosmos DB container name.","examples":"anystring","name":"db.cosmosdb.container","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"CosmosDB Operation Type.","name":"db.cosmosdb.operation_type","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"invalid","note":null,"stability":null,"value":"Invalid"},{"brief":null,"deprecated":null,"id":"create","note":null,"stability":null,"value":"Create"},{"brief":null,"deprecated":null,"id":"patch","note":null,"stability":null,"value":"Patch"},{"brief":null,"deprecated":null,"id":"read","note":null,"stability":null,"value":"Read"},{"brief":null,"deprecated":null,"id":"read_feed","note":null,"stability":null,"value":"ReadFeed"},{"brief":null,"deprecated":null,"id":"delete","note":null,"stability":null,"value":"Delete"},{"brief":null,"deprecated":null,"id":"replace","note":null,"stability":null,"value":"Replace"},{"brief":null,"deprecated":null,"id":"execute","note":null,"stability":null,"value":"Execute"},{"brief":null,"deprecated":null,"id":"query","note":null,"stability":null,"value":"Query"},{"brief":null,"deprecated":null,"id":"head","note":null,"stability":null,"value":"Head"},{"brief":null,"deprecated":null,"id":"head_feed","note":null,"stability":null,"value":"HeadFeed"},{"brief":null,"deprecated":null,"id":"upsert","note":null,"stability":null,"value":"Upsert"},{"brief":null,"deprecated":null,"id":"batch","note":null,"stability":null,"value":"Batch"},{"brief":null,"deprecated":null,"id":"query_plan","note":null,"stability":null,"value":"QueryPlan"},{"brief":null,"deprecated":null,"id":"execute_javascript","note":null,"stability":null,"value":"ExecuteJavaScript"}]}},{"brief":"RU consumed for that operation","examples":[46.18,1.0],"name":"db.cosmosdb.request_charge","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"double"},{"brief":"Request payload size in bytes","name":"db.cosmosdb.request_content_length","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB status code.","examples":[200,201],"name":"db.cosmosdb.status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB sub status code.","examples":[1000,1002],"name":"db.cosmosdb.sub_status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Represents the identifier of an Elasticsearch cluster.\n","examples":["e9106fc68e3044f0b1475b04bf4ffd5f"],"name":"db.elasticsearch.cluster.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"Represents the human-readable identifier of the node/instance to which a request was routed.\n","examples":["instance-0000000001"],"name":"db.elasticsearch.node.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"A dynamic value in the url path.\n","examples":["db.elasticsearch.path_parts.index=test-index","db.elasticsearch.path_parts.doc_id=123"],"name":"db.elasticsearch.path_parts","note":"Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.\u003ckey\u003e`, where `\u003ckey\u003e` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"template[string]"},{"brief":"An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.\n","examples":"mysql-e26b99z.example.com","name":"db.instance.id","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n","examples":["org.postgresql.Driver","com.microsoft.sqlserver.jdbc.SQLServerDriver"],"name":"db.jdbc.driver_classname","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-jdbc","type":"string"},{"brief":"The MongoDB collection being accessed within the database stated in `db.name`.\n","examples":["customers","products"],"name":"db.mongodb.collection","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mongodb","type":"string"},{"brief":"The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n","examples":"MSSQLSERVER","name":"db.mssql.instance_name","note":"If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mssql","type":"string"},{"brief":"This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n","examples":["customers","main"],"name":"db.name","note":"In some SQL databases, the database name to be used is called \"schema name\". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n","examples":["findAndModify","HMSET","SELECT"],"name":"db.operation","note":"When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n","examples":[0,1,15],"name":"db.redis.database_index","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-redis","type":"int"},{"brief":"The name of the primary table that the operation is acting upon, including the database name (if applicable).","examples":["public.users","customers"],"name":"db.sql.table","note":"It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-sql","type":"string"},{"brief":"The database statement being executed.\n","examples":["SELECT * FROM wuser_table","SET mykey \"WuValue\""],"name":"db.statement","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.","name":"db.system","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":{"allow_custom_values":true,"members":[{"brief":"Some other SQL database. Fallback only. See notes.","deprecated":null,"id":"other_sql","note":null,"stability":null,"value":"other_sql"},{"brief":"Microsoft SQL Server","deprecated":null,"id":"mssql","note":null,"stability":null,"value":"mssql"},{"brief":"Microsoft SQL Server Compact","deprecated":null,"id":"mssqlcompact","note":null,"stability":null,"value":"mssqlcompact"},{"brief":"MySQL","deprecated":null,"id":"mysql","note":null,"stability":null,"value":"mysql"},{"brief":"Oracle Database","deprecated":null,"id":"oracle","note":null,"stability":null,"value":"oracle"},{"brief":"IBM Db2","deprecated":null,"id":"db2","note":null,"stability":null,"value":"db2"},{"brief":"PostgreSQL","deprecated":null,"id":"postgresql","note":null,"stability":null,"value":"postgresql"},{"brief":"Amazon Redshift","deprecated":null,"id":"redshift","note":null,"stability":null,"value":"redshift"},{"brief":"Apache Hive","deprecated":null,"id":"hive","note":null,"stability":null,"value":"hive"},{"brief":"Cloudscape","deprecated":null,"id":"cloudscape","note":null,"stability":null,"value":"cloudscape"},{"brief":"HyperSQL DataBase","deprecated":null,"id":"hsqldb","note":null,"stability":null,"value":"hsqldb"},{"brief":"Progress Database","deprecated":null,"id":"progress","note":null,"stability":null,"value":"progress"},{"brief":"SAP MaxDB","deprecated":null,"id":"maxdb","note":null,"stability":null,"value":"maxdb"},{"brief":"SAP HANA","deprecated":null,"id":"hanadb","note":null,"stability":null,"value":"hanadb"},{"brief":"Ingres","deprecated":null,"id":"ingres","note":null,"stability":null,"value":"ingres"},{"brief":"FirstSQL","deprecated":null,"id":"firstsql","note":null,"stability":null,"value":"firstsql"},{"brief":"EnterpriseDB","deprecated":null,"id":"edb","note":null,"stability":null,"value":"edb"},{"brief":"InterSystems Caché","deprecated":null,"id":"cache","note":null,"stability":null,"value":"cache"},{"brief":"Adabas (Adaptable Database System)","deprecated":null,"id":"adabas","note":null,"stability":null,"value":"adabas"},{"brief":"Firebird","deprecated":null,"id":"firebird","note":null,"stability":null,"value":"firebird"},{"brief":"Apache Derby","deprecated":null,"id":"derby","note":null,"stability":null,"value":"derby"},{"brief":"FileMaker","deprecated":null,"id":"filemaker","note":null,"stability":null,"value":"filemaker"},{"brief":"Informix","deprecated":null,"id":"informix","note":null,"stability":null,"value":"informix"},{"brief":"InstantDB","deprecated":null,"id":"instantdb","note":null,"stability":null,"value":"instantdb"},{"brief":"InterBase","deprecated":null,"id":"interbase","note":null,"stability":null,"value":"interbase"},{"brief":"MariaDB","deprecated":null,"id":"mariadb","note":null,"stability":null,"value":"mariadb"},{"brief":"Netezza","deprecated":null,"id":"netezza","note":null,"stability":null,"value":"netezza"},{"brief":"Pervasive PSQL","deprecated":null,"id":"pervasive","note":null,"stability":null,"value":"pervasive"},{"brief":"PointBase","deprecated":null,"id":"pointbase","note":null,"stability":null,"value":"pointbase"},{"brief":"SQLite","deprecated":null,"id":"sqlite","note":null,"stability":null,"value":"sqlite"},{"brief":"Sybase","deprecated":null,"id":"sybase","note":null,"stability":null,"value":"sybase"},{"brief":"Teradata","deprecated":null,"id":"teradata","note":null,"stability":null,"value":"teradata"},{"brief":"Vertica","deprecated":null,"id":"vertica","note":null,"stability":null,"value":"vertica"},{"brief":"H2","deprecated":null,"id":"h2","note":null,"stability":null,"value":"h2"},{"brief":"ColdFusion IMQ","deprecated":null,"id":"coldfusion","note":null,"stability":null,"value":"coldfusion"},{"brief":"Apache Cassandra","deprecated":null,"id":"cassandra","note":null,"stability":null,"value":"cassandra"},{"brief":"Apache HBase","deprecated":null,"id":"hbase","note":null,"stability":null,"value":"hbase"},{"brief":"MongoDB","deprecated":null,"id":"mongodb","note":null,"stability":null,"value":"mongodb"},{"brief":"Redis","deprecated":null,"id":"redis","note":null,"stability":null,"value":"redis"},{"brief":"Couchbase","deprecated":null,"id":"couchbase","note":null,"stability":null,"value":"couchbase"},{"brief":"CouchDB","deprecated":null,"id":"couchdb","note":null,"stability":null,"value":"couchdb"},{"brief":"Microsoft Azure Cosmos DB","deprecated":null,"id":"cosmosdb","note":null,"stability":null,"value":"cosmosdb"},{"brief":"Amazon DynamoDB","deprecated":null,"id":"dynamodb","note":null,"stability":null,"value":"dynamodb"},{"brief":"Neo4j","deprecated":null,"id":"neo4j","note":null,"stability":null,"value":"neo4j"},{"brief":"Apache Geode","deprecated":null,"id":"geode","note":null,"stability":null,"value":"geode"},{"brief":"Elasticsearch","deprecated":null,"id":"elasticsearch","note":null,"stability":null,"value":"elasticsearch"},{"brief":"Memcached","deprecated":null,"id":"memcached","note":null,"stability":null,"value":"memcached"},{"brief":"CockroachDB","deprecated":null,"id":"cockroachdb","note":null,"stability":null,"value":"cockroachdb"},{"brief":"OpenSearch","deprecated":null,"id":"opensearch","note":null,"stability":null,"value":"opensearch"},{"brief":"ClickHouse","deprecated":null,"id":"clickhouse","note":null,"stability":null,"value":"clickhouse"},{"brief":"Cloud Spanner","deprecated":null,"id":"spanner","note":null,"stability":null,"value":"spanner"},{"brief":"Trino","deprecated":null,"id":"trino","note":null,"stability":null,"value":"trino"}]}},{"brief":"Username for accessing the database.\n","examples":["readonly_user","reporting_user"],"name":"db.user","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"}],"root_namespace":"db"},{"attributes":[{"brief":"SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n","name":"exception.escaped","note":"An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically \"in flight\".\nThis may be actually \"in flight\" in some languages (e.g. if the exception\nis passed to a Context manager\u0027s `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"boolean"},{"brief":"The exception message.","examples":["Division by zero","Can\u0027t convert \u0027int\u0027 object to str implicitly"],"name":"exception.message","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n","examples":"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)","name":"exception.stacktrace","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n","examples":["java.net.ConnectException","OSError"],"name":"exception.type","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"}],"root_namespace":"exception"},{"attributes":[{"brief":"The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.request.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP request headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.request.header.content-type=[\"application/json\"]","http.request.header.x-forwarded-for=[\"1.2.3.4\", \"1.2.3.5\"]"],"name":"http.request.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nThe `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"HTTP request method.","examples":["GET","POST","HEAD"],"name":"http.request.method","note":"HTTP request method value SHOULD be \"known\" to the instrumentation.\nBy default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)\nand the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).\n\nIf the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.\n\nIf the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override\nthe list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named\nOTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n\nHTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.\nInstrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.\nTracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"CONNECT method.","deprecated":null,"id":"connect","note":null,"stability":null,"value":"CONNECT"},{"brief":"DELETE method.","deprecated":null,"id":"delete","note":null,"stability":null,"value":"DELETE"},{"brief":"GET method.","deprecated":null,"id":"get","note":null,"stability":null,"value":"GET"},{"brief":"HEAD method.","deprecated":null,"id":"head","note":null,"stability":null,"value":"HEAD"},{"brief":"OPTIONS method.","deprecated":null,"id":"options","note":null,"stability":null,"value":"OPTIONS"},{"brief":"PATCH method.","deprecated":null,"id":"patch","note":null,"stability":null,"value":"PATCH"},{"brief":"POST method.","deprecated":null,"id":"post","note":null,"stability":null,"value":"POST"},{"brief":"PUT method.","deprecated":null,"id":"put","note":null,"stability":null,"value":"PUT"},{"brief":"TRACE method.","deprecated":null,"id":"trace","note":null,"stability":null,"value":"TRACE"},{"brief":"Any HTTP method that the instrumentation has no prior knowledge of.","deprecated":null,"id":"other","note":null,"stability":null,"value":"_OTHER"}]}},{"brief":"Original HTTP method sent by the client in the request line.","examples":["GeT","ACL","foo"],"name":"http.request.method_original","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ordinal number of request resending attempt (for any reason, including redirects).\n","examples":3,"name":"http.request.resend_count","note":"The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n","examples":3495,"name":"http.response.body.size","requirement_level":"recommended","root_namespace":"http","stability":"experimental","type":"int"},{"brief":"HTTP response headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.response.header.content-type=[\"application/json\"]","http.response.header.my-custom-header=[\"abc\", \"def\"]"],"name":"http.response.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nUsers MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).","examples":[200],"name":"http.response.status_code","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The matched route, that is, the path template in the format used by the respective server framework.\n","examples":["/users/:userID?","{controller}/{action}/{id?}"],"name":"http.route","note":"MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\nSHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"}],"root_namespace":"http"},{"attributes":[{"brief":"The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.","examples":"DE","name":"network.carrier.icc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier country code.","examples":"310","name":"network.carrier.mcc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The mobile carrier network code.","examples":"001","name":"network.carrier.mnc","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"The name of the mobile carrier.","examples":"sprint","name":"network.carrier.name","requirement_level":"recommended","root_namespace":"network","type":"string"},{"brief":"This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.","examples":"LTE","name":"network.connection.subtype","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":"GPRS","deprecated":null,"id":"gprs","note":null,"stability":null,"value":"gprs"},{"brief":"EDGE","deprecated":null,"id":"edge","note":null,"stability":null,"value":"edge"},{"brief":"UMTS","deprecated":null,"id":"umts","note":null,"stability":null,"value":"umts"},{"brief":"CDMA","deprecated":null,"id":"cdma","note":null,"stability":null,"value":"cdma"},{"brief":"EVDO Rel. 0","deprecated":null,"id":"evdo_0","note":null,"stability":null,"value":"evdo_0"},{"brief":"EVDO Rev. A","deprecated":null,"id":"evdo_a","note":null,"stability":null,"value":"evdo_a"},{"brief":"CDMA2000 1XRTT","deprecated":null,"id":"cdma2000_1xrtt","note":null,"stability":null,"value":"cdma2000_1xrtt"},{"brief":"HSDPA","deprecated":null,"id":"hsdpa","note":null,"stability":null,"value":"hsdpa"},{"brief":"HSUPA","deprecated":null,"id":"hsupa","note":null,"stability":null,"value":"hsupa"},{"brief":"HSPA","deprecated":null,"id":"hspa","note":null,"stability":null,"value":"hspa"},{"brief":"IDEN","deprecated":null,"id":"iden","note":null,"stability":null,"value":"iden"},{"brief":"EVDO Rev. B","deprecated":null,"id":"evdo_b","note":null,"stability":null,"value":"evdo_b"},{"brief":"LTE","deprecated":null,"id":"lte","note":null,"stability":null,"value":"lte"},{"brief":"EHRPD","deprecated":null,"id":"ehrpd","note":null,"stability":null,"value":"ehrpd"},{"brief":"HSPAP","deprecated":null,"id":"hspap","note":null,"stability":null,"value":"hspap"},{"brief":"GSM","deprecated":null,"id":"gsm","note":null,"stability":null,"value":"gsm"},{"brief":"TD-SCDMA","deprecated":null,"id":"td_scdma","note":null,"stability":null,"value":"td_scdma"},{"brief":"IWLAN","deprecated":null,"id":"iwlan","note":null,"stability":null,"value":"iwlan"},{"brief":"5G NR (New Radio)","deprecated":null,"id":"nr","note":null,"stability":null,"value":"nr"},{"brief":"5G NRNSA (New Radio Non-Standalone)","deprecated":null,"id":"nrnsa","note":null,"stability":null,"value":"nrnsa"},{"brief":"LTE CA","deprecated":null,"id":"lte_ca","note":null,"stability":null,"value":"lte_ca"}]}},{"brief":"The internet connection type.","examples":"wifi","name":"network.connection.type","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"wifi","note":null,"stability":null,"value":"wifi"},{"brief":null,"deprecated":null,"id":"wired","note":null,"stability":null,"value":"wired"},{"brief":null,"deprecated":null,"id":"cell","note":null,"stability":null,"value":"cell"},{"brief":null,"deprecated":null,"id":"unavailable","note":null,"stability":null,"value":"unavailable"},{"brief":null,"deprecated":null,"id":"unknown","note":null,"stability":null,"value":"unknown"}]}},{"brief":"The network IO operation direction.","examples":["transmit"],"name":"network.io.direction","requirement_level":"recommended","root_namespace":"network","type":{"allow_custom_values":false,"members":[{"brief":null,"deprecated":null,"id":"transmit","note":null,"stability":null,"value":"transmit"},{"brief":null,"deprecated":null,"id":"receive","note":null,"stability":null,"value":"receive"}]}},{"brief":"Local address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.local.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Local port number of the network connection.","examples":[65123],"name":"network.local.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"Peer address of the network connection - IP address or Unix domain socket name.","examples":["10.1.2.80","/tmp/my.sock"],"name":"network.peer.address","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Peer port number of the network connection.","examples":[65123],"name":"network.peer.port","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"int"},{"brief":"[OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent.","examples":["amqp","http","mqtt"],"name":"network.protocol.name","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"Version of the protocol specified in `network.protocol.name`.","examples":"3.1.1","name":"network.protocol.version","note":"`network.protocol.version` refers to the version of the protocol used and might be different from the protocol client\u0027s version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":"string"},{"brief":"[OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication).\n","examples":["tcp","udp"],"name":"network.transport","note":"The value SHOULD be normalized to lowercase.\n\nConsider always setting the transport when setting a port number, since\na port number is ambiguous without knowing the transport. For example\ndifferent processes could be listening on TCP port 12345 and UDP port 12345.\n","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"TCP","deprecated":null,"id":"tcp","note":null,"stability":null,"value":"tcp"},{"brief":"UDP","deprecated":null,"id":"udp","note":null,"stability":null,"value":"udp"},{"brief":"Named or anonymous pipe.","deprecated":null,"id":"pipe","note":null,"stability":null,"value":"pipe"},{"brief":"Unix domain socket","deprecated":null,"id":"unix","note":null,"stability":null,"value":"unix"}]}},{"brief":"[OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent.","examples":["ipv4","ipv6"],"name":"network.type","note":"The value SHOULD be normalized to lowercase.","requirement_level":"recommended","root_namespace":"network","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"IPv4","deprecated":null,"id":"ipv4","note":null,"stability":null,"value":"ipv4"},{"brief":"IPv6","deprecated":null,"id":"ipv6","note":null,"stability":null,"value":"ipv6"}]}}],"root_namespace":"network"},{"attributes":[{"brief":"The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component","examples":["SemConv"],"name":"url.fragment","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)","examples":["https://www.foo.bar/search?q=OpenTelemetry#SemConv","//localhost"],"name":"url.full","note":"For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.\n`url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password SHOULD be redacted and attribute\u0027s value SHOULD be `https://REDACTED:REDACTED@www.example.com/`.\n`url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes.\n","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component","examples":["/search"],"name":"url.path","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component","examples":["q=OpenTelemetry"],"name":"url.query","note":"Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it.","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"},{"brief":"The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.","examples":["https","ftp","telnet"],"name":"url.scheme","requirement_level":"recommended","root_namespace":"url","stability":"stable","type":"string"}],"root_namespace":"url"},{"attributes":[{"brief":"Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n","examples":["CERN-LineMode/2.15 libwww/2.17b3","Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1"],"name":"user_agent.original","requirement_level":"recommended","root_namespace":"user_agent","stability":"stable","type":"string"}],"root_namespace":"user_agent"}] \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes_without_experimental.json b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes_without_experimental.json index 83d7e2ed..b3113708 100644 --- a/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes_without_experimental.json +++ b/crates/weaver_forge/expected_output/semconv_jq_fn/semconv_grouped_attributes_without_experimental.json @@ -1 +1 @@ -[{"attributes":[{"brief":"The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n","name":"db.cassandra.consistency_level","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"all","note":null,"stability":null,"value":"all"},{"brief":null,"deprecated":null,"id":"each_quorum","note":null,"stability":null,"value":"each_quorum"},{"brief":null,"deprecated":null,"id":"quorum","note":null,"stability":null,"value":"quorum"},{"brief":null,"deprecated":null,"id":"local_quorum","note":null,"stability":null,"value":"local_quorum"},{"brief":null,"deprecated":null,"id":"one","note":null,"stability":null,"value":"one"},{"brief":null,"deprecated":null,"id":"two","note":null,"stability":null,"value":"two"},{"brief":null,"deprecated":null,"id":"three","note":null,"stability":null,"value":"three"},{"brief":null,"deprecated":null,"id":"local_one","note":null,"stability":null,"value":"local_one"},{"brief":null,"deprecated":null,"id":"any","note":null,"stability":null,"value":"any"},{"brief":null,"deprecated":null,"id":"serial","note":null,"stability":null,"value":"serial"},{"brief":null,"deprecated":null,"id":"local_serial","note":null,"stability":null,"value":"local_serial"}]}},{"brief":"The data center of the coordinating node for a query.\n","examples":"us-west-2","name":"db.cassandra.coordinator.dc","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The ID of the coordinating node for a query.\n","examples":"be13faa2-8574-4d71-926d-27f16cf8a7af","name":"db.cassandra.coordinator.id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"Whether or not the query is idempotent.\n","name":"db.cassandra.idempotence","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"boolean"},{"brief":"The fetch size used for paging, i.e. how many rows will be returned at once.\n","examples":[5000],"name":"db.cassandra.page_size","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n","examples":[0,2],"name":"db.cassandra.speculative_execution_count","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).","examples":"mytable","name":"db.cassandra.table","note":"This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The connection string used to connect to the database. It is recommended to remove embedded credentials.\n","examples":"Server=(localdb)\\v11.0;Integrated Security=true;","name":"db.connection_string","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"Unique Cosmos client instance id.","examples":"3ba4827d-4422-483f-b59f-85b74211c11d","name":"db.cosmosdb.client_id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"Cosmos client connection mode.","name":"db.cosmosdb.connection_mode","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":false,"members":[{"brief":"Gateway (HTTP) connections mode","deprecated":null,"id":"gateway","note":null,"stability":null,"value":"gateway"},{"brief":"Direct connection.","deprecated":null,"id":"direct","note":null,"stability":null,"value":"direct"}]}},{"brief":"Cosmos DB container name.","examples":"anystring","name":"db.cosmosdb.container","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"CosmosDB Operation Type.","name":"db.cosmosdb.operation_type","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"invalid","note":null,"stability":null,"value":"Invalid"},{"brief":null,"deprecated":null,"id":"create","note":null,"stability":null,"value":"Create"},{"brief":null,"deprecated":null,"id":"patch","note":null,"stability":null,"value":"Patch"},{"brief":null,"deprecated":null,"id":"read","note":null,"stability":null,"value":"Read"},{"brief":null,"deprecated":null,"id":"read_feed","note":null,"stability":null,"value":"ReadFeed"},{"brief":null,"deprecated":null,"id":"delete","note":null,"stability":null,"value":"Delete"},{"brief":null,"deprecated":null,"id":"replace","note":null,"stability":null,"value":"Replace"},{"brief":null,"deprecated":null,"id":"execute","note":null,"stability":null,"value":"Execute"},{"brief":null,"deprecated":null,"id":"query","note":null,"stability":null,"value":"Query"},{"brief":null,"deprecated":null,"id":"head","note":null,"stability":null,"value":"Head"},{"brief":null,"deprecated":null,"id":"head_feed","note":null,"stability":null,"value":"HeadFeed"},{"brief":null,"deprecated":null,"id":"upsert","note":null,"stability":null,"value":"Upsert"},{"brief":null,"deprecated":null,"id":"batch","note":null,"stability":null,"value":"Batch"},{"brief":null,"deprecated":null,"id":"query_plan","note":null,"stability":null,"value":"QueryPlan"},{"brief":null,"deprecated":null,"id":"execute_javascript","note":null,"stability":null,"value":"ExecuteJavaScript"}]}},{"brief":"RU consumed for that operation","examples":[46.18,1.0],"name":"db.cosmosdb.request_charge","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"double"},{"brief":"Request payload size in bytes","name":"db.cosmosdb.request_content_length","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB status code.","examples":[200,201],"name":"db.cosmosdb.status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB sub status code.","examples":[1000,1002],"name":"db.cosmosdb.sub_status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Represents the identifier of an Elasticsearch cluster.\n","examples":["e9106fc68e3044f0b1475b04bf4ffd5f"],"name":"db.elasticsearch.cluster.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"Represents the human-readable identifier of the node/instance to which a request was routed.\n","examples":["instance-0000000001"],"name":"db.elasticsearch.node.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"A dynamic value in the url path.\n","examples":["db.elasticsearch.path_parts.index=test-index","db.elasticsearch.path_parts.doc_id=123"],"name":"db.elasticsearch.path_parts","note":"Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.\u003ckey\u003e`, where `\u003ckey\u003e` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"template[string]"},{"brief":"An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.\n","examples":"mysql-e26b99z.example.com","name":"db.instance.id","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n","examples":["org.postgresql.Driver","com.microsoft.sqlserver.jdbc.SQLServerDriver"],"name":"db.jdbc.driver_classname","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-jdbc","type":"string"},{"brief":"The MongoDB collection being accessed within the database stated in `db.name`.\n","examples":["customers","products"],"name":"db.mongodb.collection","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mongodb","type":"string"},{"brief":"The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n","examples":"MSSQLSERVER","name":"db.mssql.instance_name","note":"If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mssql","type":"string"},{"brief":"This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n","examples":["customers","main"],"name":"db.name","note":"In some SQL databases, the database name to be used is called \"schema name\". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n","examples":["findAndModify","HMSET","SELECT"],"name":"db.operation","note":"When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n","examples":[0,1,15],"name":"db.redis.database_index","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-redis","type":"int"},{"brief":"The name of the primary table that the operation is acting upon, including the database name (if applicable).","examples":["public.users","customers"],"name":"db.sql.table","note":"It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-sql","type":"string"},{"brief":"The database statement being executed.\n","examples":["SELECT * FROM wuser_table","SET mykey \"WuValue\""],"name":"db.statement","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.","name":"db.system","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":{"allow_custom_values":true,"members":[{"brief":"Some other SQL database. Fallback only. See notes.","deprecated":null,"id":"other_sql","note":null,"stability":null,"value":"other_sql"},{"brief":"Microsoft SQL Server","deprecated":null,"id":"mssql","note":null,"stability":null,"value":"mssql"},{"brief":"Microsoft SQL Server Compact","deprecated":null,"id":"mssqlcompact","note":null,"stability":null,"value":"mssqlcompact"},{"brief":"MySQL","deprecated":null,"id":"mysql","note":null,"stability":null,"value":"mysql"},{"brief":"Oracle Database","deprecated":null,"id":"oracle","note":null,"stability":null,"value":"oracle"},{"brief":"IBM Db2","deprecated":null,"id":"db2","note":null,"stability":null,"value":"db2"},{"brief":"PostgreSQL","deprecated":null,"id":"postgresql","note":null,"stability":null,"value":"postgresql"},{"brief":"Amazon Redshift","deprecated":null,"id":"redshift","note":null,"stability":null,"value":"redshift"},{"brief":"Apache Hive","deprecated":null,"id":"hive","note":null,"stability":null,"value":"hive"},{"brief":"Cloudscape","deprecated":null,"id":"cloudscape","note":null,"stability":null,"value":"cloudscape"},{"brief":"HyperSQL DataBase","deprecated":null,"id":"hsqldb","note":null,"stability":null,"value":"hsqldb"},{"brief":"Progress Database","deprecated":null,"id":"progress","note":null,"stability":null,"value":"progress"},{"brief":"SAP MaxDB","deprecated":null,"id":"maxdb","note":null,"stability":null,"value":"maxdb"},{"brief":"SAP HANA","deprecated":null,"id":"hanadb","note":null,"stability":null,"value":"hanadb"},{"brief":"Ingres","deprecated":null,"id":"ingres","note":null,"stability":null,"value":"ingres"},{"brief":"FirstSQL","deprecated":null,"id":"firstsql","note":null,"stability":null,"value":"firstsql"},{"brief":"EnterpriseDB","deprecated":null,"id":"edb","note":null,"stability":null,"value":"edb"},{"brief":"InterSystems Caché","deprecated":null,"id":"cache","note":null,"stability":null,"value":"cache"},{"brief":"Adabas (Adaptable Database System)","deprecated":null,"id":"adabas","note":null,"stability":null,"value":"adabas"},{"brief":"Firebird","deprecated":null,"id":"firebird","note":null,"stability":null,"value":"firebird"},{"brief":"Apache Derby","deprecated":null,"id":"derby","note":null,"stability":null,"value":"derby"},{"brief":"FileMaker","deprecated":null,"id":"filemaker","note":null,"stability":null,"value":"filemaker"},{"brief":"Informix","deprecated":null,"id":"informix","note":null,"stability":null,"value":"informix"},{"brief":"InstantDB","deprecated":null,"id":"instantdb","note":null,"stability":null,"value":"instantdb"},{"brief":"InterBase","deprecated":null,"id":"interbase","note":null,"stability":null,"value":"interbase"},{"brief":"MariaDB","deprecated":null,"id":"mariadb","note":null,"stability":null,"value":"mariadb"},{"brief":"Netezza","deprecated":null,"id":"netezza","note":null,"stability":null,"value":"netezza"},{"brief":"Pervasive PSQL","deprecated":null,"id":"pervasive","note":null,"stability":null,"value":"pervasive"},{"brief":"PointBase","deprecated":null,"id":"pointbase","note":null,"stability":null,"value":"pointbase"},{"brief":"SQLite","deprecated":null,"id":"sqlite","note":null,"stability":null,"value":"sqlite"},{"brief":"Sybase","deprecated":null,"id":"sybase","note":null,"stability":null,"value":"sybase"},{"brief":"Teradata","deprecated":null,"id":"teradata","note":null,"stability":null,"value":"teradata"},{"brief":"Vertica","deprecated":null,"id":"vertica","note":null,"stability":null,"value":"vertica"},{"brief":"H2","deprecated":null,"id":"h2","note":null,"stability":null,"value":"h2"},{"brief":"ColdFusion IMQ","deprecated":null,"id":"coldfusion","note":null,"stability":null,"value":"coldfusion"},{"brief":"Apache Cassandra","deprecated":null,"id":"cassandra","note":null,"stability":null,"value":"cassandra"},{"brief":"Apache HBase","deprecated":null,"id":"hbase","note":null,"stability":null,"value":"hbase"},{"brief":"MongoDB","deprecated":null,"id":"mongodb","note":null,"stability":null,"value":"mongodb"},{"brief":"Redis","deprecated":null,"id":"redis","note":null,"stability":null,"value":"redis"},{"brief":"Couchbase","deprecated":null,"id":"couchbase","note":null,"stability":null,"value":"couchbase"},{"brief":"CouchDB","deprecated":null,"id":"couchdb","note":null,"stability":null,"value":"couchdb"},{"brief":"Microsoft Azure Cosmos DB","deprecated":null,"id":"cosmosdb","note":null,"stability":null,"value":"cosmosdb"},{"brief":"Amazon DynamoDB","deprecated":null,"id":"dynamodb","note":null,"stability":null,"value":"dynamodb"},{"brief":"Neo4j","deprecated":null,"id":"neo4j","note":null,"stability":null,"value":"neo4j"},{"brief":"Apache Geode","deprecated":null,"id":"geode","note":null,"stability":null,"value":"geode"},{"brief":"Elasticsearch","deprecated":null,"id":"elasticsearch","note":null,"stability":null,"value":"elasticsearch"},{"brief":"Memcached","deprecated":null,"id":"memcached","note":null,"stability":null,"value":"memcached"},{"brief":"CockroachDB","deprecated":null,"id":"cockroachdb","note":null,"stability":null,"value":"cockroachdb"},{"brief":"OpenSearch","deprecated":null,"id":"opensearch","note":null,"stability":null,"value":"opensearch"},{"brief":"ClickHouse","deprecated":null,"id":"clickhouse","note":null,"stability":null,"value":"clickhouse"},{"brief":"Cloud Spanner","deprecated":null,"id":"spanner","note":null,"stability":null,"value":"spanner"},{"brief":"Trino","deprecated":null,"id":"trino","note":null,"stability":null,"value":"trino"}]}},{"brief":"Username for accessing the database.\n","examples":["readonly_user","reporting_user"],"name":"db.user","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"}],"root_namespace":"db"},{"attributes":[{"brief":"HTTP request headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.request.header.content-type=[\"application/json\"]","http.request.header.x-forwarded-for=[\"1.2.3.4\", \"1.2.3.5\"]"],"name":"http.request.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nThe `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"HTTP request method.","examples":["GET","POST","HEAD"],"name":"http.request.method","note":"HTTP request method value SHOULD be \"known\" to the instrumentation.\nBy default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)\nand the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).\n\nIf the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.\n\nIf the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override\nthe list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named\nOTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n\nHTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.\nInstrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.\nTracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"CONNECT method.","deprecated":null,"id":"connect","note":null,"stability":null,"value":"CONNECT"},{"brief":"DELETE method.","deprecated":null,"id":"delete","note":null,"stability":null,"value":"DELETE"},{"brief":"GET method.","deprecated":null,"id":"get","note":null,"stability":null,"value":"GET"},{"brief":"HEAD method.","deprecated":null,"id":"head","note":null,"stability":null,"value":"HEAD"},{"brief":"OPTIONS method.","deprecated":null,"id":"options","note":null,"stability":null,"value":"OPTIONS"},{"brief":"PATCH method.","deprecated":null,"id":"patch","note":null,"stability":null,"value":"PATCH"},{"brief":"POST method.","deprecated":null,"id":"post","note":null,"stability":null,"value":"POST"},{"brief":"PUT method.","deprecated":null,"id":"put","note":null,"stability":null,"value":"PUT"},{"brief":"TRACE method.","deprecated":null,"id":"trace","note":null,"stability":null,"value":"TRACE"},{"brief":"Any HTTP method that the instrumentation has no prior knowledge of.","deprecated":null,"id":"other","note":null,"stability":null,"value":"_OTHER"}]}},{"brief":"Original HTTP method sent by the client in the request line.","examples":["GeT","ACL","foo"],"name":"http.request.method_original","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ordinal number of request resending attempt (for any reason, including redirects).\n","examples":3,"name":"http.request.resend_count","note":"The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"HTTP response headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.response.header.content-type=[\"application/json\"]","http.response.header.my-custom-header=[\"abc\", \"def\"]"],"name":"http.response.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nUsers MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).","examples":[200],"name":"http.response.status_code","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The matched route, that is, the path template in the format used by the respective server framework.\n","examples":["/users/:userID?","{controller}/{action}/{id?}"],"name":"http.route","note":"MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\nSHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"}],"root_namespace":"http"},{"attributes":[{"brief":"Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n","examples":["CERN-LineMode/2.15 libwww/2.17b3","Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1"],"name":"user_agent.original","requirement_level":"recommended","root_namespace":"user_agent","stability":"stable","type":"string"}],"root_namespace":"user_agent"}] \ No newline at end of file +[{"attributes":[{"brief":"The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n","name":"db.cassandra.consistency_level","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"all","note":null,"stability":null,"value":"all"},{"brief":null,"deprecated":null,"id":"each_quorum","note":null,"stability":null,"value":"each_quorum"},{"brief":null,"deprecated":null,"id":"quorum","note":null,"stability":null,"value":"quorum"},{"brief":null,"deprecated":null,"id":"local_quorum","note":null,"stability":null,"value":"local_quorum"},{"brief":null,"deprecated":null,"id":"one","note":null,"stability":null,"value":"one"},{"brief":null,"deprecated":null,"id":"two","note":null,"stability":null,"value":"two"},{"brief":null,"deprecated":null,"id":"three","note":null,"stability":null,"value":"three"},{"brief":null,"deprecated":null,"id":"local_one","note":null,"stability":null,"value":"local_one"},{"brief":null,"deprecated":null,"id":"any","note":null,"stability":null,"value":"any"},{"brief":null,"deprecated":null,"id":"serial","note":null,"stability":null,"value":"serial"},{"brief":null,"deprecated":null,"id":"local_serial","note":null,"stability":null,"value":"local_serial"}]}},{"brief":"The data center of the coordinating node for a query.\n","examples":"us-west-2","name":"db.cassandra.coordinator.dc","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The ID of the coordinating node for a query.\n","examples":"be13faa2-8574-4d71-926d-27f16cf8a7af","name":"db.cassandra.coordinator.id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"Whether or not the query is idempotent.\n","name":"db.cassandra.idempotence","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"boolean"},{"brief":"The fetch size used for paging, i.e. how many rows will be returned at once.\n","examples":[5000],"name":"db.cassandra.page_size","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n","examples":[0,2],"name":"db.cassandra.speculative_execution_count","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"int"},{"brief":"The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).","examples":"mytable","name":"db.cassandra.table","note":"This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cassandra","type":"string"},{"brief":"The connection string used to connect to the database. It is recommended to remove embedded credentials.\n","examples":"Server=(localdb)\\v11.0;Integrated Security=true;","name":"db.connection_string","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"Unique Cosmos client instance id.","examples":"3ba4827d-4422-483f-b59f-85b74211c11d","name":"db.cosmosdb.client_id","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"Cosmos client connection mode.","name":"db.cosmosdb.connection_mode","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":false,"members":[{"brief":"Gateway (HTTP) connections mode","deprecated":null,"id":"gateway","note":null,"stability":null,"value":"gateway"},{"brief":"Direct connection.","deprecated":null,"id":"direct","note":null,"stability":null,"value":"direct"}]}},{"brief":"Cosmos DB container name.","examples":"anystring","name":"db.cosmosdb.container","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"string"},{"brief":"CosmosDB Operation Type.","name":"db.cosmosdb.operation_type","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":{"allow_custom_values":true,"members":[{"brief":null,"deprecated":null,"id":"invalid","note":null,"stability":null,"value":"Invalid"},{"brief":null,"deprecated":null,"id":"create","note":null,"stability":null,"value":"Create"},{"brief":null,"deprecated":null,"id":"patch","note":null,"stability":null,"value":"Patch"},{"brief":null,"deprecated":null,"id":"read","note":null,"stability":null,"value":"Read"},{"brief":null,"deprecated":null,"id":"read_feed","note":null,"stability":null,"value":"ReadFeed"},{"brief":null,"deprecated":null,"id":"delete","note":null,"stability":null,"value":"Delete"},{"brief":null,"deprecated":null,"id":"replace","note":null,"stability":null,"value":"Replace"},{"brief":null,"deprecated":null,"id":"execute","note":null,"stability":null,"value":"Execute"},{"brief":null,"deprecated":null,"id":"query","note":null,"stability":null,"value":"Query"},{"brief":null,"deprecated":null,"id":"head","note":null,"stability":null,"value":"Head"},{"brief":null,"deprecated":null,"id":"head_feed","note":null,"stability":null,"value":"HeadFeed"},{"brief":null,"deprecated":null,"id":"upsert","note":null,"stability":null,"value":"Upsert"},{"brief":null,"deprecated":null,"id":"batch","note":null,"stability":null,"value":"Batch"},{"brief":null,"deprecated":null,"id":"query_plan","note":null,"stability":null,"value":"QueryPlan"},{"brief":null,"deprecated":null,"id":"execute_javascript","note":null,"stability":null,"value":"ExecuteJavaScript"}]}},{"brief":"RU consumed for that operation","examples":[46.18,1.0],"name":"db.cosmosdb.request_charge","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"double"},{"brief":"Request payload size in bytes","name":"db.cosmosdb.request_content_length","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB status code.","examples":[200,201],"name":"db.cosmosdb.status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Cosmos DB sub status code.","examples":[1000,1002],"name":"db.cosmosdb.sub_status_code","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-cosmosdb","type":"int"},{"brief":"Represents the identifier of an Elasticsearch cluster.\n","examples":["e9106fc68e3044f0b1475b04bf4ffd5f"],"name":"db.elasticsearch.cluster.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"Represents the human-readable identifier of the node/instance to which a request was routed.\n","examples":["instance-0000000001"],"name":"db.elasticsearch.node.name","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"string"},{"brief":"A dynamic value in the url path.\n","examples":["db.elasticsearch.path_parts.index=test-index","db.elasticsearch.path_parts.doc_id=123"],"name":"db.elasticsearch.path_parts","note":"Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.\u003ckey\u003e`, where `\u003ckey\u003e` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-elasticsearch","type":"template[string]"},{"brief":"An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.\n","examples":"mysql-e26b99z.example.com","name":"db.instance.id","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n","examples":["org.postgresql.Driver","com.microsoft.sqlserver.jdbc.SQLServerDriver"],"name":"db.jdbc.driver_classname","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-jdbc","type":"string"},{"brief":"The MongoDB collection being accessed within the database stated in `db.name`.\n","examples":["customers","products"],"name":"db.mongodb.collection","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mongodb","type":"string"},{"brief":"The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n","examples":"MSSQLSERVER","name":"db.mssql.instance_name","note":"If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-mssql","type":"string"},{"brief":"This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n","examples":["customers","main"],"name":"db.name","note":"In some SQL databases, the database name to be used is called \"schema name\". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n","examples":["findAndModify","HMSET","SELECT"],"name":"db.operation","note":"When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n","examples":[0,1,15],"name":"db.redis.database_index","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-redis","type":"int"},{"brief":"The name of the primary table that the operation is acting upon, including the database name (if applicable).","examples":["public.users","customers"],"name":"db.sql.table","note":"It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n","requirement_level":"recommended","root_namespace":"db","tag":"tech-specific-sql","type":"string"},{"brief":"The database statement being executed.\n","examples":["SELECT * FROM wuser_table","SET mykey \"WuValue\""],"name":"db.statement","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"},{"brief":"An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.","name":"db.system","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":{"allow_custom_values":true,"members":[{"brief":"Some other SQL database. Fallback only. See notes.","deprecated":null,"id":"other_sql","note":null,"stability":null,"value":"other_sql"},{"brief":"Microsoft SQL Server","deprecated":null,"id":"mssql","note":null,"stability":null,"value":"mssql"},{"brief":"Microsoft SQL Server Compact","deprecated":null,"id":"mssqlcompact","note":null,"stability":null,"value":"mssqlcompact"},{"brief":"MySQL","deprecated":null,"id":"mysql","note":null,"stability":null,"value":"mysql"},{"brief":"Oracle Database","deprecated":null,"id":"oracle","note":null,"stability":null,"value":"oracle"},{"brief":"IBM Db2","deprecated":null,"id":"db2","note":null,"stability":null,"value":"db2"},{"brief":"PostgreSQL","deprecated":null,"id":"postgresql","note":null,"stability":null,"value":"postgresql"},{"brief":"Amazon Redshift","deprecated":null,"id":"redshift","note":null,"stability":null,"value":"redshift"},{"brief":"Apache Hive","deprecated":null,"id":"hive","note":null,"stability":null,"value":"hive"},{"brief":"Cloudscape","deprecated":null,"id":"cloudscape","note":null,"stability":null,"value":"cloudscape"},{"brief":"HyperSQL DataBase","deprecated":null,"id":"hsqldb","note":null,"stability":null,"value":"hsqldb"},{"brief":"Progress Database","deprecated":null,"id":"progress","note":null,"stability":null,"value":"progress"},{"brief":"SAP MaxDB","deprecated":null,"id":"maxdb","note":null,"stability":null,"value":"maxdb"},{"brief":"SAP HANA","deprecated":null,"id":"hanadb","note":null,"stability":null,"value":"hanadb"},{"brief":"Ingres","deprecated":null,"id":"ingres","note":null,"stability":null,"value":"ingres"},{"brief":"FirstSQL","deprecated":null,"id":"firstsql","note":null,"stability":null,"value":"firstsql"},{"brief":"EnterpriseDB","deprecated":null,"id":"edb","note":null,"stability":null,"value":"edb"},{"brief":"InterSystems Caché","deprecated":null,"id":"cache","note":null,"stability":null,"value":"cache"},{"brief":"Adabas (Adaptable Database System)","deprecated":null,"id":"adabas","note":null,"stability":null,"value":"adabas"},{"brief":"Firebird","deprecated":null,"id":"firebird","note":null,"stability":null,"value":"firebird"},{"brief":"Apache Derby","deprecated":null,"id":"derby","note":null,"stability":null,"value":"derby"},{"brief":"FileMaker","deprecated":null,"id":"filemaker","note":null,"stability":null,"value":"filemaker"},{"brief":"Informix","deprecated":null,"id":"informix","note":null,"stability":null,"value":"informix"},{"brief":"InstantDB","deprecated":null,"id":"instantdb","note":null,"stability":null,"value":"instantdb"},{"brief":"InterBase","deprecated":null,"id":"interbase","note":null,"stability":null,"value":"interbase"},{"brief":"MariaDB","deprecated":null,"id":"mariadb","note":null,"stability":null,"value":"mariadb"},{"brief":"Netezza","deprecated":null,"id":"netezza","note":null,"stability":null,"value":"netezza"},{"brief":"Pervasive PSQL","deprecated":null,"id":"pervasive","note":null,"stability":null,"value":"pervasive"},{"brief":"PointBase","deprecated":null,"id":"pointbase","note":null,"stability":null,"value":"pointbase"},{"brief":"SQLite","deprecated":null,"id":"sqlite","note":null,"stability":null,"value":"sqlite"},{"brief":"Sybase","deprecated":null,"id":"sybase","note":null,"stability":null,"value":"sybase"},{"brief":"Teradata","deprecated":null,"id":"teradata","note":null,"stability":null,"value":"teradata"},{"brief":"Vertica","deprecated":null,"id":"vertica","note":null,"stability":null,"value":"vertica"},{"brief":"H2","deprecated":null,"id":"h2","note":null,"stability":null,"value":"h2"},{"brief":"ColdFusion IMQ","deprecated":null,"id":"coldfusion","note":null,"stability":null,"value":"coldfusion"},{"brief":"Apache Cassandra","deprecated":null,"id":"cassandra","note":null,"stability":null,"value":"cassandra"},{"brief":"Apache HBase","deprecated":null,"id":"hbase","note":null,"stability":null,"value":"hbase"},{"brief":"MongoDB","deprecated":null,"id":"mongodb","note":null,"stability":null,"value":"mongodb"},{"brief":"Redis","deprecated":null,"id":"redis","note":null,"stability":null,"value":"redis"},{"brief":"Couchbase","deprecated":null,"id":"couchbase","note":null,"stability":null,"value":"couchbase"},{"brief":"CouchDB","deprecated":null,"id":"couchdb","note":null,"stability":null,"value":"couchdb"},{"brief":"Microsoft Azure Cosmos DB","deprecated":null,"id":"cosmosdb","note":null,"stability":null,"value":"cosmosdb"},{"brief":"Amazon DynamoDB","deprecated":null,"id":"dynamodb","note":null,"stability":null,"value":"dynamodb"},{"brief":"Neo4j","deprecated":null,"id":"neo4j","note":null,"stability":null,"value":"neo4j"},{"brief":"Apache Geode","deprecated":null,"id":"geode","note":null,"stability":null,"value":"geode"},{"brief":"Elasticsearch","deprecated":null,"id":"elasticsearch","note":null,"stability":null,"value":"elasticsearch"},{"brief":"Memcached","deprecated":null,"id":"memcached","note":null,"stability":null,"value":"memcached"},{"brief":"CockroachDB","deprecated":null,"id":"cockroachdb","note":null,"stability":null,"value":"cockroachdb"},{"brief":"OpenSearch","deprecated":null,"id":"opensearch","note":null,"stability":null,"value":"opensearch"},{"brief":"ClickHouse","deprecated":null,"id":"clickhouse","note":null,"stability":null,"value":"clickhouse"},{"brief":"Cloud Spanner","deprecated":null,"id":"spanner","note":null,"stability":null,"value":"spanner"},{"brief":"Trino","deprecated":null,"id":"trino","note":null,"stability":null,"value":"trino"}]}},{"brief":"Username for accessing the database.\n","examples":["readonly_user","reporting_user"],"name":"db.user","requirement_level":"recommended","root_namespace":"db","tag":"db-generic","type":"string"}],"root_namespace":"db"},{"attributes":[{"brief":"SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n","name":"exception.escaped","note":"An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically \"in flight\".\nThis may be actually \"in flight\" in some languages (e.g. if the exception\nis passed to a Context manager\u0027s `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"boolean"},{"brief":"The exception message.","examples":["Division by zero","Can\u0027t convert \u0027int\u0027 object to str implicitly"],"name":"exception.message","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n","examples":"Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)","name":"exception.stacktrace","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"},{"brief":"The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n","examples":["java.net.ConnectException","OSError"],"name":"exception.type","requirement_level":"recommended","root_namespace":"exception","stability":"stable","type":"string"}],"root_namespace":"exception"},{"attributes":[{"brief":"HTTP request headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.request.header.content-type=[\"application/json\"]","http.request.header.x-forwarded-for=[\"1.2.3.4\", \"1.2.3.5\"]"],"name":"http.request.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nThe `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"HTTP request method.","examples":["GET","POST","HEAD"],"name":"http.request.method","note":"HTTP request method value SHOULD be \"known\" to the instrumentation.\nBy default, this convention defines \"known\" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)\nand the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).\n\nIf the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.\n\nIf the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override\nthe list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named\nOTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods\n(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).\n\nHTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.\nInstrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.\nTracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":{"allow_custom_values":true,"members":[{"brief":"CONNECT method.","deprecated":null,"id":"connect","note":null,"stability":null,"value":"CONNECT"},{"brief":"DELETE method.","deprecated":null,"id":"delete","note":null,"stability":null,"value":"DELETE"},{"brief":"GET method.","deprecated":null,"id":"get","note":null,"stability":null,"value":"GET"},{"brief":"HEAD method.","deprecated":null,"id":"head","note":null,"stability":null,"value":"HEAD"},{"brief":"OPTIONS method.","deprecated":null,"id":"options","note":null,"stability":null,"value":"OPTIONS"},{"brief":"PATCH method.","deprecated":null,"id":"patch","note":null,"stability":null,"value":"PATCH"},{"brief":"POST method.","deprecated":null,"id":"post","note":null,"stability":null,"value":"POST"},{"brief":"PUT method.","deprecated":null,"id":"put","note":null,"stability":null,"value":"PUT"},{"brief":"TRACE method.","deprecated":null,"id":"trace","note":null,"stability":null,"value":"TRACE"},{"brief":"Any HTTP method that the instrumentation has no prior knowledge of.","deprecated":null,"id":"other","note":null,"stability":null,"value":"_OTHER"}]}},{"brief":"Original HTTP method sent by the client in the request line.","examples":["GeT","ACL","foo"],"name":"http.request.method_original","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"},{"brief":"The ordinal number of request resending attempt (for any reason, including redirects).\n","examples":3,"name":"http.request.resend_count","note":"The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"HTTP response headers, `\u003ckey\u003e` being the normalized HTTP Header name (lowercase), the value being the header values.\n","examples":["http.response.header.content-type=[\"application/json\"]","http.response.header.my-custom-header=[\"abc\", \"def\"]"],"name":"http.response.header","note":"Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.\nUsers MAY explicitly configure instrumentations to capture them even though it is not recommended.\nThe attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.\n","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"template[string[]]"},{"brief":"[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).","examples":[200],"name":"http.response.status_code","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"int"},{"brief":"The matched route, that is, the path template in the format used by the respective server framework.\n","examples":["/users/:userID?","{controller}/{action}/{id?}"],"name":"http.route","note":"MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.\nSHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.","requirement_level":"recommended","root_namespace":"http","stability":"stable","type":"string"}],"root_namespace":"http"},{"attributes":[{"brief":"Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.\n","examples":["CERN-LineMode/2.15 libwww/2.17b3","Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1"],"name":"user_agent.original","requirement_level":"recommended","root_namespace":"user_agent","stability":"stable","type":"string"}],"root_namespace":"user_agent"}] \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/test/attribute_group/exception.md b/crates/weaver_forge/expected_output/test/attribute_group/exception.md new file mode 100644 index 00000000..005f1c33 --- /dev/null +++ b/crates/weaver_forge/expected_output/test/attribute_group/exception.md @@ -0,0 +1,79 @@ +## Namespace `exception` + +### Attributes + + +#### Attribute `exception.escaped` + +SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. + + +An exception is considered to have escaped (or left) the scope of a span, +if that span is ended while the exception is still logically "in flight". +This may be actually "in flight" in some languages (e.g. if the exception +is passed to a Context manager's `__exit__` method in Python) but will +usually be caught at the point of recording the exception in most languages. + +It is usually not possible to determine at the point where an exception is thrown +whether it will escape the scope of a span. +However, it is trivial to know that an exception +will escape, if one checks for an active exception just before ending the span, +as done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). + +It follows that an exception may still escape the scope of the span +even if the `exception.escaped` attribute was not set or set to false, +since the event might have been recorded at a time where it was not +clear whether the exception will escape. + +- Requirement Level: Recommended + +- Type: boolean + +- Stability: Stable + + +#### Attribute `exception.message` + +The exception message. + + +- Requirement Level: Recommended + +- Type: string +- Examples: [ + "Division by zero", + "Can't convert 'int' object to str implicitly", +] + +- Stability: Stable + + +#### Attribute `exception.stacktrace` + +A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + + +- Requirement Level: Recommended + +- Type: string +- Examples: Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5) + +- Stability: Stable + + +#### Attribute `exception.type` + +The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + + +- Requirement Level: Recommended + +- Type: string +- Examples: [ + "java.net.ConnectException", + "OSError", +] + +- Stability: Stable + + \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/test/attribute_groups.md b/crates/weaver_forge/expected_output/test/attribute_groups.md index e831b7ca..e48c279f 100644 --- a/crates/weaver_forge/expected_output/test/attribute_groups.md +++ b/crates/weaver_forge/expected_output/test/attribute_groups.md @@ -472,6 +472,89 @@ Username for accessing the database. +## Namespace `exception` + +### Attributes + + +#### Attribute `exception.escaped` + +SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. + + + +An exception is considered to have escaped (or left) the scope of a span, +if that span is ended while the exception is still logically "in flight". +This may be actually "in flight" in some languages (e.g. if the exception +is passed to a Context manager's `__exit__` method in Python) but will +usually be caught at the point of recording the exception in most languages. + +It is usually not possible to determine at the point where an exception is thrown +whether it will escape the scope of a span. +However, it is trivial to know that an exception +will escape, if one checks for an active exception just before ending the span, +as done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). + +It follows that an exception may still escape the scope of the span +even if the `exception.escaped` attribute was not set or set to false, +since the event might have been recorded at a time where it was not +clear whether the exception will escape. + +- Requirement Level: Recommended + +- Type: boolean + +- Stability: Stable + + +#### Attribute `exception.message` + +The exception message. + + +- Requirement Level: Recommended + +- Type: string +- Examples: [ + "Division by zero", + "Can't convert 'int' object to str implicitly", +] + +- Stability: Stable + + +#### Attribute `exception.stacktrace` + +A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + + + +- Requirement Level: Recommended + +- Type: string +- Examples: Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5) + +- Stability: Stable + + +#### Attribute `exception.type` + +The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + + + +- Requirement Level: Recommended + +- Type: string +- Examples: [ + "java.net.ConnectException", + "OSError", +] + +- Stability: Stable + + + ## Namespace `http` ### Attributes diff --git a/crates/weaver_forge/expected_output/test/event/device_app.md b/crates/weaver_forge/expected_output/test/event/device_app.md new file mode 100644 index 00000000..aee2a21d --- /dev/null +++ b/crates/weaver_forge/expected_output/test/event/device_app.md @@ -0,0 +1,16 @@ +## Events Namespace `device.app` + + +## Event `device.app.lifecycle` + +Note: This event identifies the fields that are common to all lifecycle events for android and iOS using the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are mutually exclusive. + +Brief: This event represents an occurrence of a lifecycle transition on Android or iOS platform. + +Requirement level: +Stability: experimental + +### Attributes + + + \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/test/event/lifecycle.md b/crates/weaver_forge/expected_output/test/event/lifecycle.md deleted file mode 100644 index 456ecbc5..00000000 --- a/crates/weaver_forge/expected_output/test/event/lifecycle.md +++ /dev/null @@ -1,57 +0,0 @@ -## Events Namespace `lifecycle` - - -## Event `device.app.lifecycle` - -Note: -Brief: This event represents an occurrence of a lifecycle transition on the iOS platform. - -Requirement level: -Stability: - -### Attributes - - -#### Attribute `ios.state` - -This attribute represents the state the application has transitioned into at the occurrence of the event. - - - -The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived. - -- Requirement Level: Required - -- Type: Enum [active, inactive, background, foreground, terminate] - -- Stability: Experimental - - - -## Event `device.app.lifecycle` - -Note: -Brief: This event represents an occurrence of a lifecycle transition on the Android platform. - -Requirement level: -Stability: - -### Attributes - - -#### Attribute `android.state` - -This attribute represents the state the application has transitioned into at the occurrence of the event. - - - -The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived. - -- Requirement Level: Required - -- Type: Enum [created, background, foreground] - -- Stability: Experimental - - - \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/test/event/other.md b/crates/weaver_forge/expected_output/test/event/other.md new file mode 100644 index 00000000..98a1a84e --- /dev/null +++ b/crates/weaver_forge/expected_output/test/event/other.md @@ -0,0 +1,92 @@ +## Events Namespace `other` + + +## Event `trace-exception` + +Note: +Brief: This document defines the attributes used to report a single exception associated with a span. + +Requirement level: +Stability: + +### Attributes + + +#### Attribute `exception.stacktrace` + +A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + + + +- Requirement Level: Recommended + +- Type: string +- Examples: Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5) + +- Stability: Stable + + +#### Attribute `exception.escaped` + +SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. + + + +An exception is considered to have escaped (or left) the scope of a span, +if that span is ended while the exception is still logically "in flight". +This may be actually "in flight" in some languages (e.g. if the exception +is passed to a Context manager's `__exit__` method in Python) but will +usually be caught at the point of recording the exception in most languages. + +It is usually not possible to determine at the point where an exception is thrown +whether it will escape the scope of a span. +However, it is trivial to know that an exception +will escape, if one checks for an active exception just before ending the span, +as done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). + +It follows that an exception may still escape the scope of the span +even if the `exception.escaped` attribute was not set or set to false, +since the event might have been recorded at a time where it was not +clear whether the exception will escape. + +- Requirement Level: Recommended + +- Type: boolean + +- Stability: Stable + + +#### Attribute `exception.type` + +The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + + + +- Requirement Level: Conditionally Required - Required if `exception.message` is not set, recommended otherwise. + +- Type: string +- Examples: [ + "java.net.ConnectException", + "OSError", +] + +- Stability: Stable + + +#### Attribute `exception.message` + +The exception message. + + +- Requirement Level: Conditionally Required - Required if `exception.type` is not set, recommended otherwise. + +- Type: string +- Examples: [ + "Division by zero", + "Can't convert 'int' object to str implicitly", +] + +- Stability: Stable + + + \ No newline at end of file diff --git a/crates/weaver_forge/expected_output/test/events.md b/crates/weaver_forge/expected_output/test/events.md index 3f6033f1..75e2d7fe 100644 --- a/crates/weaver_forge/expected_output/test/events.md +++ b/crates/weaver_forge/expected_output/test/events.md @@ -1,11 +1,28 @@ -# Events Namespace `lifecycle` +# Events Namespace `device.app` ## Event `device.app.lifecycle` +Note: This event identifies the fields that are common to all lifecycle events for android and iOS using the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are mutually exclusive. + +Brief: This event represents an occurrence of a lifecycle transition on Android or iOS platform. + +Requirement level: +Stability: experimental + +### Attributes + + + + +# Events Namespace `other` + + +## Event `trace-exception` + Note: -Brief: This event represents an occurrence of a lifecycle transition on the iOS platform. +Brief: This document defines the attributes used to report a single exception associated with a span. Requirement level: Stability: @@ -13,46 +30,81 @@ Stability: ### Attributes -#### Attribute `ios.state` +#### Attribute `exception.stacktrace` -This attribute represents the state the application has transitioned into at the occurrence of the event. +A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. -The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived. - -- Requirement Level: Required - -- Type: Enum [active, inactive, background, foreground, terminate] +- Requirement Level: Recommended -- Stability: Experimental +- Type: string +- Examples: Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5) +- Stability: Stable -## Event `device.app.lifecycle` +#### Attribute `exception.escaped` -Note: -Brief: This event represents an occurrence of a lifecycle transition on the Android platform. +SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. -Requirement level: -Stability: -### Attributes +An exception is considered to have escaped (or left) the scope of a span, +if that span is ended while the exception is still logically "in flight". +This may be actually "in flight" in some languages (e.g. if the exception +is passed to a Context manager's `__exit__` method in Python) but will +usually be caught at the point of recording the exception in most languages. + +It is usually not possible to determine at the point where an exception is thrown +whether it will escape the scope of a span. +However, it is trivial to know that an exception +will escape, if one checks for an active exception just before ending the span, +as done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). -#### Attribute `android.state` +It follows that an exception may still escape the scope of the span +even if the `exception.escaped` attribute was not set or set to false, +since the event might have been recorded at a time where it was not +clear whether the exception will escape. -This attribute represents the state the application has transitioned into at the occurrence of the event. +- Requirement Level: Recommended + +- Type: boolean + +- Stability: Stable + + +#### Attribute `exception.type` +The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + + + +- Requirement Level: Conditionally Required - Required if `exception.message` is not set, recommended otherwise. + +- Type: string +- Examples: [ + "java.net.ConnectException", + "OSError", +] + +- Stability: Stable + + +#### Attribute `exception.message` +The exception message. -The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived. -- Requirement Level: Required +- Requirement Level: Conditionally Required - Required if `exception.type` is not set, recommended otherwise. -- Type: Enum [created, background, foreground] +- Type: string +- Examples: [ + "Division by zero", + "Can't convert 'int' object to str implicitly", +] -- Stability: Experimental +- Stability: Stable diff --git a/crates/weaver_forge/expected_output/test/registry.md b/crates/weaver_forge/expected_output/test/registry.md index e26e8cc5..e362df68 100644 --- a/crates/weaver_forge/expected_output/test/registry.md +++ b/crates/weaver_forge/expected_output/test/registry.md @@ -4,6 +4,7 @@ Url: # Attribute Groups +- [registry.exception](attribute_group/registry_exception.md) - [attributes.jvm.memory](attribute_group/attributes_jvm_memory.md) - [registry.db](attribute_group/registry_db.md) - [registry.http](attribute_group/registry_http.md) @@ -14,8 +15,8 @@ Url: # Events -- [ios.lifecycle.events](event/ios_lifecycle_events.md) -- [android.lifecycle.events](event/android_lifecycle_events.md) +- [device.app.lifecycle](event/device_app_lifecycle.md) +- [trace-exception](event/trace_exception.md) # Metrics diff --git a/crates/weaver_forge/expected_output/whitespace_control/registry.md b/crates/weaver_forge/expected_output/whitespace_control/registry.md index e2d11600..d1f6bb78 100644 --- a/crates/weaver_forge/expected_output/whitespace_control/registry.md +++ b/crates/weaver_forge/expected_output/whitespace_control/registry.md @@ -4,6 +4,7 @@ Url: ## Attribute Groups +- [registry.exception](attribute_group/registry_exception.md) - [attributes.jvm.memory](attribute_group/attributes_jvm_memory.md) - [registry.db](attribute_group/registry_db.md) - [registry.http](attribute_group/registry_http.md) @@ -14,8 +15,8 @@ Url: ## Events -- [ios.lifecycle.events](event/ios_lifecycle_events.md) -- [android.lifecycle.events](event/android_lifecycle_events.md) +- [device.app.lifecycle](event/device_app_lifecycle.md) +- [trace-exception](event/trace_exception.md) ## Metrics diff --git a/crates/weaver_forge/src/registry.rs b/crates/weaver_forge/src/registry.rs index 07cc629d..5d46ecd7 100644 --- a/crates/weaver_forge/src/registry.rs +++ b/crates/weaver_forge/src/registry.rs @@ -11,6 +11,7 @@ use weaver_resolved_schema::attribute::Attribute; use weaver_resolved_schema::catalog::Catalog; use weaver_resolved_schema::lineage::GroupLineage; use weaver_resolved_schema::registry::{Constraint, Group, Registry}; +use weaver_semconv::any_value::AnyValueSpec; use weaver_semconv::group::{GroupType, InstrumentSpec, SpanKindSpec}; use weaver_semconv::stability::Stability; @@ -104,6 +105,9 @@ pub struct ResolvedGroup { /// The readable name for attribute groups used when generating registry tables. #[serde(skip_serializing_if = "Option::is_none")] pub display_name: Option, + /// The body specification used for event semantic conventions. + #[serde(skip_serializing_if = "Option::is_none")] + pub body: Option, } impl ResolvedGroup { @@ -134,6 +138,7 @@ impl ResolvedGroup { }) .collect(); let lineage = group.lineage.clone(); + if !errors.is_empty() { return Err(Error::CompoundError(errors)); } @@ -156,6 +161,7 @@ impl ResolvedGroup { name: group.name.clone(), lineage, display_name: group.display_name.clone(), + body: group.body.clone(), }) } } @@ -196,6 +202,7 @@ impl ResolvedRegistry { }) .collect(); let lineage = group.lineage.clone(); + ResolvedGroup { id, r#type: group_type, @@ -215,6 +222,7 @@ impl ResolvedRegistry { name: group.name.clone(), lineage, display_name: group.display_name.clone(), + body: group.body.clone(), } }) .collect(); diff --git a/crates/weaver_forge/templates/semconv_jq_fn/semconv_events.json b/crates/weaver_forge/templates/semconv_jq_fn/semconv_events.json new file mode 100644 index 00000000..760f1e67 --- /dev/null +++ b/crates/weaver_forge/templates/semconv_jq_fn/semconv_events.json @@ -0,0 +1 @@ +{{ ctx | tojson }} \ No newline at end of file diff --git a/crates/weaver_forge/templates/semconv_jq_fn/weaver.yaml b/crates/weaver_forge/templates/semconv_jq_fn/weaver.yaml index bd76963c..387094cc 100644 --- a/crates/weaver_forge/templates/semconv_jq_fn/weaver.yaml +++ b/crates/weaver_forge/templates/semconv_jq_fn/weaver.yaml @@ -20,3 +20,12 @@ templates: filter: > semconv_grouped_metrics({"exclude_stability": ["experimental"]}) application_mode: single + - pattern: semconv_events.json + filter: > + .groups + | map(select(.type == "event")) + | map(. + { + event_namespace: (if .id | index(".") then (.id | split(".") | .[0:-1] | join(".")) else "other" end) + }) + | sort_by(.event_namespace, .id) + application_mode: single diff --git a/crates/weaver_forge/templates/test/event.md b/crates/weaver_forge/templates/test/event.md index b15e5680..c4bebd2b 100644 --- a/crates/weaver_forge/templates/test/event.md +++ b/crates/weaver_forge/templates/test/event.md @@ -1,10 +1,10 @@ -{%- set file_name = ctx.root_namespace | snake_case -%} +{%- set file_name = ctx.event_namespace | snake_case -%} {{- template.set_file_name("event/" ~ file_name ~ ".md") -}} -## Events Namespace `{{ ctx.root_namespace }}` +## Events Namespace `{{ ctx.event_namespace }}` {% for event in ctx.events %} -## Event `{{ event.name }}` +## Event `{{ event.id }}` Note: {{ event.note }} Brief: {{ event.brief }} diff --git a/crates/weaver_forge/templates/test/events.md b/crates/weaver_forge/templates/test/events.md index d8bba381..ac4d85cb 100644 --- a/crates/weaver_forge/templates/test/events.md +++ b/crates/weaver_forge/templates/test/events.md @@ -1,8 +1,8 @@ {% for grouped_events in ctx %} -# Events Namespace `{{ grouped_events.root_namespace }}` +# Events Namespace `{{ grouped_events.event_namespace }}` {% for event in grouped_events.events %} -## Event `{{ event.name }}` +## Event `{{ event.id }}` Note: {{ event.note }} Brief: {{ event.brief }} diff --git a/crates/weaver_forge/templates/test/weaver.yaml b/crates/weaver_forge/templates/test/weaver.yaml index 228b389a..6f036fa4 100644 --- a/crates/weaver_forge/templates/test/weaver.yaml +++ b/crates/weaver_forge/templates/test/weaver.yaml @@ -28,15 +28,25 @@ templates: application_mode: single - template: "**/event.md" filter: > - semconv_signal("event"; {}) - | group_by(.root_namespace) - | map({ root_namespace: .[0].root_namespace, events: . | sort_by(.name) }) + .groups + | map(select(.type == "event")) + | map(. + { + event_namespace: (if .id | index(".") then (.id | split(".") | .[0:-1] | join(".")) else "other" end) + }) + | sort_by(.event_namespace, .id) + | group_by(.event_namespace) + | map({ event_namespace: .[0].event_namespace, events: . | sort_by(.id) }) application_mode: each - template: "**/events.md" filter: > - semconv_signal("event"; {}) - | group_by(.root_namespace) - | map({ root_namespace: .[0].root_namespace, events: . | sort_by(.name) }) + .groups + | map(select(.type == "event")) + | map(. + { + event_namespace: (if .id | index(".") then (.id | split(".") | .[0:-1] | join(".")) else "other" end) + }) + | sort_by(.event_namespace, .id) + | group_by(.event_namespace) + | map({ event_namespace: .[0].event_namespace, events: . | sort_by(.id) }) application_mode: single - template: "**/metric.md" filter: semconv_grouped_metrics diff --git a/crates/weaver_resolved_schema/src/error.rs b/crates/weaver_resolved_schema/src/error.rs index f38f43ff..58e8d23c 100644 --- a/crates/weaver_resolved_schema/src/error.rs +++ b/crates/weaver_resolved_schema/src/error.rs @@ -2,11 +2,13 @@ //! Error types and utilities. +use serde::{Deserialize, Serialize}; + use crate::attribute::AttributeRef; use crate::error::Error::{AttributeNotFound, CompoundError}; /// Errors emitted by this crate. -#[derive(thiserror::Error, Debug, Clone)] +#[derive(thiserror::Error, Debug, Clone, Deserialize, Serialize)] pub enum Error { /// Attribute reference not found in the catalog. #[error("Attribute reference {attr_ref} (group: {group_id}) not found in the catalog")] @@ -35,6 +37,7 @@ pub fn handle_errors(errors: Vec) -> Result<(), Error> { impl Error { /// Creates a compound error from a list of errors. /// Note: All compound errors are flattened. + #[must_use] pub fn compound_error(errors: Vec) -> Self { CompoundError( errors diff --git a/crates/weaver_resolved_schema/src/lib.rs b/crates/weaver_resolved_schema/src/lib.rs index 61ed0ed7..f7e1793c 100644 --- a/crates/weaver_resolved_schema/src/lib.rs +++ b/crates/weaver_resolved_schema/src/lib.rs @@ -15,7 +15,7 @@ use weaver_version::Versions; pub mod attribute; pub mod catalog; -mod error; +pub mod error; pub mod instrumentation_library; pub mod lineage; pub mod metric; diff --git a/crates/weaver_resolved_schema/src/registry.rs b/crates/weaver_resolved_schema/src/registry.rs index c41fc405..e0d07ef3 100644 --- a/crates/weaver_resolved_schema/src/registry.rs +++ b/crates/weaver_resolved_schema/src/registry.rs @@ -6,6 +6,7 @@ use schemars::JsonSchema; use std::collections::{BTreeMap, HashMap, HashSet}; +use weaver_semconv::any_value::AnyValueSpec; use serde::{Deserialize, Serialize}; @@ -126,6 +127,10 @@ pub struct Group { /// The readable name for attribute groups used when generating registry tables. #[serde(skip_serializing_if = "Option::is_none")] pub display_name: Option, + /// The body of the event. + /// This fields is only used for event groups. + #[serde(skip_serializing_if = "Option::is_none")] + pub body: Option, } /// Common statistics for a group. diff --git a/crates/weaver_resolved_schema/src/signal.rs b/crates/weaver_resolved_schema/src/signal.rs index a702191c..22a39adf 100644 --- a/crates/weaver_resolved_schema/src/signal.rs +++ b/crates/weaver_resolved_schema/src/signal.rs @@ -4,6 +4,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use weaver_semconv::any_value::AnyValueSpec; use crate::attribute::AttributeRef; use crate::metric::MetricRef; @@ -44,17 +45,15 @@ pub struct MultivariateMetric { tags: Option, } -/// An event signal. +/// An event specification, used for both Span and Log events. #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(deny_unknown_fields)] pub struct Event { - /// The name of the event. + /// The name of the event name: String, /// References to attributes defined in the catalog. #[serde(skip_serializing_if = "Vec::is_empty")] attributes: Vec, - /// The domain of the event. - domain: String, /// Brief description of the event. brief: Option, /// Longer description. @@ -63,6 +62,9 @@ pub struct Event { /// A set of tags for the event. #[serde(skip_serializing_if = "Option::is_none")] tags: Option, + /// The body of the event, not used for Span events. + #[serde(skip_serializing_if = "Option::is_none")] + body: Option, } /// A span signal. @@ -79,7 +81,7 @@ pub struct Span { kind: Option, /// The events of the span. #[serde(skip_serializing_if = "Vec::is_empty")] - events: Vec, + events: Vec, /// The links of the span. #[serde(skip_serializing_if = "Vec::is_empty")] links: Vec, @@ -108,25 +110,6 @@ pub enum SpanKind { Consumer, } -/// A span event specification. -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(deny_unknown_fields)] -pub struct SpanEvent { - /// The name of the span event. - pub event_name: String, - /// The attributes of the span event. - #[serde(skip_serializing_if = "Vec::is_empty")] - pub attributes: Vec, - /// Brief description of the span event. - pub brief: Option, - /// Longer description. - /// It defaults to an empty string. - pub note: Option, - /// A set of tags for the span event. - #[serde(skip_serializing_if = "Option::is_none")] - pub tags: Option, -} - /// A span link specification. #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(deny_unknown_fields)] diff --git a/crates/weaver_resolver/data/registry-test-4-events/expected-attribute-catalog.json b/crates/weaver_resolver/data/registry-test-4-events/expected-attribute-catalog.json index dcd9d812..0454de50 100644 --- a/crates/weaver_resolver/data/registry-test-4-events/expected-attribute-catalog.json +++ b/crates/weaver_resolver/data/registry-test-4-events/expected-attribute-catalog.json @@ -1,73 +1,190 @@ [ { - "name": "ios.state", - "type": { - "allow_custom_values": false, - "members": [ - { - "id": "active", - "value": "active", - "brief": "The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.\n", - "note": null - }, - { - "id": "inactive", - "value": "inactive", - "brief": "The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`.\n", - "note": null - }, - { - "id": "background", - "value": "background", - "brief": "The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground`.\n", - "note": null - }, - { - "id": "foreground", - "value": "foreground", - "brief": "The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground`.\n", - "note": null - }, - { - "id": "terminate", - "value": "terminate", - "brief": "The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.\n", - "note": null - } + "name": "client.name", + "type": "string", + "brief": "The name of the client that reported the exception.\n", + "examples": [ + "myclient" + ], + "requirement_level": "recommended" + }, + { + "name": "browser.brands", + "type": "string[]", + "brief": "Array of brand name and version separated by a space", + "examples": [ + [ + " Not A;Brand 99", + "Chromium 99", + "Chrome 99" ] + ], + "requirement_level": "recommended", + "note": "This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.brands`).\n" + }, + { + "name": "browser.platform", + "type": "string", + "brief": "The platform on which the browser is running", + "examples": [ + "Windows", + "macOS", + "Android", + "iOS", + "Linux" + ], + "requirement_level": "recommended", + "note": "This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.platform`). \n" + }, + { + "name": "browser.mobile", + "type": "boolean", + "brief": "A boolean that is true if the browser is running on a mobile device", + "requirement_level": "recommended", + "note": "This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be left unset.\n" + }, + { + "name": "browser.language", + "type": "string", + "brief": "Preferred language of the user using the browser", + "examples": [ + "en", + "en-US", + "en-AU", + "fr", + "fr-FR" + ], + "requirement_level": "recommended", + "note": "This value is intended to be taken from the Navigator API `navigator.language`.\n" + }, + { + "name": "test_attr.platform", + "type": "string", + "brief": "The browser platform", + "examples": [ + "Windows", + "macOS", + "Android" + ], + "requirement_level": "recommended", + "note": "Test value.", + "stability": "stable" + }, + { + "name": "test_attr.http.url", + "type": "string", + "brief": "The Url", + "examples": [ + "https://example.com" + ], + "requirement_level": "recommended", + "note": "Test url value.", + "stability": "stable" + }, + { + "name": "test_attr.event.attr", + "type": "string", + "brief": "Just making sure the referenced attributes are defined", + "examples": "some value", + "requirement_level": "recommended", + "note": "Test value.", + "stability": "stable" + }, + { + "name": "test_attr.session.id", + "type": "string", + "brief": "The session id", + "examples": "127836abcdef98", + "requirement_level": "recommended", + "note": "Test value.", + "stability": "stable" + }, + { + "name": "client.address", + "type": "string", + "brief": "Test Client address ....", + "examples": [ + "client.example.com", + "10.1.2.80", + "/tmp/my.sock" + ], + "requirement_level": "recommended", + "note": "Test client address note\n", + "stability": "stable" + }, + { + "name": "client.port", + "type": "int", + "brief": "Client port number.", + "examples": [ + 65123 + ], + "requirement_level": "recommended", + "note": "Test client port", + "stability": "stable" + }, + { + "name": "exception.type", + "type": "string", + "brief": "The type of the exception (its fully-qualified class name, if applicable).\n", + "examples": [ + "java.net.ConnectException", + "OSError" + ], + "requirement_level": "recommended", + "stability": "stable" + }, + { + "name": "exception.message", + "type": "string", + "brief": "The exception message.", + "examples": [ + "Division by zero", + "Can't convert 'int' object to str implicitly" + ], + "requirement_level": "recommended", + "stability": "stable" + }, + { + "name": "exception.stacktrace", + "type": "string", + "brief": ".", + "examples": "Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n", + "requirement_level": "recommended", + "stability": "stable" + }, + { + "name": "exception.escaped", + "type": "boolean", + "brief": "SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n", + "requirement_level": "recommended", + "stability": "stable" + }, + { + "name": "exception.type", + "type": "string", + "brief": "The type of the exception (its fully-qualified class name, if applicable).\n", + "examples": [ + "java.net.ConnectException", + "OSError" + ], + "requirement_level": { + "conditionally_required": "Required if `exception.message` is not set, recommended otherwise." }, - "brief": "This attribute represents the state the application has transitioned into at the occurrence of the event.\n", - "requirement_level": "required", - "note": "The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived.\n" - }, - { - "name": "android.state", - "type": { - "allow_custom_values": false, - "members": [ - { - "id": "created", - "value": "created", - "brief": "Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time.\n", - "note": null - }, - { - "id": "background", - "value": "background", - "brief": "Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state.\n", - "note": null - }, - { - "id": "foreground", - "value": "foreground", - "brief": "Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states.", - "note": null - } - ] + "stability": "stable" + }, + { + "name": "exception.message", + "type": "string", + "brief": "The exception message.", + "examples": [ + "Division by zero", + "Can't convert 'int' object to str implicitly" + ], + "requirement_level": { + "conditionally_required": "Required if `exception.type` is not set, recommended otherwise." }, - "brief": "This attribute represents the state the application has transitioned into at the occurrence of the event.\n", - "requirement_level": "required", - "note": "The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.\n" + "stability": "stable" }, { "name": "feature_flag.key", @@ -98,5 +215,27 @@ ], "requirement_level": "recommended", "note": "A semantic identifier, commonly referred to as a variant, provides a means\nfor referring to a value without including the value itself. This can\nprovide additional context for understanding the meaning behind a value.\nFor example, the variant `red` maybe be used for the value `#c05543`.\n\nA stringified version of the value can be used in situations where a\nsemantic identifier is unavailable. String representation of the value\nshould be determined by the implementer." + }, + { + "name": "test_attr.event.attr", + "type": "string", + "brief": "Just making sure the referenced attributes are defined", + "examples": "some value", + "requirement_level": { + "conditionally_required": "if and only if corresponding event is enabled" + }, + "note": "test attribute\n", + "stability": "stable" + }, + { + "name": "test_attr.session.id", + "type": "string", + "brief": "The session id", + "examples": "127836abcdef98", + "requirement_level": { + "conditionally_required": "if and only if corresponding event is enabled" + }, + "note": "Another test attribute\n", + "stability": "stable" } ] \ No newline at end of file diff --git a/crates/weaver_resolver/data/registry-test-4-events/expected-events.json b/crates/weaver_resolver/data/registry-test-4-events/expected-events.json new file mode 100644 index 00000000..87861a35 --- /dev/null +++ b/crates/weaver_resolver/data/registry-test-4-events/expected-events.json @@ -0,0 +1,214 @@ +[ + { + "attributes": [], + "body": { + "fields": [ + { + "brief": "This attribute represents the state the application has transitioned into at the occurrence of the event.\n", + "name": "ios.state", + "note": "The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived.\n", + "requirement_level": { + "conditionally_required": "if and only if `os.name` is `ios`" + }, + "stability": "experimental", + "type": { + "allow_custom_values": false, + "members": [ + { + "brief": "The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.\n", + "id": "active", + "note": null, + "stability": null, + "value": "active" + }, + { + "brief": "The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`.\n", + "id": "inactive", + "note": null, + "stability": null, + "value": "inactive" + }, + { + "brief": "The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground`.\n", + "id": "background", + "note": null, + "stability": null, + "value": "background" + }, + { + "brief": "The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground`.\n", + "id": "foreground", + "note": null, + "stability": null, + "value": "foreground" + }, + { + "brief": "The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.\n", + "id": "terminate", + "note": null, + "stability": null, + "value": "terminate" + } + ] + } + }, + { + "brief": "This attribute represents the state the application has transitioned into at the occurrence of the event.\n", + "name": "android.state", + "note": "The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.\n", + "requirement_level": { + "conditionally_required": "if and only if `os.name` is `android`" + }, + "stability": "experimental", + "type": { + "allow_custom_values": false, + "members": [ + { + "brief": "Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time.\n", + "id": "created", + "note": null, + "stability": null, + "value": "created" + }, + { + "brief": "Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state.\n", + "id": "background", + "note": null, + "stability": null, + "value": "background" + }, + { + "brief": "Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states.", + "id": "foreground", + "note": null, + "stability": null, + "value": "foreground" + } + ] + } + } + ], + "type": "map" + }, + "brief": "This event represents an occurrence of a lifecycle transition on Android or iOS platform.\n", + "event_namespace": "device.app", + "events": [], + "id": "device.app.lifecycle", + "instrument": null, + "lineage": { + "source_file": "data/mobile-events.yaml" + }, + "metric_name": null, + "name": "device.app.lifecycle", + "note": "This event identifies the fields that are common to all lifecycle events for android and iOS using the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are mutually exclusive.\n", + "span_kind": null, + "stability": "experimental", + "type": "event", + "unit": null + }, + { + "attributes": [ + { + "brief": "A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n", + "examples": "Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)", + "name": "exception.stacktrace", + "requirement_level": "recommended", + "stability": "stable", + "type": "string" + }, + { + "brief": "SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n", + "name": "exception.escaped", + "note": "An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically \"in flight\".\nThis may be actually \"in flight\" in some languages (e.g. if the exception\nis passed to a Context manager's `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.", + "requirement_level": "recommended", + "stability": "stable", + "type": "boolean" + }, + { + "brief": "The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n", + "examples": [ + "java.net.ConnectException", + "OSError" + ], + "name": "exception.type", + "requirement_level": { + "conditionally_required": "Required if `exception.message` is not set, recommended otherwise." + }, + "stability": "stable", + "type": "string" + }, + { + "brief": "The exception message.", + "examples": [ + "Division by zero", + "Can't convert 'int' object to str implicitly" + ], + "name": "exception.message", + "requirement_level": { + "conditionally_required": "Required if `exception.type` is not set, recommended otherwise." + }, + "stability": "stable", + "type": "string" + } + ], + "brief": "This document defines the attributes used to report a single exception associated with a span.\n", + "event_namespace": "other", + "events": [], + "id": "trace-exception", + "instrument": null, + "lineage": { + "attributes": { + "exception.escaped": { + "inherited_fields": [ + "brief", + "note", + "requirement_level", + "stability" + ], + "source_group": "registry.exception" + }, + "exception.message": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability" + ], + "locally_overridden_fields": [ + "requirement_level" + ], + "source_group": "registry.exception" + }, + "exception.stacktrace": { + "inherited_fields": [ + "brief", + "examples", + "note", + "requirement_level", + "stability" + ], + "source_group": "registry.exception" + }, + "exception.type": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability" + ], + "locally_overridden_fields": [ + "requirement_level" + ], + "source_group": "registry.exception" + } + }, + "source_file": "data/trace-exception.yaml" + }, + "metric_name": null, + "name": null, + "prefix": "exception", + "span_kind": null, + "type": "event", + "unit": null + } +] \ No newline at end of file diff --git a/crates/weaver_resolver/data/registry-test-4-events/expected-registry.json b/crates/weaver_resolver/data/registry-test-4-events/expected-registry.json index d2db1ae2..462bfd0a 100644 --- a/crates/weaver_resolver/data/registry-test-4-events/expected-registry.json +++ b/crates/weaver_resolver/data/registry-test-4-events/expected-registry.json @@ -1,18 +1,52 @@ { "registry_url": "https://127.0.0.1", "groups": [ + { + "id": "log_event_attributes_only", + "type": "event", + "brief": "brief", + "attributes": [ + 7 + ], + "name": "some.event", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml", + "attributes": { + "test_attr.event.attr": { + "source_group": "referenced.attributes", + "inherited_fields": [ + "brief", + "examples", + "note", + "requirement_level", + "stability" + ] + } + } + } + }, + { + "id": "log_event_empty", + "type": "event", + "brief": "brief", + "attributes": [], + "name": "empty.event", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + } + }, { "id": "log-feature_flag", "type": "event", "brief": "This document defines attributes for feature flag evaluations represented using Log Records.\n", "prefix": "feature_flag", "attributes": [ - 2, - 3, - 4 + 17, + 18, + 19 ], "lineage": { - "source_file": "data/registry-test-4-events/registry/log-feature_flag.yaml", + "source_file": "data/registry-test-4-events/registry/log-events.yaml", "attributes": { "feature_flag.key": { "source_group": "feature_flag", @@ -45,29 +79,369 @@ } }, { - "id": "ios.lifecycle.events", + "id": "some.string.body.event", + "type": "event", + "brief": "This event represents an occurrence of a something.\n", + "note": "This event transmits the body as a JSON encoded string.\n", + "stability": "experimental", + "attributes": [], + "name": "string.body.event", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + }, + "body": { + "id": "some.string.body.event.fields", + "type": "string", + "brief": "This is the body of the event which is a JSON encoded string.\n", + "examples": [ + "{\"key1\":\"value1\",\"key2\":\"value2\"}" + ], + "requirement_level": "required" + } + }, + { + "id": "some.string.body.detailed.event", + "type": "event", + "brief": "This event represents an occurrence of a something.\n", + "note": "This event transmits the body as a JSON encoded string.\n", + "stability": "experimental", + "attributes": [], + "name": "string.body.event", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + }, + "body": { + "id": "some.string.body.event.fields", + "type": "string", + "brief": "This is the body of the event which is a JSON encoded string.\n", + "note": "This is a detailed note about the body.\n", + "stability": "experimental", + "examples": [ + "{\"key1\":\"value1\",\"key2\":\"value2\"}" + ], + "requirement_level": "required" + } + }, + { + "id": "device.app.lifecycle", + "type": "event", + "brief": "This event represents an occurrence of a lifecycle transition on Android or iOS platform.\n", + "note": "This event identifies the fields that are common to all lifecycle events for android and iOS using the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are mutually exclusive.\n", + "stability": "experimental", + "attributes": [], + "name": "device.app.lifecycle", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + }, + "body": { + "id": "device.app.lifecycle.fields", + "type": "map", + "requirement_level": "required", + "fields": [ + { + "id": "ios.state", + "type": "enum", + "members": [ + { + "id": "active", + "value": "active", + "brief": "The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.\n", + "note": null, + "stability": null + }, + { + "id": "inactive", + "value": "inactive", + "brief": "The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`.\n", + "note": null, + "stability": null + }, + { + "id": "background", + "value": "background", + "brief": "The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground`.\n", + "note": null, + "stability": null + }, + { + "id": "foreground", + "value": "foreground", + "brief": "The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground`.\n", + "note": null, + "stability": null + }, + { + "id": "terminate", + "value": "terminate", + "brief": "The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.\n", + "note": null, + "stability": null + } + ], + "brief": "This attribute represents the state the application has transitioned into at the occurrence of the event.\n", + "requirement_level": { + "conditionally_required": "if and only if `os.name` is `ios`" + }, + "note": "The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived.\n", + "stability": "experimental" + }, + { + "id": "android.state", + "type": "enum", + "members": [ + { + "id": "created", + "value": "created", + "brief": "Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time.\n", + "note": null, + "stability": null + }, + { + "id": "background", + "value": "background", + "brief": "Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state.\n", + "note": null, + "stability": null + }, + { + "id": "foreground", + "value": "foreground", + "brief": "Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states.\n", + "note": null, + "stability": null + } + ], + "brief": "This attribute represents the state the application has transitioned into at the occurrence of the event.\n", + "requirement_level": { + "conditionally_required": "if and only if `os.name` is `android`" + }, + "note": "The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.\n", + "stability": "experimental" + } + ] + } + }, + { + "id": "client.exception.event", "type": "event", - "brief": "This event represents an occurrence of a lifecycle transition on the iOS platform.\n", - "prefix": "ios", + "brief": "This document defines the log event used to report a client exception.\n", "attributes": [ 0 ], - "name": "device.app.lifecycle", + "name": "client.exception.event", "lineage": { - "source_file": "data/registry-test-4-events/registry/mobile-events.yaml" + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + }, + "body": { + "id": "client.exception.event.fields", + "type": "map", + "requirement_level": "optional", + "fields": [ + { + "id": "type", + "type": "string", + "brief": "The type of the exception.\n", + "examples": [ + "java.net.ConnectException", + "OSError" + ], + "requirement_level": "optional" + }, + { + "id": "message", + "type": "string", + "brief": "The exception message.", + "examples": [ + "Division by zero", + "Can't convert 'int' object to str implicitly" + ], + "requirement_level": "optional" + }, + { + "id": "stacktrace", + "type": "string", + "brief": "A stacktrace.\n", + "examples": "Exception in thread \"main\" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)", + "requirement_level": "optional" + }, + { + "id": "escaped", + "type": "boolean", + "brief": "SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n", + "requirement_level": "optional", + "note": "An exception is considered to have escaped." + } + ] } }, { - "id": "android.lifecycle.events", + "id": "browser.test.event_with_fields", "type": "event", - "brief": "This event represents an occurrence of a lifecycle transition on the Android platform.\n", - "prefix": "android", + "brief": "An event that adds global attributes for reuse.\n", + "prefix": "browser", "attributes": [ - 1 + 1, + 2, + 3, + 4 + ], + "name": "browser.test.event_with_fields", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + }, + "body": { + "id": "browser.test.event_with_body.fields", + "type": "map", + "requirement_level": "required", + "fields": [ + { + "id": "some.field", + "type": "string", + "brief": "A field that is not referenced in the attributes", + "examples": [ + "some value", + "another value" + ], + "requirement_level": "required", + "note": "This field is not referenced in the attributes" + } + ] + } + }, + { + "id": "browser.test.event_with_body_details", + "type": "event", + "brief": "An event that adds global attributes for reuse.\n", + "attributes": [], + "name": "browser.test.event_with_body_details", + "lineage": { + "source_file": "data/registry-test-4-events/registry/log-events.yaml" + }, + "body": { + "id": "browser.test.event_with_body_details.fields", + "type": "map", + "brief": "A map of fields that are not referenced in the attributes", + "note": "This map is not referenced in the attributes", + "stability": "experimental", + "examples": [ + "{ \"some.field\": \"some value\" }" + ], + "requirement_level": "required", + "fields": [ + { + "id": "some.field", + "type": "string", + "brief": "A field that is not referenced in the attributes", + "examples": [ + "some value", + "another value" + ], + "requirement_level": "optional", + "note": "This field is not referenced in the attributes" + } + ] + } + }, + { + "id": "referenced.attributes", + "type": "attribute_group", + "brief": "These attributes are used as references for the test below\n", + "attributes": [ + 5, + 6, + 7, + 8 + ], + "lineage": { + "source_file": "data/registry-test-4-events/registry/referenced-attributes.yaml" + } + }, + { + "id": "registry.client", + "type": "attribute_group", + "brief": "Client test attributes", + "prefix": "client", + "attributes": [ + 9, + 10 + ], + "lineage": { + "source_file": "data/registry-test-4-events/registry/referenced-attributes.yaml" + } + }, + { + "id": "registry.exception", + "type": "attribute_group", + "brief": "This document defines the shared attributes used to report a single exception associated with a span or log.\n", + "prefix": "exception", + "attributes": [ + 11, + 12, + 13, + 14 + ], + "lineage": { + "source_file": "data/registry-test-4-events/registry/referenced-attributes.yaml" + } + }, + { + "id": "trace-exception", + "type": "event", + "brief": "This document defines the attributes used to report a single exception associated with a span.\n", + "prefix": "exception", + "attributes": [ + 13, + 14, + 15, + 16 ], - "name": "device.app.lifecycle", "lineage": { - "source_file": "data/registry-test-4-events/registry/mobile-events.yaml" + "source_file": "data/registry-test-4-events/registry/trace-events.yaml", + "attributes": { + "exception.escaped": { + "source_group": "registry.exception", + "inherited_fields": [ + "brief", + "note", + "requirement_level", + "stability" + ] + }, + "exception.message": { + "source_group": "registry.exception", + "inherited_fields": [ + "brief", + "examples", + "note", + "stability" + ], + "locally_overridden_fields": [ + "requirement_level" + ] + }, + "exception.stacktrace": { + "source_group": "registry.exception", + "inherited_fields": [ + "brief", + "examples", + "note", + "requirement_level", + "stability" + ] + }, + "exception.type": { + "source_group": "registry.exception", + "inherited_fields": [ + "brief", + "examples", + "note", + "stability" + ], + "locally_overridden_fields": [ + "requirement_level" + ] + } + } } }, { @@ -76,13 +450,65 @@ "brief": "This semantic convention defines the attributes used to represent a feature flag evaluation as an event.\n", "prefix": "feature_flag", "attributes": [ - 2, - 3, - 4 + 17, + 18, + 19 + ], + "lineage": { + "source_file": "data/registry-test-4-events/registry/trace-events.yaml" + } + }, + { + "id": "test_evt.with_attr", + "type": "event", + "brief": "Simple example span event with an attribute\n", + "attributes": [ + 20 + ], + "name": "test_evt.with_attr", + "lineage": { + "source_file": "data/registry-test-4-events/registry/trace-events.yaml", + "attributes": { + "test_attr.event.attr": { + "source_group": "referenced.attributes", + "inherited_fields": [ + "brief", + "examples", + "stability" + ], + "locally_overridden_fields": [ + "note", + "requirement_level" + ] + } + } + } + }, + { + "id": "test_evt.session", + "type": "event", + "brief": "Another simple span event with another attribute\n", + "attributes": [ + 21 ], + "name": "test_evt.session", "lineage": { - "source_file": "data/registry-test-4-events/registry/trace-feature-flag.yaml" + "source_file": "data/registry-test-4-events/registry/trace-events.yaml", + "attributes": { + "test_attr.session.id": { + "source_group": "referenced.attributes", + "inherited_fields": [ + "brief", + "examples", + "stability" + ], + "locally_overridden_fields": [ + "note", + "requirement_level" + ] + } + } } - } + } ] } \ No newline at end of file diff --git a/crates/weaver_resolver/data/registry-test-4-events/registry/log-events.yaml b/crates/weaver_resolver/data/registry-test-4-events/registry/log-events.yaml new file mode 100644 index 00000000..b6966da7 --- /dev/null +++ b/crates/weaver_resolver/data/registry-test-4-events/registry/log-events.yaml @@ -0,0 +1,248 @@ +groups: + - id: log_event_attributes_only + name: some.event + type: event + brief: brief + attributes: + - ref: test_attr.event.attr + + - id: log_event_empty + name: empty.event + type: event + brief: brief + + - id: log-feature_flag + type: event + prefix: feature_flag + brief: > + This document defines attributes for feature flag evaluations + represented using Log Records. + attributes: + - ref: feature_flag.key + - ref: feature_flag.provider_name + - ref: feature_flag.variant + + - id: some.string.body.event + stability: experimental + type: event + name: string.body.event + brief: > + This event represents an occurrence of a something. + note: > + This event transmits the body as a JSON encoded string. + body: + id: some.string.body.event.fields + type: string + requirement_level: required + brief: > + This is the body of the event which is a JSON encoded string. + examples: ['{"key1":"value1","key2":"value2"}'] + + - id: some.string.body.detailed.event + stability: experimental + type: event + name: string.body.event + brief: > + This event represents an occurrence of a something. + note: > + This event transmits the body as a JSON encoded string. + body: + id: some.string.body.event.fields + type: string + requirement_level: required + brief: > + This is the body of the event which is a JSON encoded string. + note: > + This is a detailed note about the body. + stability: experimental + examples: ['{"key1":"value1","key2":"value2"}'] + + - id: device.app.lifecycle + stability: experimental + type: event + name: device.app.lifecycle + brief: > + This event represents an occurrence of a lifecycle transition on Android or iOS platform. + note: > + This event identifies the fields that are common to all lifecycle events for android and iOS using + the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are + mutually exclusive. + body: + id: device.app.lifecycle.fields + type: map + requirement_level: required + fields: + - id: ios.state + stability: experimental + requirement_level: + conditionally_required: if and only if `os.name` is `ios` + note: > + The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + and from which the `OS terminology` column values are derived. + brief: > + This attribute represents the state the application has transitioned into at the occurrence of the event. + type: enum + members: + - id: active + value: 'active' + brief: > + The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`. + - id: inactive + value: 'inactive' + brief: > + The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`. + - id: background + value: 'background' + brief: > + The app is now in the background. + This value is associated with UIKit notification `applicationDidEnterBackground`. + - id: foreground + value: 'foreground' + brief: > + The app is now in the foreground. + This value is associated with UIKit notification `applicationWillEnterForeground`. + - id: terminate + value: 'terminate' + brief: > + The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`. + - id: android.state + stability: experimental + requirement_level: + conditionally_required: if and only if `os.name` is `android` + brief: > + This attribute represents the state the application has transitioned into at the occurrence of the event. + note: > + The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + and from which the `OS identifiers` are derived. + type: enum + members: + - id: created + value: 'created' + brief: > + Any time before Activity.onResume() or, if the app has no Activity, Context.startService() + has been called in the app for the first time. + - id: background + value: 'background' + brief: > + Any time after Activity.onPause() or, if the app has no Activity, + Context.stopService() has been called when the app was in the foreground state. + - id: foreground + value: 'foreground' + brief: > + Any time after Activity.onResume() or, if the app has no Activity, + Context.startService() has been called when the app was in either the created or background states. + - id: client.exception.event + name: client.exception.event + type: event + brief: > + This document defines the log event used to + report a client exception. + body: + id: client.exception.event.fields + type: map + requirement_level: optional + fields: + - id: type + type: string + brief: > + The type of the exception. + examples: ["java.net.ConnectException","OSError"] + requirement_level: optional + - id: message + type: string + brief: The exception message. + examples: ["Division by zero","Can't convert 'int' object to str implicitly"] + requirement_level: optional + - id: stacktrace + type: string + brief: > + A stacktrace. + examples: 'Exception in thread "main" java.lang.RuntimeException: Test exception\n + at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n + at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n + at com.example.GenerateTrace.main(GenerateTrace.java:5)' + requirement_level: optional + - id: escaped + type: boolean + brief: > + SHOULD be set to true if the exception event is recorded at a point where + it is known that the exception is escaping the scope of the span. + note: |- + An exception is considered to have escaped. + requirement_level: optional + attributes: + - id: client.name + type: string + brief: > + The name of the client that reported the exception. + examples: ["myclient"] + - id: browser.test.event_with_fields + name: browser.test.event_with_fields + prefix: browser + type: event + brief: > + An event that adds global attributes for reuse. + attributes: + - id: brands + type: string[] + brief: 'Array of brand name and version separated by a space' + note: > + This value is intended to be taken from the + [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) + (`navigator.userAgentData.brands`). + examples: [ [ " Not A;Brand 99", "Chromium 99", "Chrome 99" ] ] + - id: platform + type: string + brief: 'The platform on which the browser is running' + note: > + This value is intended to be taken from the + [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) + (`navigator.userAgentData.platform`). + examples: [ "Windows", "macOS", "Android", "iOS", "Linux" ] + - id: mobile + type: boolean + brief: 'A boolean that is true if the browser is running on a mobile device' + note: > + This value is intended to be taken from the + [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) + (`navigator.userAgentData.mobile`). If unavailable, this attribute + SHOULD be left unset. + - id: language + type: string + brief: 'Preferred language of the user using the browser' + note: > + This value is intended to be taken from the Navigator API + `navigator.language`. + examples: [ "en", "en-US", "en-AU", "fr", "fr-FR" ] + body: + id: browser.test.event_with_body.fields + type: map + requirement_level: required + fields: + - id: some.field + type: string + brief: 'A field that is not referenced in the attributes' + note: 'This field is not referenced in the attributes' + examples: [ "some value", "another value" ] + requirement_level: required + + - id: browser.test.event_with_body_details + name: browser.test.event_with_body_details + type: event + brief: > + An event that adds global attributes for reuse. + body: + id: browser.test.event_with_body_details.fields + type: map + brief: A map of fields that are not referenced in the attributes + note: This map is not referenced in the attributes + stability: experimental + examples: [ '{ "some.field": "some value" }' ] + requirement_level: required + fields: + - id: some.field + type: string + brief: 'A field that is not referenced in the attributes' + note: 'This field is not referenced in the attributes' + examples: [ "some value", "another value" ] + requirement_level: optional \ No newline at end of file diff --git a/crates/weaver_resolver/data/registry-test-4-events/registry/log-feature_flag.yaml b/crates/weaver_resolver/data/registry-test-4-events/registry/log-feature_flag.yaml deleted file mode 100644 index 081125bf..00000000 --- a/crates/weaver_resolver/data/registry-test-4-events/registry/log-feature_flag.yaml +++ /dev/null @@ -1,11 +0,0 @@ -groups: - - id: log-feature_flag - type: event - prefix: feature_flag - brief: > - This document defines attributes for feature flag evaluations - represented using Log Records. - attributes: - - ref: feature_flag.key - - ref: feature_flag.provider_name - - ref: feature_flag.variant \ No newline at end of file diff --git a/crates/weaver_resolver/data/registry-test-4-events/registry/mobile-events.yaml b/crates/weaver_resolver/data/registry-test-4-events/registry/mobile-events.yaml deleted file mode 100644 index 94f93ebb..00000000 --- a/crates/weaver_resolver/data/registry-test-4-events/registry/mobile-events.yaml +++ /dev/null @@ -1,72 +0,0 @@ -groups: - - id: ios.lifecycle.events - type: event - prefix: ios - name: device.app.lifecycle - brief: > - This event represents an occurrence of a lifecycle transition on the iOS platform. - attributes: - - id: state - requirement_level: "required" - note: > - The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), - and from which the `OS terminology` column values are derived. - brief: > - This attribute represents the state the application has transitioned into at the occurrence of the event. - type: - allow_custom_values: false - members: - - id: active - value: 'active' - brief: > - The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`. - - id: inactive - value: 'inactive' - brief: > - The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`. - - id: background - value: 'background' - brief: > - The app is now in the background. - This value is associated with UIKit notification `applicationDidEnterBackground`. - - id: foreground - value: 'foreground' - brief: > - The app is now in the foreground. - This value is associated with UIKit notification `applicationWillEnterForeground`. - - id: terminate - value: 'terminate' - brief: > - The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`. - - id: android.lifecycle.events - type: event - prefix: android - name: device.app.lifecycle - brief: > - This event represents an occurrence of a lifecycle transition on the Android platform. - attributes: - - id: state - requirement_level: required - brief: > - This attribute represents the state the application has transitioned into at the occurrence of the event. - note: > - The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), - and from which the `OS identifiers` are derived. - type: - allow_custom_values: false - members: - - id: created - value: 'created' - brief: > - Any time before Activity.onResume() or, if the app has no Activity, Context.startService() - has been called in the app for the first time. - - id: background - value: 'background' - brief: > - Any time after Activity.onPause() or, if the app has no Activity, - Context.stopService() has been called when the app was in the foreground state. - - id: foreground - value: 'foreground' - brief: > - Any time after Activity.onResume() or, if the app has no Activity, - Context.startService() has been called when the app was in either the created or background states. \ No newline at end of file diff --git a/crates/weaver_resolver/data/registry-test-4-events/registry/referenced-attributes.yaml b/crates/weaver_resolver/data/registry-test-4-events/registry/referenced-attributes.yaml new file mode 100644 index 00000000..8662f9a3 --- /dev/null +++ b/crates/weaver_resolver/data/registry-test-4-events/registry/referenced-attributes.yaml @@ -0,0 +1,82 @@ +groups: + + # As the tests are only loading a subset of files we need to define any referenced attributes before they can be resolved for body fields + - id: referenced.attributes + type: attribute_group + brief: > + These attributes are used as references for the test below + attributes: + - id: test_attr.platform + stability: stable + type: string + brief: 'The browser platform' + note: Test value. + examples: ['Windows', 'macOS', 'Android'] + - id: test_attr.http.url + stability: stable + type: string + brief: 'The Url' + note: Test url value. + examples: ['https://example.com'] + - id: test_attr.event.attr + stability: stable + type: string + brief: 'Just making sure the referenced attributes are defined' + note: Test value. + examples: some value + - id: test_attr.session.id + stability: stable + type: string + brief: 'The session id' + note: Test value. + examples: 127836abcdef98 + + - id: registry.client + prefix: client + type: attribute_group + brief: Client test attributes + attributes: + - id: address + stability: stable + type: string + brief: "Test Client address ...." + note: > + Test client address note + examples: ['client.example.com', '10.1.2.80', '/tmp/my.sock'] + - id: port + stability: stable + type: int + brief: Client port number. + examples: [65123] + note: Test client port + + - id: registry.exception + type: attribute_group + prefix: exception + brief: > + This document defines the shared attributes used to + report a single exception associated with a span or log. + attributes: + - id: type + type: string + stability: stable + brief: > + The type of the exception (its fully-qualified class name, if applicable). + examples: ["java.net.ConnectException", "OSError"] + - id: message + type: string + stability: stable + brief: The exception message. + examples: ["Division by zero", "Can't convert 'int' object to str implicitly"] + - id: stacktrace + type: string + stability: stable + brief: . + examples: 'Exception in thread "main" java.lang.RuntimeException: Test exception\n' + - id: escaped + type: boolean + stability: stable + brief: > + SHOULD be set to true if the exception event is recorded at a point where + it is known that the exception is escaping the scope of the span. + diff --git a/crates/weaver_resolver/data/registry-test-4-events/registry/trace-feature-flag.yaml b/crates/weaver_resolver/data/registry-test-4-events/registry/trace-events.yaml similarity index 51% rename from crates/weaver_resolver/data/registry-test-4-events/registry/trace-feature-flag.yaml rename to crates/weaver_resolver/data/registry-test-4-events/registry/trace-events.yaml index fa4c8816..08c8cb13 100644 --- a/crates/weaver_resolver/data/registry-test-4-events/registry/trace-feature-flag.yaml +++ b/crates/weaver_resolver/data/registry-test-4-events/registry/trace-events.yaml @@ -1,4 +1,20 @@ groups: + - id: trace-exception + prefix: exception + type: event + brief: > + This document defines the attributes used to + report a single exception associated with a span. + attributes: + - ref: exception.type + requirement_level: + conditionally_required: Required if `exception.message` is not set, recommended otherwise. + - ref: exception.message + requirement_level: + conditionally_required: Required if `exception.type` is not set, recommended otherwise. + - ref: exception.stacktrace + - ref: exception.escaped + - id: feature_flag prefix: feature_flag type: event @@ -31,4 +47,28 @@ groups: 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. \ No newline at end of file + should be determined by the implementer. + + - id: test_evt.with_attr + name: test_evt.with_attr + type: event + brief: > + Simple example span event with an attribute + attributes: + - ref: test_attr.event.attr + requirement_level: + conditionally_required: if and only if corresponding event is enabled + note: > + test attribute + + - id: test_evt.session + name: test_evt.session + type: event + brief: > + Another simple span event with another attribute + attributes: + - ref: test_attr.session.id + requirement_level: + conditionally_required: if and only if corresponding event is enabled + note: > + Another test attribute diff --git a/crates/weaver_resolver/src/attribute.rs b/crates/weaver_resolver/src/attribute.rs index bd617df5..ec4fe3f4 100644 --- a/crates/weaver_resolver/src/attribute.rs +++ b/crates/weaver_resolver/src/attribute.rs @@ -23,12 +23,21 @@ pub struct AttributeCatalog { } #[derive(Debug, PartialEq)] -struct AttributeWithGroupId { +/// The Attribute with its group ID. +pub struct AttributeWithGroupId { + /// The attribute. pub attribute: attribute::Attribute, + /// The group ID. pub group_id: String, } impl AttributeCatalog { + /// Returns the given attribute from the catalog. + #[must_use] + pub fn get_attribute(&self, name: &str) -> Option<&AttributeWithGroupId> { + self.root_attributes.get(name) + } + /// Returns the reference of the given attribute or creates a new reference if the attribute /// does not exist in the catalog. pub fn attribute_ref(&mut self, attr: attribute::Attribute) -> AttributeRef { diff --git a/crates/weaver_resolver/src/registry.rs b/crates/weaver_resolver/src/registry.rs index db324169..8ea341c4 100644 --- a/crates/weaver_resolver/src/registry.rs +++ b/crates/weaver_resolver/src/registry.rs @@ -330,6 +330,7 @@ fn group_from_spec(group: GroupSpecWithProvenance) -> UnresolvedGroup { name: group.spec.name, lineage: Some(GroupLineage::new(&group.provenance)), display_name: group.spec.display_name, + body: group.spec.body, }, attributes: attrs, provenance: group.provenance, diff --git a/crates/weaver_semconv/Cargo.toml b/crates/weaver_semconv/Cargo.toml index 006d5b14..7a7d94ba 100644 --- a/crates/weaver_semconv/Cargo.toml +++ b/crates/weaver_semconv/Cargo.toml @@ -11,6 +11,9 @@ rust-version.workspace = true [lints] workspace = true +[dev-dependencies] +serde_json.workspace = true + [dependencies] weaver_common = { path = "../weaver_common" } diff --git a/crates/weaver_semconv/data/event.yaml b/crates/weaver_semconv/data/event.yaml new file mode 100644 index 00000000..244d5fa2 --- /dev/null +++ b/crates/weaver_semconv/data/event.yaml @@ -0,0 +1,179 @@ +groups: + - id: device.app.lifecycle + stability: experimental + type: event + name: device.app.lifecycle + brief: > + This event represents an occurrence of a lifecycle transition on Android or iOS platform. + note: > + This event identifies the fields that are common to all lifecycle events for android and iOS using + the `android.state` and `ios.state` fields. The `android.state` and `ios.state` attributes are + mutually exclusive. + body: + id: device_lifecycle + type: map + requirement_level: optional + fields: + - id: ios.state + stability: experimental + requirement_level: + conditionally_required: if and only if `os.name` is `ios` + note: > + The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + and from which the `OS terminology` column values are derived. + brief: > + This attribute represents the state the application has transitioned into at the occurrence of the event. + type: enum + members: + - id: active + value: 'active' + brief: > + The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`. + - id: inactive + value: 'inactive' + brief: > + The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`. + - id: background + value: 'background' + brief: > + The app is now in the background. + This value is associated with UIKit notification `applicationDidEnterBackground`. + - id: foreground + value: 'foreground' + brief: > + The app is now in the foreground. + This value is associated with UIKit notification `applicationWillEnterForeground`. + - id: terminate + value: 'terminate' + brief: > + The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`. + - id: android.state + stability: experimental + requirement_level: + conditionally_required: if and only if `os.name` is `android` + brief: > + This attribute represents the state the application has transitioned into at the occurrence of the event. + note: > + The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + and from which the `OS identifiers` are derived. + type: enum + members: + - id: created + value: 'created' + brief: > + Any time before Activity.onResume() or, if the app has no Activity, Context.startService() + has been called in the app for the first time. + - id: background + value: 'background' + brief: > + Any time after Activity.onPause() or, if the app has no Activity, + Context.stopService() has been called when the app was in the foreground state. + - id: foreground + value: 'foreground' + brief: > + Any time after Activity.onResume() or, if the app has no Activity, + Context.startService() has been called when the app was in either the created or background states. + + - id: span.event.test.no_name + stability: experimental + type: event + prefix: span.event.test + brief: > + This event represents an occurrence of a span event. + attributes: + - id: attribute1 + type: string + brief: 'The attribute1' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute2` is not set, recommended otherwise. + - id: attribute2 + type: string + brief: 'The attribute2' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute1` is not set, recommended otherwise. + + - id: span.event.test.with_name + name: span.event.test.with_name + stability: experimental + type: event + prefix: span.event.test.with_name + brief: > + This event represents an occurrence of a span event. + attributes: + - id: attribute1 + type: string + brief: 'The attribute1' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute2` is not set, recommended otherwise. + - id: attribute2 + type: string + brief: 'The attribute2' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute1` is not set, recommended otherwise. + + - id: test.event.with_attributes + name: test.event.with_attributes + stability: experimental + type: event + brief: > + This event represents an occurrence of a test event. + attributes: + - id: attribute1 + type: string + brief: 'The attribute1' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute2` is not set, recommended otherwise. + - id: attribute2 + type: string + brief: 'The attribute2' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute1` is not set, recommended otherwise. + body: + id: body_name + type: map + requirement_level: required + fields: + - id: field1 + type: string + brief: 'The field1' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `field2` is not set, recommended otherwise. + - id: field2 + type: string + brief: 'The field2' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `field1` is not set, recommended otherwise. + + - id: test.event.with_string_body + name: test.event.with_string_body + stability: experimental + type: event + brief: > + This event represents an occurrence of a test event. + attributes: + - id: attribute1 + type: string + brief: 'The attribute1' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute2` is not set, recommended otherwise. + - id: attribute2 + type: string + brief: 'The attribute2' + examples: ['value1', 'value2'] + requirement_level: + conditionally_required: Required if `attribute1` is not set, recommended otherwise. + body: + id: body_name + type: string + brief: 'The body of the event' + requirement_level: required + examples: ['{ name: "thename", content: ... }', '{ name: "thename", content: ... }'] diff --git a/crates/weaver_semconv/data/expected/any_value.json b/crates/weaver_semconv/data/expected/any_value.json new file mode 100644 index 00000000..8684091b --- /dev/null +++ b/crates/weaver_semconv/data/expected/any_value.json @@ -0,0 +1 @@ +{"body":{"type":"map","id":"id","brief":"brief","note":"note","requirement_level":"optional","fields":[{"type":"enum","id":"id_enum","brief":"brief","note":"note","requirement_level":"optional","members":[{"id":"id","value":42,"brief":"brief","note":"note","stability":null,"deprecated":null}]},{"type":"map","id":"id_map","brief":"brief","note":"note","requirement_level":"optional","fields":[{"type":"int","id":"id_int","brief":"brief","note":"note","requirement_level":"required"},{"type":"bytes","id":"id_bytes","brief":"brief","note":"note","requirement_level":"required"},{"type":"string","id":"id_string","brief":"brief","note":"note","requirement_level":"optional"},{"type":"boolean","id":"id_bool","brief":"brief","note":"note","requirement_level":"optional"},{"type":"map","id":"id_nested_map","brief":"brief","note":"note","requirement_level":"optional","fields":[{"type":"int[]","id":"id_nested_int","brief":"brief","note":"note","requirement_level":"optional"},{"type":"double[]","id":"id_nested_bytes","brief":"brief","note":"note","requirement_level":"optional"},{"type":"string[]","id":"id_nested_string","brief":"brief","note":"note","requirement_level":"optional"},{"type":"boolean[]","id":"id_nested_bool","brief":"brief","note":"note","requirement_level":"optional"}]}]},{"type":"int","id":"id_int","brief":"brief","note":"note","requirement_level":"optional"},{"type":"bytes","id":"id_bytes","brief":"brief","note":"note","requirement_level":"optional"},{"type":"string","id":"id_string","brief":"brief","note":"note","requirement_level":"recommended"},{"type":"boolean","id":"id_bool","brief":"brief","note":"note","requirement_level":"optional"},{"type":"double","id":"id_double","brief":"brief","note":"note","requirement_level":"optional"},{"type":"double[]","id":"id_doubles","brief":"brief","note":"note","requirement_level":"optional"}]}} \ No newline at end of file diff --git a/crates/weaver_semconv/data/expected/any_value.yaml b/crates/weaver_semconv/data/expected/any_value.yaml new file mode 100644 index 00000000..7e3ac6fc --- /dev/null +++ b/crates/weaver_semconv/data/expected/any_value.yaml @@ -0,0 +1,101 @@ +body: + type: map + id: id + brief: brief + note: note + requirement_level: optional + fields: + - type: enum + id: id_enum + brief: brief + note: note + requirement_level: optional + members: + - id: id + value: 42 + brief: brief + note: note + stability: null + deprecated: null + - type: map + id: id_map + brief: brief + note: note + requirement_level: optional + fields: + - type: int + id: id_int + brief: brief + note: note + requirement_level: required + - type: bytes + id: id_bytes + brief: brief + note: note + requirement_level: required + - type: string + id: id_string + brief: brief + note: note + requirement_level: optional + - type: boolean + id: id_bool + brief: brief + note: note + requirement_level: optional + - type: map + id: id_nested_map + brief: brief + note: note + requirement_level: optional + fields: + - type: int[] + id: id_nested_int + brief: brief + note: note + requirement_level: optional + - type: double[] + id: id_nested_bytes + brief: brief + note: note + requirement_level: optional + - type: string[] + id: id_nested_string + brief: brief + note: note + requirement_level: optional + - type: boolean[] + id: id_nested_bool + brief: brief + note: note + requirement_level: optional + - type: int + id: id_int + brief: brief + note: note + requirement_level: optional + - type: bytes + id: id_bytes + brief: brief + note: note + requirement_level: optional + - type: string + id: id_string + brief: brief + note: note + requirement_level: recommended + - type: boolean + id: id_bool + brief: brief + note: note + requirement_level: optional + - type: double + id: id_double + brief: brief + note: note + requirement_level: optional + - type: double[] + id: id_doubles + brief: brief + note: note + requirement_level: optional diff --git a/crates/weaver_semconv/src/any_value.rs b/crates/weaver_semconv/src/any_value.rs new file mode 100644 index 00000000..9f750265 --- /dev/null +++ b/crates/weaver_semconv/src/any_value.rs @@ -0,0 +1,734 @@ +// SPDX-License-Identifier: Apache-2.0 + +#![allow(rustdoc::invalid_html_tags)] + +//! AnyValue specification. + +use std::fmt::{Display, Formatter}; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::attribute::{BasicRequirementLevelSpec, EnumEntriesSpec, Examples, RequirementLevel}; +use crate::stability::Stability; + +/// The AnyValueTypeSpec is a specification of a value that can be of any type. +#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash, JsonSchema)] +#[serde(rename_all = "snake_case")] +#[serde(tag = "type")] +pub enum AnyValueSpec { + /// A boolean attribute. + Boolean { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// A integer attribute (signed 64 bit integer). + Int { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// A double attribute (double precision floating point (IEEE 754-1985)). + Double { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// A string attribute. + String { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// An array of strings attribute. + #[serde(rename = "string[]")] + Strings { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// An array of integer attribute. + #[serde(rename = "int[]")] + Ints { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// An array of double attribute. + #[serde(rename = "double[]")] + Doubles { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// An array of boolean attribute. + #[serde(rename = "boolean[]")] + Booleans { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// The value type is a map of key, value pairs + Map { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + /// The collection of key, values where the value is an `AnyValueSpec` + fields: Vec, + }, + + /// The value type will just be a bytes. + Bytes { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// The value type is not specified. + Undefined { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + }, + + /// An enum definition type. + Enum { + /// The common value specification + #[serde(flatten)] + common: AnyValueCommonSpec, + + /// List of enum entries. + members: Vec, + }, +} + +/// The Common Value specification for properties associated with an "AnyValue", this +/// is similar to the current `AttributeSpec` as at the proto level an Attribute +/// is defined as a "KeyValue". +/// While this is (currently) a duplication of the existing AttributeSpec, this is +/// to reduce the size of the change set. +#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash, JsonSchema)] +#[serde(deny_unknown_fields)] +#[serde(rename_all = "snake_case")] +pub struct AnyValueCommonSpec { + /// String that uniquely identifies the enum entry. + pub id: String, + /// A brief description of the value + #[serde(skip_serializing_if = "String::is_empty")] + #[serde(default)] + pub brief: String, + /// A more elaborate description of the value. + /// It defaults to an empty string. + #[serde(skip_serializing_if = "String::is_empty")] + #[serde(default)] + pub note: String, + /// Specifies the stability of the value. + #[serde(skip_serializing_if = "Option::is_none")] + pub stability: Option, + /// Sequence of examples for the value or single example + /// value. If only a single example is provided, it can + /// directly be reported without encapsulating it + /// into a sequence/dictionary. + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option, + /// Specifies if the field is mandatory. Can be "required", + /// "conditionally_required", "recommended" or "opt_in". When omitted, + /// the field is "recommended". When set to + /// "conditionally_required", the string provided as MUST + /// specify the conditions under which the field is required. + pub requirement_level: RequirementLevel, +} + +/// Implements a human readable display for AnyValueType. +impl Display for AnyValueSpec { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + AnyValueSpec::Map { .. } => write!(f, "map"), + AnyValueSpec::Boolean { .. } => write!(f, "boolean"), + AnyValueSpec::Int { .. } => write!(f, "int"), + AnyValueSpec::Double { .. } => write!(f, "double"), + AnyValueSpec::String { .. } => write!(f, "string"), + AnyValueSpec::Strings { .. } => write!(f, "string[]"), + AnyValueSpec::Ints { .. } => write!(f, "int[]"), + AnyValueSpec::Doubles { .. } => write!(f, "double[]"), + AnyValueSpec::Booleans { .. } => write!(f, "boolean[]"), + AnyValueSpec::Bytes { .. } => write!(f, "byte[]"), + AnyValueSpec::Undefined { .. } => write!(f, "undefined"), + AnyValueSpec::Enum { members, .. } => { + let entries = members + .iter() + .map(|m| m.id.clone()) + .collect::>() + .join(", "); + write!(f, "enum {{{}}}", entries) + } + } + } +} + +impl AnyValueSpec { + /// Returns the common value specification for each type. + #[must_use] + pub fn common(&self) -> &AnyValueCommonSpec { + match self { + AnyValueSpec::Boolean { common, .. } => common, + AnyValueSpec::Int { common, .. } => common, + AnyValueSpec::Double { common, .. } => common, + AnyValueSpec::String { common, .. } => common, + AnyValueSpec::Strings { common, .. } => common, + AnyValueSpec::Ints { common, .. } => common, + AnyValueSpec::Doubles { common, .. } => common, + AnyValueSpec::Booleans { common, .. } => common, + AnyValueSpec::Map { common, .. } => common, + AnyValueSpec::Bytes { common, .. } => common, + AnyValueSpec::Undefined { common, .. } => common, + AnyValueSpec::Enum { common, .. } => common, + } + } + + /// Returns true if the any value is required. + #[must_use] + pub fn is_required(&self) -> bool { + matches!( + self.common(), + AnyValueCommonSpec { + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Required), + .. + } + ) + } + + /// Returns the id of the any value. + #[must_use] + pub fn id(&self) -> String { + let AnyValueCommonSpec { id, .. } = self.common(); + id.clone() + } + + /// Returns the brief of the any value. + #[must_use] + pub fn brief(&self) -> String { + let AnyValueCommonSpec { brief, .. } = self.common(); + brief.clone() + } + + /// Returns the note of the any value. + #[must_use] + pub fn note(&self) -> String { + let AnyValueCommonSpec { note, .. } = self.common(); + note.clone() + } +} + +#[cfg(test)] +mod tests { + use std::fs; + + use crate::attribute::ValueSpec; + + use super::*; + + #[test] + fn test_anyvalue_field_format_type() { + #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash, JsonSchema)] + pub struct BodySpec { + pub body: AnyValueSpec, + } + + let map = AnyValueSpec::Map { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + fields: vec![ + AnyValueSpec::Enum { + common: AnyValueCommonSpec { + id: "id_enum".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + members: vec![EnumEntriesSpec { + id: "id".to_owned(), + value: ValueSpec::Int(42), + brief: Some("brief".to_owned()), + note: Some("note".to_owned()), + stability: None, + deprecated: None, + }], + }, + AnyValueSpec::Map { + common: AnyValueCommonSpec { + id: "id_map".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + fields: vec![ + AnyValueSpec::Int { + common: AnyValueCommonSpec { + id: "id_int".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Required, + ), + }, + }, + AnyValueSpec::Bytes { + common: AnyValueCommonSpec { + id: "id_bytes".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Required, + ), + }, + }, + AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "id_string".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Boolean { + common: AnyValueCommonSpec { + id: "id_bool".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Map { + common: AnyValueCommonSpec { + id: "id_nested_map".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + fields: vec![ + AnyValueSpec::Ints { + common: AnyValueCommonSpec { + id: "id_nested_int".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Doubles { + common: AnyValueCommonSpec { + id: "id_nested_bytes".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Strings { + common: AnyValueCommonSpec { + id: "id_nested_string".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Booleans { + common: AnyValueCommonSpec { + id: "id_nested_bool".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + ], + }, + ], + }, + AnyValueSpec::Int { + common: AnyValueCommonSpec { + id: "id_int".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Bytes { + common: AnyValueCommonSpec { + id: "id_bytes".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "id_string".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Recommended, + ), + }, + }, + AnyValueSpec::Boolean { + common: AnyValueCommonSpec { + id: "id_bool".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Double { + common: AnyValueCommonSpec { + id: "id_double".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + AnyValueSpec::Doubles { + common: AnyValueCommonSpec { + id: "id_doubles".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional, + ), + }, + }, + ], + }; + let body = BodySpec { body: map.clone() }; + + let expected_yaml = fs::read_to_string("data/expected/any_value.yaml") + .unwrap() + .replace("\r\n", "\n"); + + assert_eq!( + expected_yaml, + format!("{}", serde_yaml::to_string(&body).unwrap()), + "{}", + expected_yaml + ); + + let expected_json = fs::read_to_string("data/expected/any_value.json") + .unwrap() + .replace("\r\n", "\n"); + assert_eq!( + expected_json, + format!("{}", serde_json::to_string(&body).unwrap()), + "{}", + expected_json + ); + + assert_eq!(format!("{}", map), "map",); + + assert_eq!( + format!( + "{}", + AnyValueSpec::Boolean { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "boolean" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Int { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "int" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Double { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "double" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "string" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Strings { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "string[]" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Ints { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "int[]" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Doubles { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "double[]" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Booleans { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "boolean[]" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Bytes { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "byte[]" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Undefined { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + } + } + ), + "undefined" + ); + assert_eq!( + format!( + "{}", + AnyValueSpec::Enum { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + }, + members: vec![EnumEntriesSpec { + id: "id".to_owned(), + value: ValueSpec::Int(42), + brief: Some("brief".to_owned()), + note: Some("note".to_owned()), + stability: None, + deprecated: None, + }] + } + ), + "enum {id}" + ); + + assert_eq!( + format!( + "{}", + AnyValueSpec::Enum { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic( + BasicRequirementLevelSpec::Optional + ), + }, + members: vec![EnumEntriesSpec { + id: "entry1".to_owned(), + value: ValueSpec::Int(42), + brief: Some("brief".to_owned()), + note: Some("note".to_owned()), + stability: None, + deprecated: None, + }] + } + ), + "enum {entry1}" + ); + } +} diff --git a/crates/weaver_semconv/src/attribute.rs b/crates/weaver_semconv/src/attribute.rs index 324cc8b3..05db77a4 100644 --- a/crates/weaver_semconv/src/attribute.rs +++ b/crates/weaver_semconv/src/attribute.rs @@ -4,6 +4,7 @@ //! Attribute specification. +use crate::any_value::AnyValueSpec; use crate::stability::Stability; use crate::Error; use ordered_float::OrderedFloat; @@ -490,6 +491,73 @@ impl Examples { ), } } + + /// Validation logic for the any_value. + pub(crate) fn validate_any_value( + &self, + any_value: &AnyValueSpec, + group_id: &str, + path_or_url: &str, + ) -> WResult<(), Error> { + match (self, any_value) { + (Examples::Bool(_), AnyValueSpec::Boolean { .. }) + | (Examples::Int(_), AnyValueSpec::Int { .. }) + | (Examples::Double(_), AnyValueSpec::Double { .. }) + | (Examples::String(_), AnyValueSpec::String { .. }) + | (Examples::String(_), AnyValueSpec::Map { .. }) + | (Examples::Ints(_), AnyValueSpec::Int { .. }) + | (Examples::Doubles(_), AnyValueSpec::Double { .. }) + | (Examples::Bools(_), AnyValueSpec::Boolean { .. }) + | (Examples::Strings(_), AnyValueSpec::String { .. }) + | (Examples::Strings(_), AnyValueSpec::Map { .. }) + | (Examples::ListOfInts(_), AnyValueSpec::Ints { .. }) + | (Examples::ListOfDoubles(_), AnyValueSpec::Doubles { .. }) + | (Examples::ListOfBools(_), AnyValueSpec::Booleans { .. }) + | (Examples::ListOfStrings(_), AnyValueSpec::Strings { .. }) + | (Examples::ListOfStrings(_), AnyValueSpec::Map { .. }) => WResult::Ok(()), + (_, AnyValueSpec::Enum { .. }) + | (_, AnyValueSpec::Bytes { .. }) + | (_, AnyValueSpec::Undefined { .. }) => { + // enum, bytes, and undefined types are open so it's not possible to validate the examples + WResult::Ok(()) + } + // Only if future mode is disabled, we allow to have examples following + // the conventions used in semconv 1.27.0 and earlier. + (Examples::Ints(_), AnyValueSpec::Ints { .. }) + | (Examples::Doubles(_), AnyValueSpec::Doubles { .. }) + | (Examples::Bools(_), AnyValueSpec::Booleans { .. }) + | (Examples::Strings(_), AnyValueSpec::Strings { .. }) => WResult::OkWithNFEs( + (), + vec![Error::InvalidAnyValueExampleError { + path_or_url: path_or_url.to_owned(), + group_id: group_id.to_owned(), + value_id: any_value.id(), + error: format!("All examples SHOULD be of type `{}`", any_value), + }], + ), + (_, AnyValueSpec::Map { .. }) => WResult::OkWithNFEs( + (), + vec![Error::InvalidAnyValueExampleError { + path_or_url: path_or_url.to_owned(), + group_id: group_id.to_owned(), + value_id: any_value.id(), + error: format!( + "Examples for `{}` values MUST be a supported string type", + any_value + ), + }], + ), + _ => WResult::OkWithNFEs( + (), + vec![Error::InvalidAnyValueExampleError { + path_or_url: path_or_url.to_owned(), + group_id: group_id.to_owned(), + value_id: any_value.id(), + error: format!("All examples MUST be of type `{}`", any_value), + }], + ), + } + } } /// The different requirement level specifications. diff --git a/crates/weaver_semconv/src/group.rs b/crates/weaver_semconv/src/group.rs index a0211432..d0b64684 100644 --- a/crates/weaver_semconv/src/group.rs +++ b/crates/weaver_semconv/src/group.rs @@ -9,6 +9,7 @@ use std::fmt::{Display, Formatter}; use serde::{Deserialize, Serialize}; +use crate::any_value::AnyValueSpec; use crate::attribute::{AttributeSpec, AttributeType, PrimitiveOrArrayTypeSpec}; use crate::group::InstrumentSpec::{Counter, Gauge, Histogram, UpDownCounter}; use crate::stability::Stability; @@ -86,6 +87,10 @@ pub struct GroupSpec { pub name: Option, /// The readable name for attribute groups used when generating registry tables. pub display_name: Option, + /// The event body definition + /// Note: only valid if type is event + #[serde(skip_serializing_if = "Option::is_none")] + pub body: Option, } impl GroupSpec { @@ -114,11 +119,42 @@ impl GroupSpec { } // Field name is required if prefix is empty and if type is event. - if self.r#type == GroupType::Event && self.prefix.is_empty() && self.name.is_none() { + if self.r#type == GroupType::Event { + if self.body.is_some() && self.name.is_none() { + // Must have a name which is assigned to event.name for log based events + errors.push(Error::InvalidGroup { + path_or_url: path_or_url.to_owned(), + group_id: self.id.clone(), + error: "This group contains an event type with a body definition but the name is not set.".to_owned(), + }); + } + if self.body.is_none() && self.name.is_none() && self.prefix.is_empty() { + // This is ONLY for backward compatibility of span based events. + // Must have a name (whether explicit or via a prefix which will derive the name) + errors.push(Error::InvalidGroup { + path_or_url: path_or_url.to_owned(), + group_id: self.id.clone(), + error: "This group contains an event type but the name is not set and no prefix is defined.".to_owned(), + }); + } + + match validate_any_value_examples( + &mut errors, + self.body.as_ref(), + &self.id, + path_or_url, + ) { + WResult::Ok(_) => {} + WResult::OkWithNFEs(_, errs) => errors.extend(errs), + WResult::FatalErr(err) => return WResult::FatalErr(err), + } + } else if self.body.is_some() { + // Make sure that body is only used for events errors.push(Error::InvalidGroup { path_or_url: path_or_url.to_owned(), group_id: self.id.clone(), - error: "This group contains an event type but the prefix is empty and the name is not set.".to_owned(), + error: "This group contains a body field but the type is not set to event." + .to_owned(), }); } @@ -220,6 +256,54 @@ impl GroupSpec { } } +fn validate_any_value_examples( + errors: &mut Vec, + any_value: Option<&AnyValueSpec>, + group_id: &str, + path_or_url: &str, +) -> WResult<(), Error> { + if let Some(value) = any_value { + if let Some(examples) = &value.common().examples { + match examples.validate_any_value(value, group_id, path_or_url) { + WResult::Ok(_) => {} + WResult::OkWithNFEs(_, errs) => errors.extend(errs), + WResult::FatalErr(err) => return WResult::FatalErr(err), + } + } else { + match value { + AnyValueSpec::String { .. } | AnyValueSpec::Strings { .. } => { + errors.push(Error::InvalidAnyValueExampleError { + path_or_url: path_or_url.to_owned(), + group_id: group_id.to_owned(), + value_id: value.id(), + error: format!( + "This value is a {} but it does not contain any examples.", + if let AnyValueSpec::String { .. } = value { + "string" + } else { + "string array" + } + ), + }); + } + _ => {} + } + } + + if let AnyValueSpec::Map { fields, .. } = value { + for field in fields { + if let WResult::FatalErr(err) = + validate_any_value_examples(errors, Some(field), group_id, path_or_url) + { + return WResult::FatalErr(err); + } + } + } + } + + WResult::Ok(()) +} + /// The different types of groups (specification). #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Hash, Clone, JsonSchema)] #[serde(rename_all = "snake_case")] @@ -312,7 +396,8 @@ impl Display for InstrumentSpec { #[cfg(test)] mod tests { - use crate::attribute::Examples; + use crate::any_value::AnyValueCommonSpec; + use crate::attribute::{BasicRequirementLevelSpec, Examples, RequirementLevel}; use crate::Error::{CompoundError, InvalidExampleWarning, InvalidGroup, InvalidMetric}; use super::*; @@ -348,6 +433,7 @@ mod tests { unit: None, name: None, display_name: None, + body: None, }; assert!(group .validate("") @@ -413,7 +499,7 @@ mod tests { InvalidGroup { path_or_url: "".to_owned(), group_id: "test".to_owned(), - error: "This group contains an event type but the prefix is empty and the name is not set.".to_owned(), + error: "This group contains an event type but the name is not set and no prefix is defined.".to_owned(), }, ], ), @@ -451,6 +537,7 @@ mod tests { unit: None, name: None, display_name: None, + body: None, }; assert!(group .validate("") @@ -508,6 +595,183 @@ mod tests { ); } + #[test] + fn test_validate_event() { + let mut group = GroupSpec { + id: "test".to_owned(), + r#type: GroupType::Event, + name: Some("test_event".to_owned()), + brief: "test".to_owned(), + note: "test".to_owned(), + prefix: "test".to_owned(), + extends: None, + stability: Some(Stability::Deprecated), + deprecated: Some("true".to_owned()), + constraints: vec![], + span_kind: None, + events: vec![], + metric_name: None, + instrument: None, + unit: None, + display_name: None, + attributes: vec![], + body: Some(AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: Some(Examples::String("test".to_owned())), + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + }), + }; + assert!(group + .validate("") + .into_result_failing_non_fatal() + .is_ok()); + + // Examples are mandatory for string attributes. + group.body = Some(AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "string_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + }); + + let result = group.validate("").into_result_failing_non_fatal(); + assert_eq!( + Err(Error::InvalidAnyValueExampleError { + path_or_url: "".to_owned(), + group_id: "test".to_owned(), + value_id: "string_id".to_owned(), + error: "This value is a string but it does not contain any examples.".to_owned(), + },), + result + ); + + // Examples are mandatory for strings attributes. + group.body = Some(AnyValueSpec::Strings { + common: AnyValueCommonSpec { + id: "string_array_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + }); + let result = group.validate("").into_result_failing_non_fatal(); + assert_eq!( + Err(Error::InvalidAnyValueExampleError { + path_or_url: "".to_owned(), + group_id: "test".to_owned(), + value_id: "string_array_id".to_owned(), + error: "This value is a string array but it does not contain any examples." + .to_owned(), + },), + result + ); + + // Examples are not required for Maps. + group.body = Some(AnyValueSpec::Map { + common: AnyValueCommonSpec { + id: "map_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + fields: vec![AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "string_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: Some(Examples::String("test".to_owned())), + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + }], + }); + + assert!(group + .validate("") + .into_result_failing_non_fatal() + .is_ok()); + + // Examples are mandatory for string attributes even if nested + group.body = Some(AnyValueSpec::Map { + common: AnyValueCommonSpec { + id: "map_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + fields: vec![AnyValueSpec::String { + common: AnyValueCommonSpec { + id: "nested_string_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + }], + }); + + let result = group.validate("").into_result_failing_non_fatal(); + assert_eq!( + Err(Error::InvalidAnyValueExampleError { + path_or_url: "".to_owned(), + group_id: "test".to_owned(), + value_id: "nested_string_id".to_owned(), + error: "This value is a string but it does not contain any examples.".to_owned(), + },), + result + ); + + // Examples are mandatory for strings attributes even if nested + group.body = Some(AnyValueSpec::Map { + common: AnyValueCommonSpec { + id: "map_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + fields: vec![AnyValueSpec::Strings { + common: AnyValueCommonSpec { + id: "nested_strings_id".to_owned(), + brief: "brief".to_owned(), + note: "note".to_owned(), + stability: None, + examples: None, + requirement_level: RequirementLevel::Basic(BasicRequirementLevelSpec::Optional), + }, + }], + }); + + let result = group.validate("").into_result_failing_non_fatal(); + assert_eq!( + Err(Error::InvalidAnyValueExampleError { + path_or_url: "".to_owned(), + group_id: "test".to_owned(), + value_id: "nested_strings_id".to_owned(), + error: "This value is a string array but it does not contain any examples." + .to_owned(), + },), + result + ); + } + #[test] fn test_instrumentation_spec() { assert_eq!(Counter.to_string(), "counter"); diff --git a/crates/weaver_semconv/src/lib.rs b/crates/weaver_semconv/src/lib.rs index fc43344c..e8c8b0ff 100644 --- a/crates/weaver_semconv/src/lib.rs +++ b/crates/weaver_semconv/src/lib.rs @@ -8,6 +8,7 @@ use serde::Serialize; use weaver_common::diagnostic::{DiagnosticMessage, DiagnosticMessages}; use weaver_common::error::{format_errors, WeaverError}; +pub mod any_value; pub mod attribute; pub mod group; pub mod metric; @@ -128,6 +129,20 @@ pub enum Error { error: String, }, + /// This indicates that a semantic convention asset contains an invalid example. + #[error("The value `{value_id}` in the group `{group_id}` contains an invalid example. {error}.\nProvenance: {path_or_url:?}")] + #[diagnostic(severity(Error))] + InvalidAnyValueExampleError { + /// The path or URL of the semantic convention asset. + path_or_url: String, + /// The group id of the attribute. + group_id: String, + /// The id of the any_value + value_id: String, + /// The reason of the error. + error: String, + }, + /// A container for multiple errors. #[error("{:?}", format_errors(.0))] CompoundError(#[related] Vec), @@ -178,6 +193,7 @@ mod tests { "data/cloudevents.yaml", "data/database.yaml", "data/database-metrics.yaml", + "data/event.yaml", "data/exception.yaml", "data/faas.yaml", "data/faas-common.yaml", diff --git a/crates/weaver_semconv/src/registry.rs b/crates/weaver_semconv/src/registry.rs index 5e4b7978..352528bf 100644 --- a/crates/weaver_semconv/src/registry.rs +++ b/crates/weaver_semconv/src/registry.rs @@ -280,6 +280,7 @@ mod tests { events: vec![], name: None, display_name: Some("Group 1".to_owned()), + body: None, }], }, ), @@ -304,6 +305,7 @@ mod tests { events: vec![], name: None, display_name: Some("Group 2".to_owned()), + body: None, }], }, ), diff --git a/schemas/semconv-syntax.md b/schemas/semconv-syntax.md index 88597346..878dc813 100644 --- a/schemas/semconv-syntax.md +++ b/schemas/semconv-syntax.md @@ -15,9 +15,11 @@ Then, the semantic of each field is described. - [Semantic Convention](#semantic-convention) - [Span semantic convention](#span-semantic-convention) - [Event semantic convention](#event-semantic-convention) + - [Event semantic convention example](#event-semantic-convention-example) - [Metric Group semantic convention](#metric-group-semantic-convention) - [Metric semantic convention](#metric-semantic-convention) - [Attribute group semantic convention](#attribute-group-semantic-convention) + - [Any Value semantic convention](#any-value-semantic-convention) - [Attributes](#attributes) - [Examples (for examples)](#examples-for-examples) - [Ref](#ref) @@ -45,8 +47,8 @@ semconv ::= id [convtype] brief [note] [extends] stability [deprecated] [display id ::= string convtype ::= "span" # Default if not specified - | "resource" # see spanspecificfields - | "event" # see eventspecificfields + | "resource" # see spansfields + | "event" # see eventfields | "metric" # see metricfields | "attribute_group" # no specific fields defined @@ -62,7 +64,7 @@ deprecated ::= display_name ::= string -attributes ::= (id type brief examples | ref [brief] [examples]) [tag] stability [deprecated] [required] [sampling_relevant] [note] +attributes ::= (id type brief examples | ref [brief] [examples]) [tag] stability [deprecated] [requirement_level] [sampling_relevant] [note] # ref MUST point to an existing attribute id ref ::= id @@ -102,7 +104,27 @@ specificfields ::= spanfields | metricfields spanfields ::= [events] [span_kind] -eventfields ::= [name] + +eventfields ::= name [body] + +body ::= any_value + +any_value_type ::= "map" + | "string" + | "int" + | "double" + | "boolean" + | "string[]" + | "int[]" + | "double[]" + | "boolean[]" + | "byte[]" + | "enum" + | "undefined" + +any_value ::= id any_value_type brief [examples] stability [deprecated] requirement_level [note] [fields] [members] + +fields ::= any_value {any_value} span_kind ::= "client" | "server" @@ -159,6 +181,68 @@ The following is only valid if `type` is `span` (the default): The following is only valid if `type` is `event`: - `name`, required, string. The name of the event. +- `body`, optional, [`any value`](#any-value-semantic-convention). Describes the body of the event as an any_value type. + +##### Event semantic convention example + + ```yaml + - id: event.some_event + name: the.event.name + type: event + brief: "Describes the event." + stability: experimental + attributes: # Optional + - ref: registry.attribute.id + - ref: registry.some_other.attribute.id # Reference to an existing global attribute + body: # Optional, follows the any_value conventions + id: event_body.some_event.fields + type: map + requirement_level: required + fields: # Unique to this event definition only + - id: method + type: string + stability: experimental + brief: "The HTTP method used in the request." + examples: ['GET', 'POST'] + requirement_level: required + - id: url + type: string + stability: experimental + brief: "The URL of the request." + examples: ['http://example.com'] + requirement_level: required + - id: status_code + type: int + stability: experimental + brief: "The status code of the response." + examples: [200, 404] + requirement_level: required + - id: nested_map + type: map + stability: experimental + requirement_level: required + fields: + - id: nested_field + type: string # May be any supported any_value type + stability: experimental + requirement_level: required + brief: "A nested field." + examples: ['nested_value'] + - id: nested_enum_state + type: enum + stability: experimental + requirement_level: required + members: + - id: active + value: 'active' + brief: The state became active. + - id: inactive + value: 'inactive' + brief: The state became inactive. + - id: background + value: 'background' + brief: The state is now in the background. +``` #### Metric Group semantic convention @@ -186,6 +270,40 @@ Attribute group (`attribute_group` type) defines a set of attributes that can be declared once and referenced by semantic conventions for different signals, for example spans and logs. Attribute groups don't have any specific fields and follow the general `semconv` semantics. +#### Any Value semantic convention + +Describes the type of the value of an extended (log) attribute or the body of an event. + +- `id`, required, string. The name of the field / any value. +- `type`, either a string literal denoting the type as a primitive or an array type, [an enum definition](#enumeration) or a map of fields. Required. + The accepted string literals are: + * `"string"`: String value. + * `"int"`: Integer value. + * `"double"`: Double value. + * `"boolean"`: Boolean value. + * `"string[]"`: Array of strings value. + * `"int[]"`: Array of integer value. + * `"double[]"`: Array of double value. + * `"boolean[]"`: Array of boolean value. + * `"byte[]"`: Array of bytes value. + * `"map"`: Map of any_value types. + * The `fields` field is required and contains a list of any_value entries that describe each field of the map. + * `"enum"`: Enumerated value. + * The `members` field is required and contains a list of enum entries. + * `"undefined"`: The actually format of the value is not defined. +- `brief`, `note`, `deprecated`, `stability`, same meaning as for the whole + [semantic convention](#semantic-convention), but per field. +- `requirement_level`, required. Specifies if the field is mandatory. + Can be "required", "conditionally_required", "recommended" or "opt_in". When omitted, the field is "recommended". + When set to "conditionally_required", the string provided as `` MUST specify + the conditions under which the field is required. +- `examples`, sequence of example values for the field or single example value. + They are required only for string and string array fields. + Example values must be of the same type of the field or for a map of fields, the type can be of a string type. + If only a single example is provided, it can directly be reported without encapsulating it into a sequence/dictionary. See [below](#examples-for-examples). +- `fields`, required only when the type is `map`, list of any value entries that describe each field of the map. +- `members`, required only when the type is `enum`, list of enum entries. See [below](#enumeration). + ### Attributes An attribute is defined by: @@ -356,3 +474,4 @@ An enum entry has the following fields: - `note`, optional string, longer description. It defaults to an empty string. - `stability`, required stability level. Attributes marked as experimental cannot have stable members. - `deprecated`, optional string, similarly to semantic convention and attribute deprecation, marks specific member as deprecated. + diff --git a/schemas/semconv.schema.json b/schemas/semconv.schema.json index a4d89018..65c7ecd6 100644 --- a/schemas/semconv.schema.json +++ b/schemas/semconv.schema.json @@ -150,6 +150,9 @@ "name": { "type": "string", "description": "The name of the event." + }, + "body": { + "$ref": "#/$defs/AnyValueSemanticConvention" } }, "anyOf": [ @@ -160,6 +163,150 @@ } ] }, + "AnyValueSemanticConvention": { + "type": "object", + "required": [ + "type", + "id", + "requirement_level" + ], + "properties": { + "id": { + "type": "string", + "description": "unique string" + }, + "type": { + "$ref": "#/$defs/AnyValueType" + }, + "brief": { + "type": "string", + "description": "a brief description of the value." + }, + "note": { + "type": "string", + "description": "a more elaborate description of the value. It defaults to an empty string." + }, + "stability": { + "allOf": [ + { + "$ref": "#/$defs/StabilityLevel" + } + ] + }, + "requirement_level": { + "description": "specifies the any value requirement level. Can be 'required', 'conditionally_required', 'recommended', or 'opt_in'. When omitted, the value is 'recommended'. When set to 'conditionally_required', the string provided MUST specify the conditions under which the value is required.", + "oneOf": [ + { + "const": "required" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "conditionally_required" + ], + "properties": { + "conditionally_required": { + "type": "string" + } + } + }, + { + "oneOf": [ + { + "const": "recommended" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "recommended" + ], + "properties": { + "recommended": { + "type": "string" + } + } + } + ] + }, + { + "const": "opt_in" + } + ] + }, + "examples": { + "anyOf": [ + { + "$ref": "#/$defs/ValueType" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ValueType" + } + } + ], + "description": "sequence/dictionary of example values. They are optional for boolean, int, double, and enum attributes. Example values must be of the same type as the value. If only a single example is provided, it can directly be reported without encapsulating it into a sequence/dictionary." + }, + "deprecated": { + "type": "string", + "description": "specifies if the value is deprecated. The string provided as MUST specify why it's deprecated and/or what to use instead." + }, + "fields": { + "type": "array", + "description": "when the type is map, this identifies the child (nested) any values associated with the map.", + "items": { + "$ref": "#/$defs/AnyValueSemanticConvention" + } + }, + "members": { + "type": "array", + "description": "when the type is enum, this identifies the enum members.", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "value", + "stability" + ], + "properties": { + "id": { + "type": "string", + "description": "string unique" + }, + "value": { + "type": [ + "string", + "number" + ], + "description": "string or number, value of the enum entry." + }, + "brief": { + "type": "string", + "description": "brief description of the enum entry value. It defaults to the value of ID." + }, + "note": { + "type": "string", + "description": "longer description. It defaults to an empty string." + }, + "deprecated": { + "type": "string", + "description": "specifies if the attribute is deprecated. The string provided as MUST specify why it's deprecated and/or what to use instead." + }, + "stability": { + "allOf": [ + { + "$ref": "#/$defs/StabilityLevel" + } + ] + } + } + } + } + } + }, "MetricSemanticConvention": { "allOf": [ { @@ -280,34 +427,8 @@ "description": "unique string" }, "type": { - "oneOf": [ - { - "type": "string", - "enum": [ - "string", - "int", - "double", - "boolean", - "string[]", - "int[]", - "double[]", - "boolean[]", - "template[string]", - "template[int]", - "template[double]", - "template[boolean]", - "template[string[]]", - "template[int[]]", - "template[double[]]", - "template[boolean[]]" - ], - "description": "literal denoting the type" - }, - { - "$ref": "#/$defs/AttributeEnumType" - } - ] - } + "$ref": "#/$defs/AttributeType" + } } }, "AttributeReference": { @@ -442,6 +563,59 @@ ] } ] + }, + "AttributeType": { + "description": "specifies the supported attribute types.", + "oneOf": [ + { + "type": "string", + "enum": [ + "string", + "int", + "double", + "boolean", + "string[]", + "int[]", + "double[]", + "boolean[]", + "template[string]", + "template[int]", + "template[double]", + "template[boolean]", + "template[string[]]", + "template[int[]]", + "template[double[]]", + "template[boolean[]]" + ], + "description": "literal denoting the type" + }, + { + "$ref": "#/$defs/AttributeEnumType" + } + ] + }, + "AnyValueType": { + "description": "specifies the supported any value types.", + "oneOf": [ + { + "type": "string", + "enum": [ + "string", + "int", + "double", + "boolean", + "string[]", + "int[]", + "double[]", + "boolean[]", + "map", + "byte[]", + "enum", + "undefined" + ], + "description": "literal denoting the type" + } + ] } } }