Skip to content

Commit bbda884

Browse files
authored
ref(server-utils)!: Use function.gcp op for firebase function spans (#23022)
Firebase functions run on GCP, use `function.gcp` here so that we don't have too many different ops part of #22446
1 parent 3685c8d commit bbda884

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

packages/server-utils/src/integrations/tracing-channel/firebase/functions.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { FAAS_NAME, FAAS_TRIGGER, SENTRY_KIND } from '@sentry/conventions/attributes';
1+
import { FAAS_NAME, FAAS_TRIGGER, SENTRY_KIND, SENTRY_OP } from '@sentry/conventions/attributes';
2+
import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';
23
import type { SpanAttributes } from '@sentry/core';
34
import {
45
captureException,
@@ -58,6 +59,8 @@ function wrapHandler(handler: Handler, triggerType: string): Handler {
5859
[FAAS_TRIGGER]: triggerType,
5960
'faas.provider': 'firebase',
6061
[SENTRY_KIND]: 'server',
62+
[SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,
63+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
6164
};
6265

6366
if (process.env.GCLOUD_PROJECT) {
@@ -72,11 +75,7 @@ function wrapHandler(handler: Handler, triggerType: string): Handler {
7275
return startSpanManual(
7376
{
7477
name: `firebase.function.${triggerType}`,
75-
op: 'function.firebase',
76-
attributes: {
77-
...attributes,
78-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
79-
},
78+
attributes,
8079
},
8180
async span => {
8281
try {

packages/server-utils/test/orchestrion/firebase.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ describe('wrapFunctionsRegistration', () => {
107107
expect(startSpanManualSpy).toHaveBeenCalledWith(
108108
expect.objectContaining({
109109
name: 'firebase.function.http.request',
110-
op: 'function.firebase',
111110
attributes: expect.objectContaining({
112111
'sentry.origin': 'auto.firebase.functions',
112+
'sentry.op': 'function.gcp',
113113
'faas.trigger': 'http.request',
114114
'faas.provider': 'firebase',
115115
}),

0 commit comments

Comments
 (0)