Skip to content

Commit f1a2c74

Browse files
authored
fix: correctly report version on webjs otel data (#278)
## Summary Exceptions (and other data) reported via OTel were missing the service version. ## How did you test this change? local deploy <img width="2650" height="1341" alt="image" src="https://github.com/user-attachments/assets/20c66bdc-4fd3-4e80-93ba-b1782aadc339" /> ## Are there any deployment considerations? <!-- Backend - Do we need to consider migrations or backfilling data? --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Propagates `version` to OTEL as `serviceVersion` and sets `service.version` resource attribute; updates e2e configs to supply version. > > - **SDK (OTEL)**: > - Extend `BrowserTracingConfig` with `serviceVersion` and set `Resource` attribute `service.version` via `ATTR_SERVICE_VERSION` in `sdk/highlight-run/src/client/otel/index.ts`. > - Pass through `version` as `serviceVersion` from `ObserveSDK` options in `sdk/highlight-run/src/sdk/observe.ts`. > - **E2E**: > - Provide `version: 'my-version'` in `observabilitySettings` and `sessionReplaySettings` in `e2e/react-router/src/ldclientLazy.tsx`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f1a0498. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent fb9faeb commit f1a2c74

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

e2e/react-router/src/ldclientLazy.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const observabilitySettings: ConstructorParameters<typeof Observability>[0] = {
88
recordHeadersAndBody: true,
99
},
1010
serviceName: 'ryan-test',
11+
version: 'my-version',
1112
backendUrl: 'http://localhost:8082/public',
1213
otel: {
1314
otlpEndpoint: 'http://localhost:4318',
@@ -21,6 +22,7 @@ const sessionReplaySettings: ConstructorParameters<typeof SessionReplay>[0] = {
2122
inlineStylesheet: true,
2223
privacySetting: 'none',
2324
serviceName: 'ryan-test',
25+
version: 'my-version',
2426
backendUrl: 'http://localhost:8082/public',
2527
manualStart: true,
2628
enableCanvasRecording: true,

sdk/highlight-run/src/client/otel/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export type BrowserTracingConfig = {
6969
environment?: string
7070
networkRecordingOptions?: NetworkRecordingOptions
7171
serviceName?: string
72+
serviceVersion?: string
7273
tracingOrigins?: boolean | (string | RegExp)[]
7374
urlBlocklist?: string[]
7475
eventNames?: EventName[]
@@ -142,6 +143,7 @@ export const setupBrowserTracing = (
142143
const resource = new Resource({
143144
[SemanticAttributes.ATTR_SERVICE_NAME]:
144145
config.serviceName ?? 'highlight-browser',
146+
[SemanticAttributes.ATTR_SERVICE_VERSION]: config.serviceVersion,
145147
'deployment.environment.name': environment,
146148
'highlight.project_id': config.projectId,
147149
[SemanticAttributes.ATTR_USER_AGENT_ORIGINAL]: navigator.userAgent,

sdk/highlight-run/src/sdk/observe.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export class ObserveSDK implements Observe {
136136
: undefined,
137137
tracingOrigins: this._options?.tracingOrigins,
138138
serviceName: this._options?.serviceName ?? 'browser',
139+
serviceVersion: this._options?.version,
139140
instrumentations: this._options?.otel?.instrumentations,
140141
eventNames: this._options?.otel?.eventNames,
141142
},

0 commit comments

Comments
 (0)