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

trace: add starttime start option #1176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gwik
Copy link

@gwik gwik commented Sep 25, 2019

Adds a StartTime option when creating a new span.
In some cases, you are able to trace only after the operation
was made. for example in some post-operation hook/observer.

func myHook(ctx context.Context, info queryInfo) {
   _, span := StartSpan("mydatabase", WithStartTime(time.Now().Add(-1 * info.Duration()))
   span.End()
}

Adds a StartTime option when creating a new span.
In some cases, you are able to trace only after the operation
was made. for example in some post-operation hook/observer.

    func myHook(ctx context.Context, info queryInfo) {
       _, span := StartSpan("mydatabase", WithStartTime(time.Now().Add(-1 * info.Duration()))
       span.End()
    }
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.

Overall LG. One minor comment.

@@ -161,6 +165,13 @@ func WithSampler(sampler Sampler) StartOption {
}
}

// WithStartTime sets the span start time.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps a bit more description would be better.

WithStartTime sets the start time of the span to provided time t, when it is started.
In absence of this option, wall clock time is used as the start time.
This option is typically used when starting of a span is delayed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants