From 02c000130772af9078f8ae88825549cb1a8140a5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 9 May 2023 08:07:39 -0700 Subject: [PATCH] Document how to pass attributes for all record methods (#4058) * Document how to pass attributes for all record methods * Update based on feedback --- metric/asyncfloat64.go | 5 ++++- metric/asyncint64.go | 5 ++++- metric/syncfloat64.go | 15 ++++++++++++--- metric/syncint64.go | 15 ++++++++++++--- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/metric/asyncfloat64.go b/metric/asyncfloat64.go index 0af3afb11..072baa8e8 100644 --- a/metric/asyncfloat64.go +++ b/metric/asyncfloat64.go @@ -217,7 +217,10 @@ type Float64Observer interface { embedded.Float64Observer // Observe records the float64 value. - Observe(value float64, opts ...ObserveOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value float64, options ...ObserveOption) } // Float64Callback is a function registered with a Meter that makes diff --git a/metric/asyncint64.go b/metric/asyncint64.go index bd194e2f6..9bd6ebf02 100644 --- a/metric/asyncint64.go +++ b/metric/asyncint64.go @@ -216,7 +216,10 @@ type Int64Observer interface { embedded.Int64Observer // Observe records the int64 value. - Observe(value int64, opts ...ObserveOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value int64, options ...ObserveOption) } // Int64Callback is a function registered with a Meter that makes observations diff --git a/metric/syncfloat64.go b/metric/syncfloat64.go index 1130887ce..f0b063721 100644 --- a/metric/syncfloat64.go +++ b/metric/syncfloat64.go @@ -32,7 +32,10 @@ type Float64Counter interface { embedded.Float64Counter // Add records a change to the counter. - Add(ctx context.Context, incr float64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) } // Float64CounterConfig contains options for synchronous counter instruments that @@ -82,7 +85,10 @@ type Float64UpDownCounter interface { embedded.Float64UpDownCounter // Add records a change to the counter. - Add(ctx context.Context, incr float64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) } // Float64UpDownCounterConfig contains options for synchronous counter @@ -132,7 +138,10 @@ type Float64Histogram interface { embedded.Float64Histogram // Record adds an additional value to the distribution. - Record(ctx context.Context, incr float64, opts ...RecordOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr float64, options ...RecordOption) } // Float64HistogramConfig contains options for synchronous counter instruments diff --git a/metric/syncint64.go b/metric/syncint64.go index f141695de..6f508eb66 100644 --- a/metric/syncint64.go +++ b/metric/syncint64.go @@ -32,7 +32,10 @@ type Int64Counter interface { embedded.Int64Counter // Add records a change to the counter. - Add(ctx context.Context, incr int64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) } // Int64CounterConfig contains options for synchronous counter instruments that @@ -82,7 +85,10 @@ type Int64UpDownCounter interface { embedded.Int64UpDownCounter // Add records a change to the counter. - Add(ctx context.Context, incr int64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) } // Int64UpDownCounterConfig contains options for synchronous counter @@ -132,7 +138,10 @@ type Int64Histogram interface { embedded.Int64Histogram // Record adds an additional value to the distribution. - Record(ctx context.Context, incr int64, opts ...RecordOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr int64, options ...RecordOption) } // Int64HistogramConfig contains options for synchronous counter instruments