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
5 changes: 5 additions & 0 deletions .changeset/spicy-baboons-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@segment/analytics-next': patch
---

Added missing telemetry metric.
5 changes: 4 additions & 1 deletion packages/browser/src/browser/__tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ describe('Dispatch', () => {

expect(metrics.map((m) => m.metric)).toMatchInlineSnapshot(`
[
"analytics_js.invoke",
"message_dispatched",
"plugin_time",
"plugin_time",
Expand Down Expand Up @@ -694,7 +695,9 @@ describe('Dispatch', () => {
})

await sleep(10)
expect(fetchCalls[1].url).toBe('http://new.api.io/m')
expect(fetchCalls.some((call) => call.url === 'http://new.api.io/m')).toBe(
true
)
})
})

Expand Down
1 change: 1 addition & 0 deletions packages/browser/src/core/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ export class Analytics
callback?: Callback
): Promise<DispatchedEvent> {
const ctx = new Context(event)
ctx.stats.increment('analytics_js.invoke', 1, [event.type])
if (isOffline() && !this.options.retryQueue) {
return ctx
}
Expand Down
Loading