Conversation
90cb93c to
9568b48
Compare
9568b48 to
12ac85a
Compare
Stebalien
reviewed
Aug 30, 2023
Member
Stebalien
left a comment
There was a problem hiding this comment.
Two nits, but this otherwise looks great!
| // Put implements the ds.Datastore interface. | ||
| func (t *Datastore) Put(ctx context.Context, key ds.Key, value []byte) (err error) { | ||
| ctx, span := t.tracer.Start(ctx, "Put", otel.WithAttributes(attribute.String("key", key.String()))) | ||
| defer span.End() |
Member
There was a problem hiding this comment.
We're not tracing errors anywhere. We probably want to call span.RecordError(err) for all errors here (it'll ignore nil errors).
Contributor
Author
There was a problem hiding this comment.
ah good point, I guess it also makes sense to set the status then:
// RecordError will record err as an exception span event for this span. An
// additional call to SetStatus is required if the Status of the Span should
// be set to Error, as this method does not change the Span status. If this
// span is not being recorded or err is nil then this method does nothing.
Member
There was a problem hiding this comment.
Well, that API is bonkers. But ok.
Stebalien
approved these changes
Sep 1, 2023
| // Put implements the ds.Datastore interface. | ||
| func (t *Datastore) Put(ctx context.Context, key ds.Key, value []byte) (err error) { | ||
| ctx, span := t.tracer.Start(ctx, "Put", otel.WithAttributes(attribute.String("key", key.String()))) | ||
| defer span.End() |
Member
There was a problem hiding this comment.
Well, that API is bonkers. But ok.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces the package
tracethat wraps a datastore and applies open telemetry tracing to all datastore interactions.