Skip to content

Commit 481cc01

Browse files
adinauerclaude
andauthored
feat(attributes): Add cache.write attribute (#292)
* feat(attributes): Add cache.write attribute Indicates whether a cache operation resulted in a write to the cache. Always true for unconditional writes (put, remove, clear); reflects the actual outcome for conditional operations (putIfAbsent, replace) where the write may or may not occur depending on cache state. Co-Authored-By: Claude <noreply@anthropic.com> * run yarn generate * fix: Use 'next' version for cache.write changelog entry Replace hardcoded version 0.5.0 with 'next' so the version gets assigned automatically during the release process. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ff2e0ab commit 481cc01

3 files changed

Lines changed: 72 additions & 0 deletions

File tree

javascript/sentry-conventions/src/attributes.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,26 @@ export const CACHE_TTL = 'cache.ttl';
14271427
*/
14281428
export type CACHE_TTL_TYPE = number;
14291429

1430+
// Path: model/attributes/cache/cache__write.json
1431+
1432+
/**
1433+
* If the cache operation resulted in a write to the cache. `cache.write`
1434+
*
1435+
* Attribute Value Type: `boolean` {@link CACHE_WRITE_TYPE}
1436+
*
1437+
* Contains PII: false
1438+
*
1439+
* Attribute defined in OTEL: No
1440+
*
1441+
* @example true
1442+
*/
1443+
export const CACHE_WRITE = 'cache.write';
1444+
1445+
/**
1446+
* Type for {@link CACHE_WRITE} cache.write
1447+
*/
1448+
export type CACHE_WRITE_TYPE = boolean;
1449+
14301450
// Path: model/attributes/channel.json
14311451

14321452
/**
@@ -10129,6 +10149,7 @@ export const ATTRIBUTE_TYPE: Record<string, AttributeType> = {
1012910149
[CACHE_KEY]: 'string[]',
1013010150
[CACHE_OPERATION]: 'string',
1013110151
[CACHE_TTL]: 'integer',
10152+
[CACHE_WRITE]: 'boolean',
1013210153
[CHANNEL]: 'string',
1013310154
[CLIENT_ADDRESS]: 'string',
1013410155
[CLIENT_PORT]: 'integer',
@@ -10610,6 +10631,7 @@ export type AttributeName =
1061010631
| typeof CACHE_KEY
1061110632
| typeof CACHE_OPERATION
1061210633
| typeof CACHE_TTL
10634+
| typeof CACHE_WRITE
1061310635
| typeof CHANNEL
1061410636
| typeof CLIENT_ADDRESS
1061510637
| typeof CLIENT_PORT
@@ -11900,6 +11922,17 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
1190011922
sdks: ['php-laravel'],
1190111923
changelog: [{ version: '0.4.0', prs: [228] }, { version: '0.0.0' }],
1190211924
},
11925+
[CACHE_WRITE]: {
11926+
brief: 'If the cache operation resulted in a write to the cache.',
11927+
type: 'boolean',
11928+
pii: {
11929+
isPii: 'false',
11930+
},
11931+
isInOtel: false,
11932+
example: true,
11933+
sdks: ['java'],
11934+
changelog: [{ version: 'next' }],
11935+
},
1190311936
[CHANNEL]: {
1190411937
brief: 'The channel name that is being used.',
1190511938
type: 'string',
@@ -16861,6 +16894,7 @@ export type Attributes = {
1686116894
[CACHE_KEY]?: CACHE_KEY_TYPE;
1686216895
[CACHE_OPERATION]?: CACHE_OPERATION_TYPE;
1686316896
[CACHE_TTL]?: CACHE_TTL_TYPE;
16897+
[CACHE_WRITE]?: CACHE_WRITE_TYPE;
1686416898
[CHANNEL]?: CHANNEL_TYPE;
1686516899
[CLIENT_ADDRESS]?: CLIENT_ADDRESS_TYPE;
1686616900
[CLIENT_PORT]?: CLIENT_PORT_TYPE;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"key": "cache.write",
3+
"brief": "If the cache operation resulted in a write to the cache.",
4+
"type": "boolean",
5+
"pii": {
6+
"key": "false"
7+
},
8+
"is_in_otel": false,
9+
"example": true,
10+
"sdks": ["java"],
11+
"changelog": [
12+
{
13+
"version": "next"
14+
}
15+
]
16+
}

python/src/sentry_conventions/attributes.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,16 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
997997
Example: 120
998998
"""
999999

1000+
# Path: model/attributes/cache/cache__write.json
1001+
CACHE_WRITE: Literal["cache.write"] = "cache.write"
1002+
"""If the cache operation resulted in a write to the cache.
1003+
1004+
Type: bool
1005+
Contains PII: false
1006+
Defined in OTEL: No
1007+
Example: true
1008+
"""
1009+
10001010
# Path: model/attributes/channel.json
10011011
CHANNEL: Literal["channel"] = "channel"
10021012
"""The channel name that is being used.
@@ -6407,6 +6417,17 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
64076417
ChangelogEntry(version="0.0.0"),
64086418
],
64096419
),
6420+
"cache.write": AttributeMetadata(
6421+
brief="If the cache operation resulted in a write to the cache.",
6422+
type=AttributeType.BOOLEAN,
6423+
pii=PiiInfo(isPii=IsPii.FALSE),
6424+
is_in_otel=False,
6425+
example=True,
6426+
sdks=["java"],
6427+
changelog=[
6428+
ChangelogEntry(version="next"),
6429+
],
6430+
),
64106431
"channel": AttributeMetadata(
64116432
brief="The channel name that is being used.",
64126433
type=AttributeType.STRING,
@@ -11351,6 +11372,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
1135111372
"cache.key": List[str],
1135211373
"cache.operation": str,
1135311374
"cache.ttl": int,
11375+
"cache.write": bool,
1135411376
"channel": str,
1135511377
"client.address": str,
1135611378
"client.port": int,

0 commit comments

Comments
 (0)