Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/internal/telemetry: MetricData should have way to obtain/record StartTime and EndTime #34490

Closed
odeke-em opened this issue Sep 24, 2019 · 2 comments
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@odeke-em
Copy link
Member

telemetry.Span has fields StartTime and EndTime

type Span struct {
    Name     string
    ID       SpanContext
    ParentID SpanID
    Start    time.Time
    Finish   time.Time
    Tags     TagList
    Events   []Event
}

which closely mirrors the OpenCensus-Go trace.SpanData

type SpanData struct {
    SpanContext
    ParentSpanID SpanID
    SpanKind     int
    Name         string
    StartTime    time.Time
    // The wall clock time of EndTime will be adjusted to always be offset
    // from StartTime by the duration of the span.
    EndTime time.Time
    // The values of Attributes each have type string, bool, or int64.
    Attributes    map[string]interface{}
    Annotations   []Annotation
    MessageEvents []MessageEvent
    Status
    Links                    []Link
    HasRemoteParent          bool
    DroppedAttributeCount    int
    DroppedAnnotationCount   int
    DroppedMessageEventCount int
    DroppedLinkCount         int

    // ChildSpanCount holds the number of child span created for this span.
    ChildSpanCount int
}

We need the same for telemetry.MetricData/* types for a translation for export/ocagent to be able to convert them to wire Data.

@kirbyquerby is currently working on this. Please feel free to chime in @ianthehat.

@odeke-em odeke-em changed the title internal/telemetry: MetricData should have way to obtain/record StartTime and EndTime x/tools/internal/telemetry: MetricData should have way to obtain/record StartTime and EndTime Sep 24, 2019
@gopherbot gopherbot added this to the Unreleased milestone Sep 24, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 24, 2019
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. FeatureRequest labels Sep 24, 2019
@odeke-em
Copy link
Member Author

StartTime is needed when beginning a time series, we'll need to figure out how to get the overall StartTime for the entire series i.e. if we batch up a bunch of measurements to be converted into metrics.

Every measurement is recorded at a discrete time, we just need to attach the StartTime at that point, the StartTime can be left out and this is the same thing I did for the OpenCensus Agent exporter as per https://github.com/census-ecosystem/opencensus-go-exporter-ocagent/blob/a8a6f458bbc1d5042322ad1f9b65eeb0b69be9ea/viewdata_to_metrics_test.go#L119-L130

@odeke-em
Copy link
Member Author

I mailed out golang/tools@7667e13 and we now have access to the time of recording. @kirbyquerby we now have how to record the EndTime so can close this issue.

@golang golang locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants