Skip to content

Commit

Permalink
[exporters/otlp/otlpmetric] Wrap upload metrics error to provide addi…
Browse files Browse the repository at this point in the history
…tional context (#3974)

* Wrap upload metrics error to provide additional context

* Add PR number to CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Damien Mathieu <42@dmathieu.com>

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
  • Loading branch information
3 people committed Apr 10, 2023
1 parent a261a0f commit 1bc9b56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916)
- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941)
- `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider`
- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/otlpmetric/internal/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (e *exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e
e.clientMu.Unlock()
if upErr != nil {
if err == nil {
return upErr
return fmt.Errorf("failed to upload metrics: %w", upErr)
}
// Merge the two errors.
return fmt.Errorf("failed to upload incomplete metrics (%s): %w", err, upErr)
Expand Down

0 comments on commit 1bc9b56

Please sign in to comment.