Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/opentelemetry/src/utils/parseSpanDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export function parseSpanDescription(span: AbstractSpan): SpanDescription {
const name = spanHasName(span) ? span.name : '<unknown>';

// if http.method exists, this is an http request span
const httpMethod = attributes[SEMATTRS_HTTP_METHOD];
//
// TODO: Referencing `http.request.method` is a temporary workaround until the semantic
// conventions export an attribute key for it.
const httpMethod = attributes['http.request.method'] || attributes[SEMATTRS_HTTP_METHOD];
if (httpMethod) {
return descriptionForHttpMethod({ attributes, name, kind: getSpanKind(span) }, httpMethod);
}
Expand Down
15 changes: 14 additions & 1 deletion packages/opentelemetry/test/utils/parseSpanDescription.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('parseSpanDescription', () => {
},
],
[
'works with http method',
'works with deprecated http method',
{
[SEMATTRS_HTTP_METHOD]: 'GET',
},
Expand All @@ -53,6 +53,19 @@ describe('parseSpanDescription', () => {
source: 'custom',
},
],
[
'works with http method',
{
'http.request.method': 'GET',
},
'test name',
SpanKind.CLIENT,
{
description: 'test name',
op: 'http.client',
source: 'custom',
},
],
[
'works with db system',
{
Expand Down