-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
missed docstring for smithyotelmetrics
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |