Skip to content

Commit

Permalink
Added missing metric from older analytics packaged (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGHSeg authored Jan 7, 2025
1 parent b6c4372 commit 9883151
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit 9883151

Please sign in to comment.