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

Exemplar: Add new record APIs that take exemplar attachments and SpanContext key. #1123

Merged
merged 6 commits into from
Apr 23, 2019

Conversation

songy23
Copy link
Contributor

@songy23 songy23 commented Apr 22, 2019

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.

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 {
Copy link
Contributor

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).

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 0d5b2d8.

Copy link
Contributor

@rghetia rghetia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@songy23 songy23 merged commit b89bc99 into census-instrumentation:dev Apr 23, 2019
@songy23 songy23 deleted the exemplar-record branch April 23, 2019 16:49
rghetia pushed a commit to rghetia/opencensus-go that referenced this pull request Apr 25, 2019
…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.
rghetia pushed a commit that referenced this pull request Apr 25, 2019
…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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants