Skip to content

Commit

Permalink
Warn metric Exporters of ResourceMetrics reuse (#3556)
Browse files Browse the repository at this point in the history
To potentially optimize the collection code path (#3047) ResourceMetrics
sent to the Exporter may be reused in the future. Warn users of this.

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
  • Loading branch information
MrAlias and hanyuancheung authored Jan 3, 2023
1 parent 9d633d2 commit ad4d54e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/metric/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ type Exporter interface {
// implement any retry logic. All errors returned by this function are
// considered unrecoverable and will be reported to a configured error
// Handler.
//
// The passed ResourceMetrics may be reused when the call completes. If an
// exporter needs to hold this data after it returns, it needs to make a
// copy.
Export(context.Context, metricdata.ResourceMetrics) error

// ForceFlush flushes any metric data held by an exporter.
Expand Down

0 comments on commit ad4d54e

Please sign in to comment.