Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Aug 8, 2024
1 parent 0c6e897 commit f71275c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/opentelemetry/src/utils/parseSpanDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ export function descriptionForHttpMethod(
return { op: opParts.join('.'), description: name, source: 'custom' };
}

const graphqlOperations = attributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION];
const graphqlOperationsAttribute = attributes[SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION];

// Ex. GET /api/users
const baseDescription = `${httpMethod} ${urlPath}`;

// When the http span has a graphql operation, append it to the description
// We add these in the graphqlIntegration
const description = graphqlOperations
? `${baseDescription} (${getGraphqlOperationNames(graphqlOperations)})`
const description = graphqlOperationsAttribute
? `${baseDescription} (${getGraphqlOperationNamesFromAttribute(graphqlOperationsAttribute)})`
: baseDescription;

// If `httpPath` is a root path, then we can categorize the transaction source as route.
Expand All @@ -171,7 +171,7 @@ export function descriptionForHttpMethod(
};
}

function getGraphqlOperationNames(attr: AttributeValue): string {
function getGraphqlOperationNamesFromAttribute(attr: AttributeValue): string {
if (Array.isArray(attr)) {
const sorted = attr.slice().sort();

Expand Down

0 comments on commit f71275c

Please sign in to comment.