Db Attributes

20 attributes in this category. 15 stable · 5 deprecated

20 attributes

Stable Attributes

db.collection.name

string Scrub: Manual Visibility: Public OTel: True

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

Example users
Changelog
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",
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        106,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.driver.name

string Scrub: Manual Visibility: Public OTel: False

The name of the driver used for the database connection.

Example psycopg2
Changelog
v0.5.0 #297 Added 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

string Scrub: Manual Visibility: Public OTel: True

The name of the database being accessed.

Example customers
Aliases db.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

integer Scrub: Manual Visibility: Public OTel: 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.

Example 3
Changelog
v0.11.0 #407 Added 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

string Scrub: Manual Visibility: Public OTel: True

The name of the operation being executed.

Example SELECT
Changelog
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"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.query.parameter.<key>

string Scrub: Auto Visibility: Public OTel: True Dynamic

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.

Example db.query.parameter.foo='123'
Dynamic Suffix Yes - 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

string Scrub: Manual Visibility: Public OTel: 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.

Examples SELECT usersINSERT products; UPDATE orders
Changelog
next #505 Added 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": "next",
      "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

string Scrub: Manual Visibility: Public OTel: 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.

Example SELECT * FROM users WHERE id = $1
Aliases db.statement
Changelog
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"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        208
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.redis.connection

string Scrub: Manual Visibility: Public OTel: False

The redis connection name.

Example my-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

string Scrub: Manual Visibility: Public OTel: False

The key the Redis command is operating on.

Example user:2047:city
Changelog
v0.6.0 #326 Added 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",
  "changelog": [
    {
      "version": "0.6.0",
      "prs": [
        326
      ],
      "description": "Added db.redis.key attribute"
    }
  ]
}

db.redis.parameters

string[] Scrub: Auto Visibility: Public OTel: 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

string Scrub: Manual Visibility: Public OTel: 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.

Example ORA-17002
Changelog
v0.16.0 #462 Added 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

string Scrub: Manual Visibility: Public OTel: True

The name of a stored procedure being called.

Example GetUserById
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

string Scrub: Manual Visibility: Public OTel: 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.

Example postgresql
Aliases db.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

string Scrub: Manual Visibility: Public OTel: True

The database user.

Example fancy_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.name Deprecated

string Scrub: Manual Visibility: Public OTel: True

The name of the database being accessed.

Example customers
Aliases db.namespace

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.operation Deprecated

string Scrub: Manual Visibility: Public OTel: True

The name of the operation being executed.

Example SELECT

Use db.operation.name instead.

Status: normalize

Changelog
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"
  ],
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        199
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.sql.bindings Deprecated

string[] Scrub: Auto Visibility: Public OTel: 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.statement Deprecated

string Scrub: Auto Visibility: Public OTel: True

The database statement being executed.

Example SELECT * FROM users WHERE id = $1
Aliases db.query.text

Use db.query.text instead.

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

Status: normalize

Changelog
next #501 Improved example and added deprecation reason
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"
  ],
  "changelog": [
    {
      "version": "next",
      "prs": [
        501
      ],
      "description": "Improved example and added deprecation reason"
    },
    {
      "version": "0.4.0",
      "prs": [
        199
      ]
    },
    {
      "version": "0.1.0",
      "prs": [
        61,
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

db.system Deprecated

string Scrub: Manual Visibility: Public OTel: 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.

Example postgresql
Aliases db.system.name

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"
    }
  ]
}