-
Notifications
You must be signed in to change notification settings - Fork 327
Exemplar: Add new record APIs that take exemplar attachments and SpanContext key. #1123
Conversation
stats/record.go
Outdated
// Measurements will be tagged with the tags in the context mutated by the mutators. | ||
// RecordWithTags is useful if you want to record with tag mutations but don't want | ||
// to propagate the mutations in the context. | ||
func RecordWithTagsAndAttachments(ctx context.Context, mutators []tag.Mutator, attachments metricdata.Attachments, ms ...Measurement) error { |
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.
Would it make sense to have RecordWithOptions api instead of withAttachment, withTag, WithAttacmentAndTag?
Similar to what we have in gauges (AddInt64Gauge).
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.
For Attachments
that makes sense, though I suggest we still keep the recordWithTags
API since it covers most of the use cases and it's easier to use than creating options
.
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.
SG
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.
Updated in 0d5b2d8.
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.
LGTM
…Context key. (census-instrumentation#1123) * Exemplar: Add SpanContext Attachment key. * Exemplar: Add new record APIs that take exemplar attachments. * Use RetrieveData instead of fake exporter to fix race. * Change map[string]interface to metricdata.Attachments * Use nil instead of empty map. * Update to use options for recording attachments.
…Context key. (#1123) * Exemplar: Add SpanContext Attachment key. * Exemplar: Add new record APIs that take exemplar attachments. * Use RetrieveData instead of fake exporter to fix race. * Change map[string]interface to metricdata.Attachments * Use nil instead of empty map. * Update to use options for recording attachments.
Updates #1058.
This is same as #1075 but to the
dev
branch.Chatted offline with @rghetia, we think it's better to keep the exemplar APIs as-is since the types of exemplar attachments need to be extended in other packages. Having
map[string]interface{}
as exemplar attachment and expose it gives us the most flexibility yet doesn't introduce circular dependencies.