Skip to content

Commit c3b246c

Browse files
authored
fix(serverless): align span operations to new operations (#5890)
Signed-off-by: Outsider <[email protected]>
1 parent 6bd07a6 commit c3b246c

12 files changed

+36
-36
lines changed

packages/serverless/src/awslambda.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export function wrapHandler<TEvent, TResult>(
315315

316316
const transaction = hub.startTransaction({
317317
name: context.functionName,
318-
op: 'awslambda.handler',
318+
op: 'function.aws.lambda',
319319
...traceparentData,
320320
metadata: {
321321
dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext,

packages/serverless/src/awsservices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
6565
if (transaction) {
6666
span = transaction.startChild({
6767
description: describe(this, operation, params),
68-
op: 'aws.request',
68+
op: 'http.client',
6969
});
7070
}
7171
});

packages/serverless/src/gcpfunction/cloud_events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function _wrapCloudEventFunction(
3434

3535
const transaction = hub.startTransaction({
3636
name: context.type || '<unknown>',
37-
op: 'gcp.function.cloud_event',
37+
op: 'function.gcp.cloud_event',
3838
metadata: { source: 'component' },
3939
});
4040

packages/serverless/src/gcpfunction/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function _wrapEventFunction<F extends EventFunction | EventFunctionWithCallback>
3636

3737
const transaction = hub.startTransaction({
3838
name: context.eventType,
39-
op: 'gcp.function.event',
39+
op: 'function.gcp.event',
4040
metadata: { source: 'component' },
4141
});
4242

packages/serverless/src/gcpfunction/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function _wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial<HttpFunctionWr
8585

8686
const transaction = hub.startTransaction({
8787
name: `${reqMethod} ${reqUrl}`,
88-
op: 'gcp.function.http',
88+
op: 'function.gcp.http',
8989
...traceparentData,
9090
metadata: {
9191
dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext,

packages/serverless/src/google-cloud-grpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
114114
if (transaction) {
115115
span = transaction.startChild({
116116
description: `${callType} ${methodName}`,
117-
op: `gcloud.grpc.${serviceIdentifier}`,
117+
op: `grpc.${serviceIdentifier}`,
118118
});
119119
}
120120
ret.on('status', () => {

packages/serverless/src/google-cloud-http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
5959
const httpMethod = reqOpts.method || 'GET';
6060
span = transaction.startChild({
6161
description: `${httpMethod} ${reqOpts.uri}`,
62-
op: `gcloud.http.${identifyService(this.apiEndpoint)}`,
62+
op: `http.client.${identifyService(this.apiEndpoint)}`,
6363
});
6464
}
6565
orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {

packages/serverless/test/awslambda.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ describe('AWSLambda', () => {
191191

192192
const fakeTransactionContext = {
193193
name: 'functionName',
194-
op: 'awslambda.handler',
194+
op: 'function.aws.lambda',
195195
metadata: { source: 'component' },
196196
};
197197

@@ -218,7 +218,7 @@ describe('AWSLambda', () => {
218218
} catch (e) {
219219
const fakeTransactionContext = {
220220
name: 'functionName',
221-
op: 'awslambda.handler',
221+
op: 'function.aws.lambda',
222222
metadata: { source: 'component' },
223223
};
224224

@@ -258,7 +258,7 @@ describe('AWSLambda', () => {
258258
expect.objectContaining({
259259
parentSpanId: '1121201211212012',
260260
parentSampled: false,
261-
op: 'awslambda.handler',
261+
op: 'function.aws.lambda',
262262
name: 'functionName',
263263
traceId: '12312012123120121231201212312012',
264264
metadata: {
@@ -292,7 +292,7 @@ describe('AWSLambda', () => {
292292
} catch (e) {
293293
const fakeTransactionContext = {
294294
name: 'functionName',
295-
op: 'awslambda.handler',
295+
op: 'function.aws.lambda',
296296
traceId: '12312012123120121231201212312012',
297297
parentSpanId: '1121201211212012',
298298
parentSampled: false,
@@ -322,7 +322,7 @@ describe('AWSLambda', () => {
322322

323323
const fakeTransactionContext = {
324324
name: 'functionName',
325-
op: 'awslambda.handler',
325+
op: 'function.aws.lambda',
326326
metadata: { source: 'component' },
327327
};
328328

@@ -360,7 +360,7 @@ describe('AWSLambda', () => {
360360
} catch (e) {
361361
const fakeTransactionContext = {
362362
name: 'functionName',
363-
op: 'awslambda.handler',
363+
op: 'function.aws.lambda',
364364
metadata: { source: 'component' },
365365
};
366366

@@ -402,7 +402,7 @@ describe('AWSLambda', () => {
402402

403403
const fakeTransactionContext = {
404404
name: 'functionName',
405-
op: 'awslambda.handler',
405+
op: 'function.aws.lambda',
406406
metadata: { source: 'component' },
407407
};
408408

@@ -440,7 +440,7 @@ describe('AWSLambda', () => {
440440
} catch (e) {
441441
const fakeTransactionContext = {
442442
name: 'functionName',
443-
op: 'awslambda.handler',
443+
op: 'function.aws.lambda',
444444
metadata: { source: 'component' },
445445
};
446446

packages/serverless/test/awsservices.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('AWSServices', () => {
3232
expect(data.Body?.toString('utf-8')).toEqual('contents');
3333
// @ts-ignore see "Why @ts-ignore" note
3434
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
35-
op: 'aws.request',
35+
op: 'http.client',
3636
description: 'aws.s3.getObject foo',
3737
});
3838
// @ts-ignore see "Why @ts-ignore" note
@@ -49,7 +49,7 @@ describe('AWSServices', () => {
4949
});
5050
// @ts-ignore see "Why @ts-ignore" note
5151
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
52-
op: 'aws.request',
52+
op: 'http.client',
5353
description: 'aws.s3.getObject foo',
5454
});
5555
});
@@ -64,7 +64,7 @@ describe('AWSServices', () => {
6464
expect(data.Payload?.toString('utf-8')).toEqual('reply');
6565
// @ts-ignore see "Why @ts-ignore" note
6666
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
67-
op: 'aws.request',
67+
op: 'http.client',
6868
description: 'aws.lambda.invoke foo',
6969
});
7070
});

packages/serverless/test/gcpfunction.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('GCPFunction', () => {
113113

114114
const fakeTransactionContext = {
115115
name: 'POST /path',
116-
op: 'gcp.function.http',
116+
op: 'function.gcp.http',
117117
metadata: { source: 'route' },
118118
};
119119
// @ts-ignore see "Why @ts-ignore" note
@@ -146,7 +146,7 @@ describe('GCPFunction', () => {
146146

147147
const fakeTransactionContext = {
148148
name: 'POST /path',
149-
op: 'gcp.function.http',
149+
op: 'function.gcp.http',
150150
traceId: '12312012123120121231201212312012',
151151
parentSpanId: '1121201211212012',
152152
parentSampled: false,
@@ -182,7 +182,7 @@ describe('GCPFunction', () => {
182182

183183
const fakeTransactionContext = {
184184
name: 'POST /path',
185-
op: 'gcp.function.http',
185+
op: 'function.gcp.http',
186186
traceId: '12312012123120121231201212312012',
187187
parentSpanId: '1121201211212012',
188188
parentSampled: false,
@@ -261,7 +261,7 @@ describe('GCPFunction', () => {
261261

262262
const fakeTransactionContext = {
263263
name: 'event.type',
264-
op: 'gcp.function.event',
264+
op: 'function.gcp.event',
265265
metadata: { source: 'component' },
266266
};
267267
// @ts-ignore see "Why @ts-ignore" note
@@ -288,7 +288,7 @@ describe('GCPFunction', () => {
288288

289289
const fakeTransactionContext = {
290290
name: 'event.type',
291-
op: 'gcp.function.event',
291+
op: 'function.gcp.event',
292292
metadata: { source: 'component' },
293293
};
294294
// @ts-ignore see "Why @ts-ignore" note
@@ -320,7 +320,7 @@ describe('GCPFunction', () => {
320320

321321
const fakeTransactionContext = {
322322
name: 'event.type',
323-
op: 'gcp.function.event',
323+
op: 'function.gcp.event',
324324
metadata: { source: 'component' },
325325
};
326326
// @ts-ignore see "Why @ts-ignore" note
@@ -351,7 +351,7 @@ describe('GCPFunction', () => {
351351

352352
const fakeTransactionContext = {
353353
name: 'event.type',
354-
op: 'gcp.function.event',
354+
op: 'function.gcp.event',
355355
metadata: { source: 'component' },
356356
};
357357
// @ts-ignore see "Why @ts-ignore" note
@@ -380,7 +380,7 @@ describe('GCPFunction', () => {
380380

381381
const fakeTransactionContext = {
382382
name: 'event.type',
383-
op: 'gcp.function.event',
383+
op: 'function.gcp.event',
384384
metadata: { source: 'component' },
385385
};
386386
// @ts-ignore see "Why @ts-ignore" note
@@ -407,7 +407,7 @@ describe('GCPFunction', () => {
407407

408408
const fakeTransactionContext = {
409409
name: 'event.type',
410-
op: 'gcp.function.event',
410+
op: 'function.gcp.event',
411411
metadata: { source: 'component' },
412412
};
413413
// @ts-ignore see "Why @ts-ignore" note
@@ -435,7 +435,7 @@ describe('GCPFunction', () => {
435435

436436
const fakeTransactionContext = {
437437
name: 'event.type',
438-
op: 'gcp.function.event',
438+
op: 'function.gcp.event',
439439
metadata: { source: 'component' },
440440
};
441441
// @ts-ignore see "Why @ts-ignore" note
@@ -474,7 +474,7 @@ describe('GCPFunction', () => {
474474

475475
const fakeTransactionContext = {
476476
name: 'event.type',
477-
op: 'gcp.function.cloud_event',
477+
op: 'function.gcp.cloud_event',
478478
metadata: { source: 'component' },
479479
};
480480
// @ts-ignore see "Why @ts-ignore" note
@@ -501,7 +501,7 @@ describe('GCPFunction', () => {
501501

502502
const fakeTransactionContext = {
503503
name: 'event.type',
504-
op: 'gcp.function.cloud_event',
504+
op: 'function.gcp.cloud_event',
505505
metadata: { source: 'component' },
506506
};
507507
// @ts-ignore see "Why @ts-ignore" note
@@ -530,7 +530,7 @@ describe('GCPFunction', () => {
530530

531531
const fakeTransactionContext = {
532532
name: 'event.type',
533-
op: 'gcp.function.cloud_event',
533+
op: 'function.gcp.cloud_event',
534534
metadata: { source: 'component' },
535535
};
536536
// @ts-ignore see "Why @ts-ignore" note
@@ -557,7 +557,7 @@ describe('GCPFunction', () => {
557557

558558
const fakeTransactionContext = {
559559
name: 'event.type',
560-
op: 'gcp.function.cloud_event',
560+
op: 'function.gcp.cloud_event',
561561
metadata: { source: 'component' },
562562
};
563563
// @ts-ignore see "Why @ts-ignore" note
@@ -585,7 +585,7 @@ describe('GCPFunction', () => {
585585

586586
const fakeTransactionContext = {
587587
name: 'event.type',
588-
op: 'gcp.function.cloud_event',
588+
op: 'function.gcp.cloud_event',
589589
metadata: { source: 'component' },
590590
};
591591
// @ts-ignore see "Why @ts-ignore" note

packages/serverless/test/google-cloud-grpc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('GoogleCloudGrpc tracing', () => {
128128
expect(resp).toEqual('1637084156623860');
129129
// @ts-ignore see "Why @ts-ignore" note
130130
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
131-
op: 'gcloud.grpc.pubsub',
131+
op: 'grpc.pubsub',
132132
description: 'unary call publish',
133133
});
134134
await pubsub.close();

packages/serverless/test/google-cloud-http.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ describe('GoogleCloudHttp tracing', () => {
5959
expect(resp).toEqual([[{ foo: true }]]);
6060
// @ts-ignore see "Why @ts-ignore" note
6161
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
62-
op: 'gcloud.http.bigquery',
62+
op: 'http.client.bigquery',
6363
description: 'POST /jobs',
6464
});
6565
// @ts-ignore see "Why @ts-ignore" note
6666
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
67-
op: 'gcloud.http.bigquery',
67+
op: 'http.client.bigquery',
6868
description: expect.stringMatching(new RegExp('^GET /queries/.+')),
6969
});
7070
});

0 commit comments

Comments
 (0)