Skip to content

Commit

Permalink
missed docstring for smithyotelmetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Sep 13, 2024
1 parent 49f7da9 commit 24e8315
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics/smithy-otel-metrics/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type int64Observer struct {

var _ metrics.Int64Observer = (*int64Observer)(nil)

func (o *int64Observer) Observe(ctx context.Context, v int64, opts ...metrics.RecordMetricOption) {
func (o *int64Observer) Observe(_ context.Context, v int64, opts ...metrics.RecordMetricOption) {
o.observer.ObserveInt64(o.instrument, v, withMetricProps(opts...))
}

Expand All @@ -48,7 +48,7 @@ type float64Observer struct {

var _ metrics.Float64Observer = (*float64Observer)(nil)

func (o *float64Observer) Observe(ctx context.Context, v float64, opts ...metrics.RecordMetricOption) {
func (o *float64Observer) Observe(_ context.Context, v float64, opts ...metrics.RecordMetricOption) {
o.observer.ObserveFloat64(o.instrument, v, withMetricProps(opts...))
}

Expand Down
40 changes: 40 additions & 0 deletions metrics/smithy-otel-metrics/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Package smithyotelmetrics implements a Smithy client metrics adapter for the
// OTEL Go SDK.
//
// # Usage
//
// Callers use the [Adapt] API in this package to wrap a concrete OTEL SDK
// MeterProvider.
//
// The following example uses the AWS SDK for S3:
//
// import (
// "github.com/aws/aws-sdk-go-v2/config"
// "github.com/aws/aws-sdk-go-v2/service/s3"
// smithyotelmetrics "github.com/aws/smithy-go/metrics/smithy-otel-metrics"
// "go.opentelemetry.io/otel/sdk/metric"
// "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
// )
//
// func main() {
// cfg, err := config.LoadDefaultConfig(context.Background())
// if err != nil {
// panic(err)
// }
//
// // export via OTLP - perhaps to the otel collector, etc.
// exporter, err := otlpmetrichttp.New(ctx, otlpmetrichttp.WithEndpointURL("http://localhost:4318"))
// if err != nil {
// panic(err)
// }
//
// // aggressive reader interval for demonstration purposes
// reader := metric.NewPeriodicReader(exporter, metric.WithInterval(time.Second))
// provider := metric.NewMeterProvider(metric.WithReader(reader)
//
// svc := s3.NewFromConfig(cfg, func(o *s3.Options) {
// o.MeterProvider = smithyotelmetrics.Adapt(provider)
// })
// // ...
// }
package smithyotelmetrics

0 comments on commit 24e8315

Please sign in to comment.