Code Attributes

7 attributes in this category. 3 stable · 4 deprecated

Stable Attributes

code.file.path

string PII: Maybe OTel: True

The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).

Example /app/myapplication/http/handler/server.py
Aliases code.filepath
Raw JSON
{
  "key": "code.file.path",
  "brief": "The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).",
  "type": "string",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": "/app/myapplication/http/handler/server.py",
  "alias": [
    "code.filepath"
  ]
}

code.function.name

string PII: Maybe OTel: True

The method or function name, or equivalent (usually rightmost part of the code unit's name).

Example server_request
Aliases code.function
Raw JSON
{
  "key": "code.function.name",
  "brief": "The method or function name, or equivalent (usually rightmost part of the code unit's name).",
  "type": "string",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": "server_request",
  "alias": [
    "code.function"
  ]
}

code.line.number

integer PII: Maybe OTel: True

The line number in code.filepath best representing the operation. It SHOULD point within the code unit named in code.function

Example 42
Aliases code.lineno
Raw JSON
{
  "key": "code.line.number",
  "brief": "The line number in code.filepath best representing the operation. It SHOULD point within the code unit named in code.function",
  "type": "integer",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": 42,
  "alias": [
    "code.lineno"
  ]
}

Deprecated Attributes

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

code.filepath Deprecated

string PII: Maybe OTel: True

The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).

Example /app/myapplication/http/handler/server.py
Aliases code.file.path

Use code.file.path instead.

Raw JSON
{
  "key": "code.filepath",
  "brief": "The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).",
  "type": "string",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": "/app/myapplication/http/handler/server.py",
  "deprecation": {
    "replacement": "code.file.path",
    "_status": null
  },
  "alias": [
    "code.file.path"
  ]
}

code.function Deprecated

string PII: Maybe OTel: True

The method or function name, or equivalent (usually rightmost part of the code unit's name).

Example server_request
Aliases code.function.name

Use code.function.name instead.

Raw JSON
{
  "key": "code.function",
  "brief": "The method or function name, or equivalent (usually rightmost part of the code unit's name).",
  "type": "string",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": "server_request",
  "deprecation": {
    "replacement": "code.function.name",
    "_status": null
  },
  "alias": [
    "code.function.name"
  ]
}

code.lineno Deprecated

integer PII: Maybe OTel: True

The line number in code.filepath best representing the operation. It SHOULD point within the code unit named in code.function

Example 42
Aliases code.line.number

Use code.line.number instead.

Raw JSON
{
  "key": "code.lineno",
  "brief": "The line number in code.filepath best representing the operation. It SHOULD point within the code unit named in code.function",
  "type": "integer",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": 42,
  "deprecation": {
    "replacement": "code.line.number",
    "_status": null
  },
  "alias": [
    "code.line.number"
  ]
}

code.namespace Deprecated

string PII: Maybe OTel: True

The 'namespace' within which code.function is defined. Usually the qualified class or module name, such that code.namespace + some separator + code.function form a unique identifier for the code unit.

Example http.handler

Use code.function.name instead.

code.function.name should include the namespace.

Raw JSON
{
  "key": "code.namespace",
  "brief": "The 'namespace' within which code.function is defined. Usually the qualified class or module name, such that code.namespace + some separator + code.function form a unique identifier for the code unit.",
  "type": "string",
  "pii": {
    "key": "maybe"
  },
  "is_in_otel": true,
  "example": "http.handler",
  "deprecation": {
    "replacement": "code.function.name",
    "reason": "code.function.name should include the namespace.",
    "_status": null
  }
}