Skip to content

Commit

Permalink
fix(span): align span operations to new operations
Browse files Browse the repository at this point in the history
Signed-off-by: Outsider <outsideris@gmail.com>
  • Loading branch information
outsideris committed Oct 4, 2022
1 parent 28c464d commit 2891b58
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 61 deletions.
6 changes: 3 additions & 3 deletions packages/ember/addon/index.ts
Expand Up @@ -84,7 +84,7 @@ export const instrumentRoutePerformance = (BaseRoute: any) => {
[BaseRoute.name]: class extends BaseRoute {
beforeModel(...args: any[]) {
return instrumentFunction(
'ember.route.beforeModel',
'ui.ember.route.before_model',
(<any>this).fullRouteName,
super.beforeModel.bind(this),
args,
Expand All @@ -97,7 +97,7 @@ export const instrumentRoutePerformance = (BaseRoute: any) => {

async afterModel(...args: any[]) {
return instrumentFunction(
'ember.route.afterModel',
'ui.ember.route.after_model',
(<any>this).fullRouteName,
super.afterModel.bind(this),
args,
Expand All @@ -106,7 +106,7 @@ export const instrumentRoutePerformance = (BaseRoute: any) => {

async setupController(...args: any[]) {
return instrumentFunction(
'ember.route.setupController',
'ui.ember.route.setup_controller',
(<any>this).fullRouteName,
super.setupController.bind(this),
args,
Expand Down
12 changes: 6 additions & 6 deletions packages/ember/tests/acceptance/sentry-performance-test.js
Expand Up @@ -90,7 +90,7 @@ module('Acceptance | Sentry Transactions', function (hooks) {
'ui.ember.transition | route:tracing -> route:slow-loading-route.index',
'ui.ember.component.render | component:link-to',
'ui.ember.component.render | component:link-to',
'ember.route.beforeModel | slow-loading-route',
'ui.ember.route.before_model | slow-loading-route',
'ui.ember.runloop.actions | undefined',
'ui.ember.runloop.routerTransitions | undefined',
'ui.ember.runloop.render | undefined',
Expand All @@ -102,15 +102,15 @@ module('Acceptance | Sentry Transactions', function (hooks) {
'ui.ember.runloop.render | undefined',
'ui.ember.runloop.afterRender | undefined',
'ui.ember.runloop.destroy | undefined',
'ember.route.afterModel | slow-loading-route',
'ui.ember.route.after_model | slow-loading-route',
'ui.ember.runloop.actions | undefined',
'ui.ember.runloop.routerTransitions | undefined',
'ui.ember.component.render | component:link-to',
'ui.ember.component.render | component:link-to',
'ui.ember.runloop.render | undefined',
'ui.ember.runloop.afterRender | undefined',
'ui.ember.runloop.destroy | undefined',
'ember.route.beforeModel | slow-loading-route.index',
'ui.ember.route.before_model | slow-loading-route.index',
'ui.ember.runloop.actions | undefined',
'ui.ember.runloop.routerTransitions | undefined',
'ui.ember.runloop.render | undefined',
Expand All @@ -122,10 +122,10 @@ module('Acceptance | Sentry Transactions', function (hooks) {
'ui.ember.runloop.render | undefined',
'ui.ember.runloop.afterRender | undefined',
'ui.ember.runloop.destroy | undefined',
'ember.route.afterModel | slow-loading-route.index',
'ui.ember.route.after_model | slow-loading-route.index',
'ui.ember.runloop.actions | undefined',
'ember.route.setupController | slow-loading-route',
'ember.route.setupController | slow-loading-route.index',
'ui.ember.route.setup_controller | slow-loading-route',
'ui.ember.route.setup_controller | slow-loading-route.index',
'ui.ember.runloop.routerTransitions | undefined',
'ui.ember.component.render | component:link-to',
'ui.ember.component.render | component:link-to',
Expand Down
4 changes: 2 additions & 2 deletions packages/remix/src/utils/instrumentServer.ts
Expand Up @@ -115,7 +115,7 @@ function makeWrappedDocumentRequestFunction(

try {
const span = activeTransaction?.startChild({
op: 'remix.server.documentRequest',
op: 'function.remix.document_request',
description: activeTransaction.name,
tags: {
method: request.method,
Expand Down Expand Up @@ -147,7 +147,7 @@ function makeWrappedDataFunction(origFn: DataFunction, id: string, name: 'action

try {
const span = activeTransaction?.startChild({
op: `remix.server.${name}`,
op: `function.remix.${name}`,
description: id,
tags: {
name,
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/awslambda.ts
Expand Up @@ -315,7 +315,7 @@ export function wrapHandler<TEvent, TResult>(

const transaction = hub.startTransaction({
name: context.functionName,
op: 'awslambda.handler',
op: 'function.aws.lambda',
...traceparentData,
metadata: {
dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/awsservices.ts
Expand Up @@ -65,7 +65,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
if (transaction) {
span = transaction.startChild({
description: describe(this, operation, params),
op: 'aws.request',
op: 'http.client',
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/gcpfunction/cloud_events.ts
Expand Up @@ -34,7 +34,7 @@ function _wrapCloudEventFunction(

const transaction = hub.startTransaction({
name: context.type || '<unknown>',
op: 'gcp.function.cloud_event',
op: 'function.gcp.cloud_event',
metadata: { source: 'component' },
});

Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/gcpfunction/events.ts
Expand Up @@ -36,7 +36,7 @@ function _wrapEventFunction<F extends EventFunction | EventFunctionWithCallback>

const transaction = hub.startTransaction({
name: context.eventType,
op: 'gcp.function.event',
op: 'function.gcp.event',
metadata: { source: 'component' },
});

Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/gcpfunction/http.ts
Expand Up @@ -85,7 +85,7 @@ function _wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial<HttpFunctionWr

const transaction = hub.startTransaction({
name: `${reqMethod} ${reqUrl}`,
op: 'gcp.function.http',
op: 'function.gcp.http',
...traceparentData,
metadata: {
dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/google-cloud-grpc.ts
Expand Up @@ -114,7 +114,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
if (transaction) {
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `gcloud.grpc.${serviceIdentifier}`,
op: `grpc.${serviceIdentifier}`,
});
}
ret.on('status', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/src/google-cloud-http.ts
Expand Up @@ -59,7 +59,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const httpMethod = reqOpts.method || 'GET';
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `gcloud.http.${identifyService(this.apiEndpoint)}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
});
}
orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {
Expand Down
16 changes: 8 additions & 8 deletions packages/serverless/test/awslambda.test.ts
Expand Up @@ -191,7 +191,7 @@ describe('AWSLambda', () => {

const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
metadata: { source: 'component' },
};

Expand All @@ -218,7 +218,7 @@ describe('AWSLambda', () => {
} catch (e) {
const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
metadata: { source: 'component' },
};

Expand Down Expand Up @@ -258,7 +258,7 @@ describe('AWSLambda', () => {
expect.objectContaining({
parentSpanId: '1121201211212012',
parentSampled: false,
op: 'awslambda.handler',
op: 'function.aws.lambda',
name: 'functionName',
traceId: '12312012123120121231201212312012',
metadata: {
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('AWSLambda', () => {
} catch (e) {
const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
traceId: '12312012123120121231201212312012',
parentSpanId: '1121201211212012',
parentSampled: false,
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('AWSLambda', () => {

const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
metadata: { source: 'component' },
};

Expand Down Expand Up @@ -360,7 +360,7 @@ describe('AWSLambda', () => {
} catch (e) {
const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
metadata: { source: 'component' },
};

Expand Down Expand Up @@ -402,7 +402,7 @@ describe('AWSLambda', () => {

const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
metadata: { source: 'component' },
};

Expand Down Expand Up @@ -440,7 +440,7 @@ describe('AWSLambda', () => {
} catch (e) {
const fakeTransactionContext = {
name: 'functionName',
op: 'awslambda.handler',
op: 'function.aws.lambda',
metadata: { source: 'component' },
};

Expand Down
6 changes: 3 additions & 3 deletions packages/serverless/test/awsservices.test.ts
Expand Up @@ -32,7 +32,7 @@ describe('AWSServices', () => {
expect(data.Body?.toString('utf-8')).toEqual('contents');
// @ts-ignore see "Why @ts-ignore" note
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
op: 'aws.request',
op: 'http.client',
description: 'aws.s3.getObject foo',
});
// @ts-ignore see "Why @ts-ignore" note
Expand All @@ -49,7 +49,7 @@ describe('AWSServices', () => {
});
// @ts-ignore see "Why @ts-ignore" note
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
op: 'aws.request',
op: 'http.client',
description: 'aws.s3.getObject foo',
});
});
Expand All @@ -64,7 +64,7 @@ describe('AWSServices', () => {
expect(data.Payload?.toString('utf-8')).toEqual('reply');
// @ts-ignore see "Why @ts-ignore" note
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
op: 'aws.request',
op: 'http.client',
description: 'aws.lambda.invoke foo',
});
});
Expand Down
30 changes: 15 additions & 15 deletions packages/serverless/test/gcpfunction.test.ts
Expand Up @@ -113,7 +113,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'POST /path',
op: 'gcp.function.http',
op: 'function.gcp.http',
metadata: { source: 'route' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'POST /path',
op: 'gcp.function.http',
op: 'function.gcp.http',
traceId: '12312012123120121231201212312012',
parentSpanId: '1121201211212012',
parentSampled: false,
Expand Down Expand Up @@ -182,7 +182,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'POST /path',
op: 'gcp.function.http',
op: 'function.gcp.http',
traceId: '12312012123120121231201212312012',
parentSpanId: '1121201211212012',
parentSampled: false,
Expand Down Expand Up @@ -261,7 +261,7 @@ describe('GCPFunction', () => {

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

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.event',
op: 'function.gcp.event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -320,7 +320,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.event',
op: 'function.gcp.event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -351,7 +351,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.event',
op: 'function.gcp.event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -380,7 +380,7 @@ describe('GCPFunction', () => {

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

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.event',
op: 'function.gcp.event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -435,7 +435,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.event',
op: 'function.gcp.event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -474,7 +474,7 @@ describe('GCPFunction', () => {

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

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.cloud_event',
op: 'function.gcp.cloud_event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -530,7 +530,7 @@ describe('GCPFunction', () => {

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

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.cloud_event',
op: 'function.gcp.cloud_event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down Expand Up @@ -585,7 +585,7 @@ describe('GCPFunction', () => {

const fakeTransactionContext = {
name: 'event.type',
op: 'gcp.function.cloud_event',
op: 'function.gcp.cloud_event',
metadata: { source: 'component' },
};
// @ts-ignore see "Why @ts-ignore" note
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/test/google-cloud-grpc.test.ts
Expand Up @@ -128,7 +128,7 @@ describe('GoogleCloudGrpc tracing', () => {
expect(resp).toEqual('1637084156623860');
// @ts-ignore see "Why @ts-ignore" note
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({
op: 'gcloud.grpc.pubsub',
op: 'grpc.pubsub',
description: 'unary call publish',
});
await pubsub.close();
Expand Down

0 comments on commit 2891b58

Please sign in to comment.