Skip to content

feat: Add flag.evaluation.<key> attribute #42

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions generated/attributes/flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- THIS FILE IS AUTO-GENERATED. DO NOT EDIT DIRECTLY. -->

# Flag Attributes

- [Stable Attributes](#stable-attributes)
- [flag.evaluation.\<key\>](#flagevaluationkey)

## Stable Attributes

### flag.evaluation.\<key\>

An instance of a feature flag evaluation. The value of this attribute is the boolean representing the evaluation result. The \<key\> suffix is the name of the feature flag.

| Property | Value |
| --- | --- |
| Type | `boolean` |
| Has PII | false |
| Exists in OpenTelemetry | No |
| Has dynamic suffix | Yes |
| Example | `flag.evaluation.is_new_ui=true` |

1 change: 1 addition & 0 deletions generated/attributes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This directory contains documentation for all available attributes.
- [`error` Attributes](./error.md)
- [`exception` Attributes](./exception.md)
- [`faas` Attributes](./faas.md)
- [`flag` Attributes](./flag.md)
- [`frames` Attributes](./frames.md)
- [`gen_ai` Attributes](./gen_ai.md)
- [`general` Attributes](./general.md)
Expand Down
19 changes: 19 additions & 0 deletions javascript/sentry-conventions/src/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,23 @@ export const FAAS_TIME = 'faas.time';
*/
export const FAAS_TRIGGER = 'faas.trigger';

// Path: model/attributes/flag/flag__evaluation__<key>.json

/**
* An instance of a feature flag evaluation. The value of this attribute is the boolean representing the evaluation result. The <key> suffix is the name of the feature flag.
*
* Attribute Value Type: boolean
*
* Contains PII: false
*
* Attribute defined in OTEL: No
*
* Has Dynamic Suffix: true
*
* @example "flag.evaluation.is_new_ui=true"
*/
export const FLAG_EVALUATION_KEY = 'flag.evaluation.<key>';

// Path: model/attributes/frames/frames__delay.json

/**
Expand Down Expand Up @@ -3631,6 +3648,7 @@ export type Attributes = {
[FAAS_CRON]?: string;
[FAAS_TIME]?: string;
[FAAS_TRIGGER]?: string;
[FLAG_EVALUATION_KEY]?: boolean;
[FRAMES_DELAY]?: number;
[FRAMES_FROZEN]?: number;
[FRAMES_SLOW]?: number;
Expand Down Expand Up @@ -3820,6 +3838,7 @@ export type FullAttributes = {
[FAAS_CRON]?: string;
[FAAS_TIME]?: string;
[FAAS_TRIGGER]?: string;
[FLAG_EVALUATION_KEY]?: boolean;
[FRAMES_DELAY]?: number;
[FRAMES_FROZEN]?: number;
[FRAMES_SLOW]?: number;
Expand Down
11 changes: 11 additions & 0 deletions model/attributes/flag/flag__evaluation__<key>.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"key": "flag.evaluation.<key>",
"brief": "An instance of a feature flag evaluation. The value of this attribute is the boolean representing the evaluation result. The <key> suffix is the name of the feature flag.",
"has_dynamic_suffix": true,
"type": "boolean",
"pii": {
"key": "false"
},
"is_in_otel": false,
"example": "flag.evaluation.is_new_ui=true"
}
7 changes: 1 addition & 6 deletions model/attributes/sentry/sentry__sdk__integrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@
"key": "false"
},
"is_in_otel": false,
"example": [
"InboundFilters",
"FunctionToString",
"BrowserApiErrors",
"Breadcrumbs"
]
"example": ["InboundFilters", "FunctionToString", "BrowserApiErrors", "Breadcrumbs"]
}
4 changes: 2 additions & 2 deletions scripts/create_attribute.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import readline from 'node:readline';
import { parseArgs } from 'node:util';
import { execSync } from 'node:child_process';
import Ajv from 'ajv';

const HELP_TEXT = `
Expand Down Expand Up @@ -158,7 +158,7 @@ const createAttribute = async () => {
fs.mkdirSync(dirPath, { recursive: true });
}
// Convert rest parts to use double underscores instead of dots
const fileName = parts.join('__').replace(/<key>/g, 'key');
const fileName = parts.join('__');
filePath = path.join(dirPath, `${fileName}.json`);
}

Expand Down