census-instrumentation/opencensus-go

Set an explicit timestamp on a recorded stat (or, metrics in the past)

directionless opened this issue · 0 comments

I often need to translate measurements from one system to another. For example, right now, I'm trying to ingest system from heroku, via their logplex system.

Getting the metrics isn't too hard. But I've run into a stumbling block. I don't see how to set the timestamp on a measure.

Using the common pattern of

ctx := context.Background()
openConns := stats.Int64("example.com/measure/openconns", "open connections", stats.UnitDimensionless)
stats.Record(ctx, openConns.M(124))

I don't see how to set the timestamp.

I think I see a Time.Now() coming from the view recorder, but I'm not sure I'm tracing this correctly.