Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
feat: map span attributes to labels for stackdriver export (#84)
Browse files Browse the repository at this point in the history
* feat: Map Span attributes to labels for Stackdriver export

* fixup! feat: Map Span attributes to labels for Stackdriver export
  • Loading branch information
novemberborn authored and kjin committed Aug 2, 2018
1 parent 40c73b2 commit ce628e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/opencensus-exporter-stackdriver/src/stackdriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type TranslatedSpan = {
kind: string,
spanId: string,
startTime: Date,
endTime: Date
endTime: Date,
labels: Record<string, string>
};


Expand Down Expand Up @@ -118,7 +119,14 @@ export class StackdriverTraceExporter implements Exporter {
kind: 'SPAN_KIND_UNSPECIFIED',
spanId: span.id,
startTime: span.startTime,
endTime: span.endTime
endTime: span.endTime,
labels: Object.keys(span.attributes)
.reduce(
(acc, k) => {
acc[k] = String(span.attributes[k]);
return acc;
},
{} as Record<string, string>)
};
}

Expand Down

0 comments on commit ce628e4

Please sign in to comment.