Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
"browser.web_vital.id",
"browser.web_vital.name",
"browser.web_vital.navigation_type",
"browser.web_vital.navigation_id",
"browser.web_vital.navigation_url",
"browser.web_vital.rating",
"browser.web_vital.value",
"browser.resource_timing.connect_end",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,14 @@ describe('initializeOtel', () => {
exportConfig: {
tracesUrl: string
logsUrl: string
metricsUrl: string
}
},
]
>
const { tracesUrl, logsUrl, metricsUrl } = calls[0][0].exportConfig
const { tracesUrl, logsUrl } = calls[0][0].exportConfig
const { origin } = window.location
expect(tracesUrl).toBe(`${origin}/docs/_api/v1/o/t`)
expect(logsUrl).toBe(`${origin}/docs/_api/v1/o/l`)
expect(metricsUrl).toBe(`${origin}/docs/_api/v1/o/m`)
})

it('turns off resource timing, which emits a log record per asset', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Elastic EDOT browser SDK initialisation.
* Sends traces, logs and metrics to the backend OTLP endpoints (/v1/o/t, /v1/o/l, /v1/o/m).
* Sends traces and logs to the backend OTLP endpoints (/v1/o/t, /v1/o/l). The SDK has no metrics signal.
*
* This module should be imported once at application startup.
* All web components will automatically be instrumented once initialised.
Expand Down Expand Up @@ -69,19 +69,17 @@ function exportHeaders(): Record<string, string> {
}

// The ALB routes the browser's OTLP paths to the collector, so each signal gets its own
// absolute URL instead of the SDK's default /v1/{traces,logs,metrics}. EDOT validates them with new URL().
// absolute URL instead of the SDK's default /v1/{traces,logs}. EDOT validates them with new URL().
function otlpSignalUrls(): {
tracesUrl: string
logsUrl: string
metricsUrl: string
} {
const basePath = docsConfig.apiBasePath.replace(/\/+$/, '')
const signalUrl = (path: string) =>
new URL(`${basePath}/v1/o/${path}`, window.location.origin).href
return {
tracesUrl: signalUrl('t'),
logsUrl: signalUrl('l'),
metricsUrl: signalUrl('m'),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('traceSpan', () => {
exportConfig: {
tracesUrl: 'http://localhost/t',
logsUrl: 'http://localhost/l',
metricsUrl: 'http://localhost/m',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also remove the metrics endpoint from the infra?

},
})
})
Expand Down
Loading
Loading