Db Attributes

22 attributes in this category.15 stable·7 deprecated

22 attributes

Stable Attributes

db.collection.name

stringScrub: ManualVisibility: PublicOTel: True

The name of a collection (table, container) within the database.

Exampleusers
Changelog
v0.19.0#483Added db.mongodb.collection as an alias
v0.1.0#106#127
v0.0.0
Raw JSON
{
  "key": "db.collection.name",
  "brief": "The name of a collection (table, container) within the database.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "users",
  "alias": [
    "db.mongodb.collection"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        483
      ],
      "description": "Added db.mongodb.collection as an alias"
    },
    {
      "version": "0.1.0",
      "prs": [
        106,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.driver.name

stringScrub: ManualVisibility: PublicOTel: False

The name of the driver used for the database connection.

Examplepsycopg2
Changelog
v0.5.0#297Added db.driver.name attribute
Raw JSON
{
  "key": "db.driver.name",
  "brief": "The name of the driver used for the database connection.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "psycopg2",
  "changelog": [
    {
      "version": "0.5.0",
      "prs": [
        297
      ],
      "description": "Added db.driver.name attribute"
    }
  ]
}

db.namespace

stringScrub: ManualVisibility: PublicOTel: True

The name of the database being accessed.

Examplecustomers
Aliasesdb.name
Changelog
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "db.namespace",
  "brief": "The name of the database being accessed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "customers",
  "alias": [
    "db.name"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.operation.batch.size

integerScrub: ManualVisibility: PublicOTel: True

The number of queries included in a batch operation. Operations are only considered batches when they contain two or more operations, and so db.operation.batch.size SHOULD never be 1.

Example3
Changelog
v0.11.0#407Added db.operation.batch.size attribute
Raw JSON
{
  "key": "db.operation.batch.size",
  "brief": "The number of queries included in a batch operation. Operations are only considered batches when they contain two or more operations, and so db.operation.batch.size SHOULD never be 1.",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": 3,
  "changelog": [
    {
      "version": "0.11.0",
      "prs": [
        407
      ],
      "description": "Added db.operation.batch.size attribute"
    }
  ]
}

db.operation.name

stringScrub: ManualVisibility: PublicOTel: True

The name of the operation being executed.

Changelog
v0.19.0#531Added redis.command as an alias
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "db.operation.name",
  "brief": "The name of the operation being executed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "SELECT",
  "alias": [
    "db.operation",
    "cloudflare.d1.query_type",
    "redis.command"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        531
      ],
      "description": "Added redis.command as an alias"
    },
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.query.parameter.<key>

stringScrub: AutoVisibility: PublicOTel: TrueDynamic

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.

Exampledb.query.parameter.foo='123'
Dynamic SuffixYes - the key contains dynamic parts
Changelog
v0.1.0#103#127
Raw JSON
{
  "key": "db.query.parameter.<key>",
  "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.",
  "has_dynamic_suffix": true,
  "type": "string",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "db.query.parameter.foo='123'",
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        103,
        127
      ]
    }
  ]
}

db.query.summary

stringScrub: ManualVisibility: PublicOTel: True

A shortened representation of operation(s) in the full query. This attribute must be low-cardinality and should only contain the operation table names.

ExamplesSELECT usersINSERT products; UPDATE orders
Changelog
v0.19.0#505Added multiple examples
v0.4.0#208
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "db.query.summary",
  "brief": "A shortened representation of operation(s) in the full query. This attribute must be low-cardinality and should only contain the operation table names.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "examples": [
    "SELECT users",
    "INSERT products; UPDATE orders"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        505
      ],
      "description": "Added multiple examples"
    },
    {
      "version": "0.4.0",
      "prs": [
        208
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.query.text

stringScrub: ManualVisibility: PublicOTel: True

The database parameterized query being executed. Any parameter values (filters, insertion values, etc) should be replaced with parameter placeholders. If applicable, use `db.query.parameter.<key>` to add the parameter value.

ExampleSELECT * FROM users WHERE id = $1
Changelog
v0.19.0#530Added query as an alias
v0.4.0#208
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "db.query.text",
  "brief": "The database parameterized query being executed. Any parameter values (filters, insertion values, etc) should be replaced with parameter placeholders. If applicable, use `db.query.parameter.<key>` to add the parameter value.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "SELECT * FROM users WHERE id = $1",
  "alias": [
    "db.statement",
    "query"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        530
      ],
      "description": "Added query as an alias"
    },
    {
      "version": "0.4.0",
      "prs": [
        208
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.redis.connection

stringScrub: ManualVisibility: PublicOTel: False

The redis connection name.

Examplemy-redis-instance
Changelog
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "db.redis.connection",
  "brief": "The redis connection name.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "my-redis-instance",
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.redis.key

stringScrub: ManualVisibility: PublicOTel: False

The key the Redis command is operating on.

Exampleuser:2047:city
Aliasesredis.key
Changelog
v0.19.0#484Added redis.key as an alias
v0.6.0#326Added db.redis.key attribute
Raw JSON
{
  "key": "db.redis.key",
  "brief": "The key the Redis command is operating on.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "user:2047:city",
  "alias": [
    "redis.key"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        484
      ],
      "description": "Added redis.key as an alias"
    },
    {
      "version": "0.6.0",
      "prs": [
        326
      ],
      "description": "Added db.redis.key attribute"
    }
  ]
}

db.redis.parameters

string[]Scrub: AutoVisibility: PublicOTel: False

The array of command parameters given to a redis command.

Example["test","*"]
Changelog
v0.0.0
Raw JSON
{
  "key": "db.redis.parameters",
  "brief": "The array of command parameters given to a redis command.",
  "type": "string[]",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": [
    "test",
    "*"
  ],
  "changelog": [
    {
      "version": "0.0.0"
    }
  ]
}

db.response.status_code

stringScrub: ManualVisibility: PublicOTel: True

Database response status code. The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.

ExampleORA-17002
Changelog
v0.16.0#462Added db.response.status_code attribute
Raw JSON
{
  "key": "db.response.status_code",
  "brief": "Database response status code. The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "ORA-17002",
  "changelog": [
    {
      "version": "0.16.0",
      "prs": [
        462
      ],
      "description": "Added db.response.status_code attribute"
    }
  ]
}

db.stored_procedure.name

stringScrub: ManualVisibility: PublicOTel: True

The name of a stored procedure being called.

ExampleGetUserById
Changelog
v0.11.0#398
Raw JSON
{
  "key": "db.stored_procedure.name",
  "brief": "The name of a stored procedure being called.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "GetUserById",
  "changelog": [
    {
      "version": "0.11.0",
      "prs": [
        398
      ]
    }
  ]
}

db.system.name

stringScrub: ManualVisibility: PublicOTel: True

An identifier for the database management system (DBMS) product being used. See [OpenTelemetry docs](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md#notes-and-well-known-identifiers-for-dbsystem) for a list of well-known identifiers.

Examplepostgresql
Aliasesdb.system
Changelog
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "db.system.name",
  "brief": "An identifier for the database management system (DBMS) product being used. See [OpenTelemetry docs](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md#notes-and-well-known-identifiers-for-dbsystem) for a list of well-known identifiers.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "postgresql",
  "alias": [
    "db.system"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.user

stringScrub: ManualVisibility: PublicOTel: True

The database user.

Examplefancy_user
Changelog
v0.0.0
Raw JSON
{
  "key": "db.user",
  "brief": "The database user.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "fancy_user",
  "changelog": [
    {
      "version": "0.0.0"
    }
  ]
}

Deprecated Attributes

These attributes are deprecated and should not be used in new code. See each attribute for migration guidance.

db.mongodb.collectionDeprecated

stringScrub: ManualVisibility: PublicOTel: False

The MongoDB collection being accessed.

Exampleusers

Use db.collection.name instead.

This attribute is being deprecated in favor of db.collection.name, which is the OTel-aligned replacement.

Status: backfill

Changelog
v0.19.0#483Added db.mongodb.collection attribute, deprecated in favor of db.collection.name
Raw JSON
{
  "key": "db.mongodb.collection",
  "brief": "The MongoDB collection being accessed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": "users",
  "deprecation": {
    "replacement": "db.collection.name",
    "reason": "This attribute is being deprecated in favor of db.collection.name, which is the OTel-aligned replacement.",
    "_status": "backfill"
  },
  "alias": [
    "db.collection.name"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        483
      ],
      "description": "Added db.mongodb.collection attribute, deprecated in favor of db.collection.name"
    }
  ]
}

db.nameDeprecated

stringScrub: ManualVisibility: PublicOTel: True

The name of the database being accessed.

Examplecustomers

Use db.namespace instead.

Changelog
v0.1.0#61#127
v0.0.0
Raw JSON
{
  "key": "db.name",
  "brief": "The name of the database being accessed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "customers",
  "deprecation": {
    "replacement": "db.namespace",
    "_status": null
  },
  "alias": [
    "db.namespace"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        61,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.operationDeprecated

stringScrub: ManualVisibility: PublicOTel: True

The name of the operation being executed.

ExampleSELECT

Use db.operation.name instead.

Status: normalize

Changelog
v0.19.0#531Added redis.command as an alias
v0.4.0#199
v0.1.0#61#127
v0.0.0
Raw JSON
{
  "key": "db.operation",
  "brief": "The name of the operation being executed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "SELECT",
  "deprecation": {
    "replacement": "db.operation.name",
    "_status": "normalize"
  },
  "alias": [
    "db.operation.name",
    "cloudflare.d1.query_type",
    "redis.command"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        531
      ],
      "description": "Added redis.command as an alias"
    },
    {
      "version": "0.4.0",
      "prs": [
        199
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.paramsDeprecated

stringScrub: AutoVisibility: PublicOTel: False

The query bindings for a database request.

Examples[{"x": 100}]

Use db.query.parameter.<key> instead.

Instead of adding every binding in the db.params attribute, add them as individual entries with db.query.parameter.<key>.

Changelog
v0.19.0#529Added db.params attribute
Raw JSON
{
  "key": "db.params",
  "brief": "The query bindings for a database request.",
  "type": "string",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": false,
  "visibility": "public",
  "examples": [
    "[{\"x\": 100}]"
  ],
  "deprecation": {
    "replacement": "db.query.parameter.<key>",
    "reason": "Instead of adding every binding in the db.params attribute, add them as individual entries with db.query.parameter.<key>.",
    "_status": null
  },
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        529
      ],
      "description": "Added db.params attribute"
    }
  ]
}

db.sql.bindingsDeprecated

string[]Scrub: AutoVisibility: PublicOTel: False

The array of query bindings.

Example["1","foo"]

Use db.query.parameter.<key> instead.

Instead of adding every binding in the db.sql.bindings attribute, add them as individual entires with db.query.parameter.<key>.

Changelog
v0.1.0#61
v0.0.0
Raw JSON
{
  "key": "db.sql.bindings",
  "brief": "The array of query bindings.",
  "type": "string[]",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": [
    "1",
    "foo"
  ],
  "deprecation": {
    "replacement": "db.query.parameter.<key>",
    "reason": "Instead of adding every binding in the db.sql.bindings attribute, add them as individual entires with db.query.parameter.<key>.",
    "_status": null
  },
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        61
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.statementDeprecated

stringScrub: AutoVisibility: PublicOTel: True

The database statement being executed.

ExampleSELECT * FROM users WHERE id = $1

Use db.query.text instead.

While this attribute never specifically required parameterization, the replacement, db.query.text, does.

Status: normalize

Changelog
v0.19.0#501Improved example, added deprecation reason, and added query as an alias
v0.4.0#199
v0.1.0#61#127
v0.0.0
Raw JSON
{
  "key": "db.statement",
  "brief": "The database statement being executed.",
  "type": "string",
  "apply_scrubbing": {
    "key": "auto"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "SELECT * FROM users WHERE id = $1",
  "deprecation": {
    "replacement": "db.query.text",
    "reason": "While this attribute never specifically required parameterization, the replacement, db.query.text, does.",
    "_status": "normalize"
  },
  "alias": [
    "db.query.text",
    "query"
  ],
  "changelog": [
    {
      "version": "0.19.0",
      "prs": [
        501
      ],
      "description": "Improved example, added deprecation reason, and added query as an alias"
    },
    {
      "version": "0.4.0",
      "prs": [
        199
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.systemDeprecated

stringScrub: ManualVisibility: PublicOTel: True

An identifier for the database management system (DBMS) product being used. See [OpenTelemetry docs](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md#notes-and-well-known-identifiers-for-dbsystem) for a list of well-known identifiers.

Examplepostgresql

Use db.system.name instead.

Status: backfill

Changelog
v0.4.0#199#224
v0.1.0#61#127
v0.0.0
Raw JSON
{
  "key": "db.system",
  "brief": "An identifier for the database management system (DBMS) product being used. See [OpenTelemetry docs](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md#notes-and-well-known-identifiers-for-dbsystem) for a list of well-known identifiers.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": true,
  "visibility": "public",
  "example": "postgresql",
  "deprecation": {
    "replacement": "db.system.name",
    "_status": "backfill"
  },
  "alias": [
    "db.system.name"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        199,
        224
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}