-
Notifications
You must be signed in to change notification settings - Fork 97
feat(core): start tracer with span attributes #514
feat(core): start tracer with span attributes #514
Conversation
Codecov Report
@@ Coverage Diff @@
## master #514 +/- ##
==========================================
- Coverage 95.03% 94.81% -0.22%
==========================================
Files 146 147 +1
Lines 9660 10571 +911
Branches 802 898 +96
==========================================
+ Hits 9180 10023 +843
- Misses 480 548 +68
Continue to review full report at Codecov.
|
@@ -32,6 +33,8 @@ export interface BufferConfig { | |||
|
|||
/** Defines tracer configuration parameters */ | |||
export interface TracerConfig { | |||
/** A set of attributes each in the format [KEY]:[VALUE] */ | |||
attributes?: Attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe calling it spanAttributes
? defaultSpanAttributes
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is either constantAttributes
or defaultAttributes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change, would you mind to update CHANGELOG.md with this new feature?
@@ -124,6 +124,12 @@ export class CoreTracerBase implements types.TracerBase { | |||
if (sampleDecision) { | |||
const rootSpan = | |||
new RootSpan(this, name, kind, traceId, parentSpanId, traceState); | |||
// Add tracer attributes | |||
if (this.config.attributes) { | |||
for (const key of Object.keys(this.config.attributes)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use forEach
statement for better readability. WDYT?
@@ -32,6 +33,8 @@ export interface BufferConfig { | |||
|
|||
/** Defines tracer configuration parameters */ | |||
export interface TracerConfig { | |||
/** A set of attributes each in the format [KEY]:[VALUE] */ | |||
attributes?: Attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is either constantAttributes
or defaultAttributes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added minor comments.
@mayurkale22 thanks for the review, I renamed |
Added to changelog. |
Not familiar with this tool, but happy to explore more. Thanks for sharing the link. |
The links is just the spec for the commit message format. For non-monorepo: etc. |
Default attributes for Tracer that will be added to every Span created by Tracer.
Useful for system level attributes like cluster information.