Cache Attributes

8 attributes in this category.8 stable

8 attributes

Stable Attributes

cache.hit

booleanScrub: ManualVisibility: PublicOTel: False

If the cache was hit during this span.

Exampletrue
Changelog
v0.0.0
Raw JSON
{
  "key": "cache.hit",
  "brief": "If the cache was hit during this span.",
  "type": "boolean",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": true,
  "changelog": [
    {
      "version": "0.0.0"
    }
  ]
}

cache.item_age

integerScrub: ManualVisibility: PublicOTel: False

The age of the cache entry in seconds, measured at read time.

Examples53600
Search AliasHow this attribute is exposed in Sentry search. Query it by this name instead of the attribute key.
Namecache.item_age
Typesecond
Additional Context
  • Set on reads that return an entry. Absent on a miss, or when the cache does not report a write time.
  • Clamped to 0. On a shared cache, the writer's clock and the reader's clock can drift far enough to make the age negative.
  • Can exceed `cache.ttl`. A cache that discards an expired entry on read still reports the age of that entry, with `cache.hit: false`.
Changelog
v0.23.0#637Added cache.item_age attribute
Raw JSON
{
  "key": "cache.item_age",
  "brief": "The age of the cache entry in seconds, measured at read time.",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "examples": [
    5,
    3600
  ],
  "search_alias": {
    "name": "cache.item_age",
    "type": "second"
  },
  "additional_context": [
    "Set on reads that return an entry. Absent on a miss, or when the cache does not report a write time.",
    "Clamped to 0. On a shared cache, the writer's clock and the reader's clock can drift far enough to make the age negative.",
    "Can exceed `cache.ttl`. A cache that discards an expired entry on read still reports the age of that entry, with `cache.hit: false`."
  ],
  "changelog": [
    {
      "version": "0.23.0",
      "prs": [
        637
      ],
      "description": "Added cache.item_age attribute"
    }
  ]
}

cache.item_size

integerScrub: ManualVisibility: PublicOTel: False

The size of the requested item in the cache. In bytes.

Example58
Search AliasHow this attribute is exposed in Sentry search. Query it by this name instead of the attribute key.
Namecache.item_size
Typebyte
Changelog
v0.4.0#228
v0.0.0
Raw JSON
{
  "key": "cache.item_size",
  "brief": "The size of the requested item in the cache. In bytes.",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 58,
  "search_alias": {
    "name": "cache.item_size",
    "type": "byte"
  },
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

cache.key

string[]Scrub: ManualVisibility: PublicOTel: False

The key of the cache accessed.

Example["my-cache-key","my-other-cache-key"]
Changelog
v0.0.0
Raw JSON
{
  "key": "cache.key",
  "brief": "The key of the cache accessed.",
  "type": "string[]",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": [
    "my-cache-key",
    "my-other-cache-key"
  ],
  "changelog": [
    {
      "version": "0.0.0"
    }
  ]
}

cache.operation

stringScrub: ManualVisibility: PublicOTel: False

The operation being performed on the cache.

Examplesgetputremove
Changelog
v0.1.0#127
v0.0.0
Raw JSON
{
  "key": "cache.operation",
  "brief": "The operation being performed on the cache.",
  "type": "string",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "examples": [
    "get",
    "put",
    "remove"
  ],
  "changelog": [
    {
      "version": "0.1.0",
      "prs": [
        127
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

cache.tags

string[]Scrub: AutoVisibility: PublicOTel: False

The tags attached to the cache entry. Tags group entries so a cache can invalidate them together.

Scrubbing ReasonApplications pick tag values freely and often build them from record identifiers such as a user id.
Examples["blog-posts","post-42"]["products"]
Additional Context
  • Cache library examples that support tags: Next.js `cacheTag()`, Symfony `ItemInterface::tag()`, Laravel `Cache::tags()`.
  • HTTP caches take tags from a response header. Cloudflare reads `Cache-Tag`, Fastly reads `Surrogate-Key`.
  • Record only the tags the application declared. Leave out implicit tags that the framework adds itself, for example one tag per route.
  • The tags describe the entry, not the operation. Take them from the entry the cache returned or stored.
Changelog
v0.23.0#637Added cache.tags attribute
Raw JSON
{
  "key": "cache.tags",
  "brief": "The tags attached to the cache entry. Tags group entries so a cache can invalidate them together.",
  "type": "string[]",
  "apply_scrubbing": {
    "key": "auto",
    "reason": "Applications pick tag values freely and often build them from record identifiers such as a user id."
  },
  "is_in_otel": false,
  "visibility": "public",
  "examples": [
    [
      "blog-posts",
      "post-42"
    ],
    [
      "products"
    ]
  ],
  "additional_context": [
    "Cache library examples that support tags: Next.js `cacheTag()`, Symfony `ItemInterface::tag()`, Laravel `Cache::tags()`.",
    "HTTP caches take tags from a response header. Cloudflare reads `Cache-Tag`, Fastly reads `Surrogate-Key`.",
    "Record only the tags the application declared. Leave out implicit tags that the framework adds itself, for example one tag per route.",
    "The tags describe the entry, not the operation. Take them from the entry the cache returned or stored."
  ],
  "changelog": [
    {
      "version": "0.23.0",
      "prs": [
        637
      ],
      "description": "Added cache.tags attribute"
    }
  ]
}

cache.ttl

integerScrub: ManualVisibility: PublicOTel: False

The ttl of the cache in seconds

Example120
Changelog
v0.4.0#228
v0.0.0
Raw JSON
{
  "key": "cache.ttl",
  "brief": "The ttl of the cache in seconds",
  "type": "integer",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": 120,
  "changelog": [
    {
      "version": "0.4.0",
      "prs": [
        228
      ]
    },
    {
      "version": "0.0.0"
    }
  ]
}

cache.write

booleanScrub: ManualVisibility: PublicOTel: False

If the cache operation resulted in a write to the cache.

Exampletrue
Changelog
v0.5.0
Raw JSON
{
  "key": "cache.write",
  "brief": "If the cache operation resulted in a write to the cache.",
  "type": "boolean",
  "apply_scrubbing": {
    "key": "manual"
  },
  "is_in_otel": false,
  "visibility": "public",
  "example": true,
  "changelog": [
    {
      "version": "0.5.0"
    }
  ]
}