groups:
  - id: registry.db
    prefix: db
    type: attribute_group
    brief: >
      This group defines the attributes used to describe telemetry in the context of databases.
    attributes:
      - id: collection.name
        type: string
        stability: experimental
        brief: The name of a collection (table, container) within the database.
        note: >
          It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

          If the collection name is parsed from the query text, it SHOULD be the first collection name found in the query
          and it SHOULD match the value provided in the query text including any schema and database name prefix.

          For batch operations, if the individual operations are known to have the same collection name
          then that collection name SHOULD be used, otherwise `db.collection.name` SHOULD NOT be captured.
        examples: ['public.users', 'customers']
      - id: namespace
        type: string
        stability: experimental
        brief: >
          The name of the database, fully qualified within the server address and port.
        note: >
          If a database system has multiple namespace components, they SHOULD be concatenated
          (potentially using database system specific conventions) from most general to most
          specific namespace component, and more specific namespaces SHOULD NOT be captured without
          the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid.

          Semantic conventions for individual database systems SHOULD document what `db.namespace`
          means in the context of that system.

          It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
        examples: [ 'customers', 'test.users' ]
      - id: operation.name
        type: string
        stability: experimental
        brief: >
          The name of the operation or command being executed.
        note: >
          It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

          If the operation name is parsed from the query text, it SHOULD be the first operation name found in the query.

          For batch operations, if the individual operations are known to have the same operation name
          then that operation name SHOULD be used prepended by `BATCH `,
          otherwise `db.operation.name` SHOULD be `BATCH` or some other database system specific term if more applicable.
        examples: ['findAndModify', 'HMSET', 'SELECT']
      - id: query.text
        type: string
        stability: experimental
        brief: >
          The database query being executed.
        note: >
          For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).

          For batch operations, if the individual operations are known to have the same query text
          then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated
          with separator `; ` or some other database system specific separator if more applicable.

          Even though parameterized query text can potentially have sensitive data, by using a parameterized query
          the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit
          to observability of capturing the static part of the query text by default outweighs the risk.
        examples: ['SELECT * FROM wuser_table where username = ?', 'SET mykey "WuValue"']
      - id: query.parameter
        type: template[string]
        stability: experimental
        brief: >
          A query parameter used in `db.query.text`, with `<key>` being the parameter name,
          and the attribute value being a string representation of the parameter value.
        note: >
          Query parameters should only be captured when `db.query.text` is parameterized with placeholders.

          If a parameter has no name and instead is referenced only by index,
          then `<key>` SHOULD be the 0-based index.
        examples: ['someval', '55']
      - id: operation.batch.size
        type: int
        stability: experimental
        brief: The number of queries included in a [batch operation](/docs/database/database-spans.md#batch-operations).
        note: >
          Operations are only considered batches when they contain two or more operations,
          and so `db.operation.batch.size` SHOULD never be `1`.
        examples: [ 2, 3, 4 ]
      - id: system
        brief: The database management system (DBMS) product as identified by the client instrumentation.
        note: >
          The actual DBMS may differ from the one identified by the client.
          For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system`
          is set to `postgresql` based on the instrumentation's best knowledge.
        type:
          allow_custom_values: true
          members:
            - id: other_sql
              value: 'other_sql'
              brief: 'Some other SQL database. Fallback only. See notes.'
              stability: experimental
            - id: adabas
              value: 'adabas'
              brief: 'Adabas (Adaptable Database System)'
              stability: experimental
            - id: cache
              value: 'cache'
              deprecated: "Replaced by `intersystems_cache`."
              brief: "Deprecated, use `intersystems_cache` instead."
              stability: experimental
            - id: intersystems_cache
              value: 'intersystems_cache'
              brief: "InterSystems Caché"
              stability: experimental
            - id: cassandra
              value: 'cassandra'
              brief: 'Apache Cassandra'
              stability: experimental
            - id: clickhouse
              value: 'clickhouse'
              brief: 'ClickHouse'
              stability: experimental
            - id: cloudscape
              value: 'cloudscape'
              deprecated: "Replaced by `other_sql`."
              brief: "Deprecated, use `other_sql` instead."
              stability: experimental
            - id: cockroachdb
              value: 'cockroachdb'
              brief: 'CockroachDB'
              stability: experimental
            - id: coldfusion
              value: 'coldfusion'
              deprecated: "Removed."
              brief: "Deprecated, no replacement at this time."
              stability: experimental
            - id: cosmosdb
              value: 'cosmosdb'
              brief: 'Microsoft Azure Cosmos DB'
              stability: experimental
            - id: couchbase
              value: 'couchbase'
              brief: 'Couchbase'
              stability: experimental
            - id: couchdb
              value: 'couchdb'
              brief: 'CouchDB'
              stability: experimental
            - id: db2
              value: 'db2'
              brief: 'IBM Db2'
              stability: experimental
            - id: derby
              value: 'derby'
              brief: 'Apache Derby'
              stability: experimental
            - id: dynamodb
              value: 'dynamodb'
              brief: 'Amazon DynamoDB'
              stability: experimental
            - id: edb
              value: 'edb'
              brief: 'EnterpriseDB'
              stability: experimental
            - id: elasticsearch
              value: 'elasticsearch'
              brief: 'Elasticsearch'
              stability: experimental
            - id: filemaker
              value: 'filemaker'
              brief: 'FileMaker'
              stability: experimental
            - id: firebird
              value: 'firebird'
              brief: 'Firebird'
              stability: experimental
            - id: firstsql
              value: 'firstsql'
              deprecated: "Replaced by `other_sql`."
              brief: "Deprecated, use `other_sql` instead."
              stability: experimental
            - id: geode
              value: 'geode'
              brief: 'Apache Geode'
              stability: experimental
            - id: h2
              value: 'h2'
              brief: 'H2'
              stability: experimental
            - id: hanadb
              value: 'hanadb'
              brief: 'SAP HANA'
              stability: experimental
            - id: hbase
              value: 'hbase'
              brief: 'Apache HBase'
              stability: experimental
            - id: hive
              value: 'hive'
              brief: 'Apache Hive'
              stability: experimental
            - id: hsqldb
              value: 'hsqldb'
              brief: 'HyperSQL DataBase'
              stability: experimental
            - id: influxdb
              value: 'influxdb'
              brief: 'InfluxDB'
              stability: experimental
            - id: informix
              value: 'informix'
              brief: 'Informix'
              stability: experimental
            - id: ingres
              value: 'ingres'
              brief: 'Ingres'
              stability: experimental
            - id: instantdb
              value: 'instantdb'
              brief: 'InstantDB'
              stability: experimental
            - id: interbase
              value: 'interbase'
              brief: 'InterBase'
              stability: experimental
            - id: mariadb
              value: 'mariadb'
              brief: 'MariaDB'
              stability: experimental
            - id: maxdb
              value: 'maxdb'
              brief: 'SAP MaxDB'
              stability: experimental
            - id: memcached
              value: 'memcached'
              brief: 'Memcached'
              stability: experimental
            - id: mongodb
              value: 'mongodb'
              brief: 'MongoDB'
              stability: experimental
            - id: mssql
              value: 'mssql'
              brief: 'Microsoft SQL Server'
              stability: experimental
            - id: mssqlcompact
              value: 'mssqlcompact'
              deprecated: "Removed, use `other_sql` instead."
              brief: "Deprecated, Microsoft SQL Server Compact is discontinued."
              stability: experimental
            - id: mysql
              value: 'mysql'
              brief: 'MySQL'
              stability: experimental
            - id: neo4j
              value: 'neo4j'
              brief: 'Neo4j'
              stability: experimental
            - id: netezza
              value: 'netezza'
              brief: 'Netezza'
              stability: experimental
            - id: opensearch
              value: 'opensearch'
              brief: 'OpenSearch'
              stability: experimental
            - id: oracle
              value: 'oracle'
              brief: 'Oracle Database'
              stability: experimental
            - id: pervasive
              value: 'pervasive'
              brief: 'Pervasive PSQL'
              stability: experimental
            - id: pointbase
              value: 'pointbase'
              brief: 'PointBase'
              stability: experimental
            - id: postgresql
              value: 'postgresql'
              brief: 'PostgreSQL'
              stability: experimental
            - id: progress
              value: 'progress'
              brief: 'Progress Database'
              stability: experimental
            - id: redis
              value: 'redis'
              brief: 'Redis'
              stability: experimental
            - id: redshift
              value: 'redshift'
              brief: 'Amazon Redshift'
              stability: experimental
            - id: spanner
              value: 'spanner'
              brief: 'Cloud Spanner'
              stability: experimental
            - id: sqlite
              value: 'sqlite'
              brief: 'SQLite'
              stability: experimental
            - id: sybase
              value: 'sybase'
              brief: 'Sybase'
              stability: experimental
            - id: teradata
              value: 'teradata'
              brief: 'Teradata'
              stability: experimental
            - id: trino
              value: 'trino'
              brief: 'Trino'
              stability: experimental
            - id: vertica
              value: 'vertica'
              brief: 'Vertica'
              stability: experimental
        stability: experimental
      - id: client.connection.state
        stability: experimental
        type:
          allow_custom_values: true
          members:
            - id: idle
              value: 'idle'
              stability: experimental
            - id: used
              value: 'used'
              stability: experimental
        brief: "The state of a connection in the pool"
        examples: ["idle"]
      - id: client.connection.pool.name
        type: string
        stability: experimental
        brief: >
          The name of the connection pool; unique within the instrumented application.
          In case the connection pool implementation doesn't provide a name,
          instrumentation should use a combination of `server.address` and `server.port` attributes
          formatted as `server.address:server.port`.
        examples: ["myDataSource"]
  - id: registry.db.cassandra
    prefix: db
    type: attribute_group
    brief: >
      This group defines attributes for Cassandra.
    attributes:
      - id: cassandra.coordinator.dc
        type: string
        stability: experimental
        brief: >
          The data center of the coordinating node for a query.
        examples: 'us-west-2'
      - id: cassandra.coordinator.id
        type: string
        stability: experimental
        brief: >
          The ID of the coordinating node for a query.
        examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af'
      - id: cassandra.consistency_level
        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).
        type:
          members:
            - id: all
              value: 'all'
              stability: experimental
            - id: each_quorum
              value: 'each_quorum'
              stability: experimental
            - id: quorum
              value: 'quorum'
              stability: experimental
            - id: local_quorum
              value: 'local_quorum'
              stability: experimental
            - id: one
              value: 'one'
              stability: experimental
            - id: two
              value: 'two'
              stability: experimental
            - id: three
              value: 'three'
              stability: experimental
            - id: local_one
              value: 'local_one'
              stability: experimental
            - id: any
              value: 'any'
              stability: experimental
            - id: serial
              value: 'serial'
              stability: experimental
            - id: local_serial
              value: 'local_serial'
              stability: experimental
        stability: experimental
      - id: cassandra.idempotence
        type: boolean
        stability: experimental
        brief: >
          Whether or not the query is idempotent.
      - id: cassandra.page_size
        type: int
        stability: experimental
        brief: >
          The fetch size used for paging, i.e. how many rows will be returned at once.
        examples: [5000]
      - id: cassandra.speculative_execution_count
        type: int
        stability: experimental
        brief: >
          The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.
        examples: [0, 2]
  - id: registry.db.cosmosdb
    prefix: db
    type: attribute_group
    brief: >
      This group defines attributes for Azure Cosmos DB.
    attributes:
      - id: cosmosdb.client_id
        type: string
        stability: experimental
        brief: Unique Cosmos client instance id.
        examples: '3ba4827d-4422-483f-b59f-85b74211c11d'
      - id: cosmosdb.connection_mode
        type:
          allow_custom_values: false
          members:
            - id: gateway
              value: 'gateway'
              brief: Gateway (HTTP) connections mode
              stability: experimental
            - id: direct
              value: 'direct'
              brief: Direct connection.
              stability: experimental
        stability: experimental
        brief: Cosmos client connection mode.
      - id: cosmosdb.operation_type
        type:
          allow_custom_values: true
          members:
            - id: invalid
              value: 'Invalid'
              stability: experimental
            - id: create
              value: 'Create'
              stability: experimental
            - id: patch
              value: 'Patch'
              stability: experimental
            - id: read
              value: 'Read'
              stability: experimental
            - id: read_feed
              value: 'ReadFeed'
              stability: experimental
            - id: delete
              value: 'Delete'
              stability: experimental
            - id: replace
              value: 'Replace'
              stability: experimental
            - id: execute
              value: 'Execute'
              stability: experimental
            - id: query
              value: 'Query'
              stability: experimental
            - id: head
              value: 'Head'
              stability: experimental
            - id: head_feed
              value: 'HeadFeed'
              stability: experimental
            - id: upsert
              value: 'Upsert'
              stability: experimental
            - id: batch
              value: 'Batch'
              stability: experimental
            - id: query_plan
              value: 'QueryPlan'
              stability: experimental
            - id: execute_javascript
              value: 'ExecuteJavaScript'
              stability: experimental
        stability: experimental
        brief: CosmosDB Operation Type.
      - id: cosmosdb.request_charge
        type: double
        stability: experimental
        brief: RU consumed for that operation
        examples: [46.18, 1.0]
      - id: cosmosdb.request_content_length
        type: int
        stability: experimental
        brief: Request payload size in bytes
      - id: cosmosdb.status_code
        type: int
        stability: experimental
        brief: Cosmos DB status code.
        examples: [200, 201]
      - id: cosmosdb.sub_status_code
        type: int
        stability: experimental
        brief: Cosmos DB sub status code.
        examples: [1000, 1002]
  - id: registry.db.elasticsearch
    prefix: db
    type: attribute_group
    brief: >
      This group defines attributes for Elasticsearch.
    attributes:
      - id: elasticsearch.node.name
        type: string
        stability: experimental
        brief: >
          Represents the human-readable identifier of the node/instance to which a request was routed.
        examples: ["instance-0000000001"]
      - id: elasticsearch.path_parts
        type: template[string]
        stability: experimental
        brief: >
          A dynamic value in the url path.
        note: >
          Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format
          `db.elasticsearch.path_parts.<key>`, where `<key>` 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.
        examples: ['db.elasticsearch.path_parts.index=test-index', 'db.elasticsearch.path_parts.doc_id=123']
