Skip to content

Commit 3f9b1ab

Browse files
adinauerclaude
andauthored
docs(caches): Add cache.write and cache.operation to span data spec (#17022)
Add `cache.write` and `cache.operation` to the Caches module span data spec, and clarify that span operations should use the real method name. `cache.write` indicates whether a cache operation resulted in a write to the cache. It reflects the actual outcome for conditional operations (e.g. `putIfAbsent`, `replace`) and is always `true` for unconditional writes. This is now set by the sentry-java SDK across its Spring Cache and JCache integrations. `cache.operation` captures the specific cache method name, which is useful when SDKs use more granular span operations than the four base ops defined here. The span operations section now notes that `cache.<methodName>` is the intended format, with the table serving as common examples rather than an exhaustive list. Also fixes a typo: "sepreated" → "separated". --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a114634 commit 3f9b1ab

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

develop-docs/sdk/telemetry/traces/modules/caches.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The SDK's caching integration is agnostic to the underlying engine used. In most
88

99
### Span Operations
1010

11+
The span operation should reflect the specific cache method being called, using the format `cache.<methodName>` (e.g. `cache.get`, `cache.putIfAbsent`, `cache.removeAll`). The following are common examples:
12+
1113
| Span OP | Description |
1214
|:--|:--|
1315
| `cache.get` | A single item or multiple items are retrieved from the cache |
@@ -17,14 +19,16 @@ The SDK's caching integration is agnostic to the underlying engine used. In most
1719

1820
### Span Description
1921

20-
The description of cache spans should be set to the cache key(s), sepreated by commas, e.g. `posts`, or `article1, article2`.
22+
The description of cache spans should be set to the cache key(s), separated by commas, e.g. `posts`, or `article1, article2`.
2123

2224
### Span Data
2325

2426
| Data Key | Type | Description | Conditions
2527
|:--|:--|:--|:--|
2628
| `cache.hit` | bool | cache hit or miss | required only on read-operations (`cache.get`)
2729
| `cache.key` | array | the key(s) involved in the operation | required only on operations that have a key
30+
| `cache.operation` | string | the specific cache operation performed (e.g. `get`, `putIfAbsent`, `removeAll`) | optional; useful when the SDK uses granular span operations beyond the four base ops
31+
| `cache.write` | bool | whether the operation resulted in a write to the cache | required only on write-operations (`cache.put`, `cache.remove`, `cache.flush`); reflects the actual outcome for conditional operations (e.g. `putIfAbsent`, `replace`); always `true` for unconditional writes
2832

2933
The following data attributes are only to be set if exposed by the instrumented cache abstraction or retrievable with minimal overhead.
3034

develop-docs/sdk/telemetry/traces/span-data-conventions.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,17 @@ Below describes the conventions for the Span interface for the `data` field on t
7777

7878
## Web Server
7979

80-
| Attribute | Type | Description | Examples |
81-
| ----------------- | ------- | ------------------------------------------------------ | -------- |
82-
| `cache.hit` | boolean | If the cache was hit during this span. | `true` |
83-
| `cache.item_size` | int | The size of the requested item in the cache. In bytes. | 58 |
80+
| Attribute | Type | Description | Examples |
81+
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------- | ----------------------- |
82+
| `cache.hit` | boolean | If the cache was hit during this span. | `true` |
83+
| `cache.key` | array | The cache key(s) involved in the operation. | `['posts']` |
84+
| `cache.operation` | string | The specific cache operation that was performed. | `get` |
85+
| `cache.write` | boolean | Whether the operation resulted in writing to the cache. | `false` |
86+
| `cache.item_size` | int | The size of the requested item in the cache, in bytes. | `58` |
87+
| `cache.success` | boolean | Whether the cache operation succeeded. | `true` |
88+
| `cache.ttl` | int | The time-to-live for the cache entry, in seconds. | `300` |
89+
| `network.peer.address` | string | Hostname of the cache instance that handled the operation. | `cache.internal.local` |
90+
| `network.peer.port` | int | Port of the cache instance that handled the operation. | `6379` |
8491

8592
## AI
8693

0 commit comments

Comments
 (0)