Skip to content

Commit

Permalink
Merge branch 'main' into new_sdk/main
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Sep 15, 2022
2 parents 88e49c4 + 0e6f9c2 commit 03c2e0b
Show file tree
Hide file tree
Showing 49 changed files with 429 additions and 215 deletions.
34 changes: 18 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- Support Go 1.19.
Include compatibility testing and document support. (#3077)
- Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107)
- Add an `Attribute` field to the `Scope` type in `go.opentelemetry.io/otel/sdk/instrumentation`. (#3131)
- Add the `WithScopeAttributes` `TracerOption` to the `go.opentelemetry.io/otel/trace` package. (#3131)
- Add the `WithScopeAttributes` `MeterOption` to the `go.opentelemetry.io/otel/metric` package. (#3132)

### Changed

- Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096)
- The exponential histogram mapping functions have been updated with
exact upper-inclusive boundary support following the [corresponding
specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982)
- Attempting to start a span with a nil `context` will no longer cause a panic. (#3110)
- Export scope attributes for all exporters provided by `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#3131)
- The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification.
Please see the package documentation for how the new SDK is initialized and configured. (TBD)

Expand Down Expand Up @@ -57,6 +42,22 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (TBD)
- The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (TBD)

## [1.10.0] - 2022-09-09

### Added

- Support Go 1.19. (#3077)
Include compatibility testing and document support. (#3077)
- Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106)
- Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107)

### Changed

- Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096)
- Attempting to start a span with a nil `context` will no longer cause a panic. (#3110)
- All exporters will be shutdown even if one reports an error (#3091)
- Ensure valid UTF-8 when truncating over-length attribute values. (#3156)

## [1.9.0/0.0.3] - 2022-08-01

### Added
Expand Down Expand Up @@ -1940,7 +1941,8 @@ It contains api and sdk for trace and meter.
- CircleCI build CI manifest files.
- CODEOWNERS file to track owners of this project.

[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.9.0...HEAD
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.10.0...HEAD
[1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0
[1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0
[1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0
[1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions bridge/opencensus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.17

require (
go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions bridge/opencensus/opencensusmetric/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
go.opencensus.io v0.23.0
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000
go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000
)
Expand All @@ -13,7 +13,7 @@ require (
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect
)

Expand Down
6 changes: 3 additions & 3 deletions bridge/opencensus/test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ go 1.17

require (
go.opencensus.io v0.23.0
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/bridge/opencensus v0.31.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions bridge/opentracing/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../..
require (
github.com/opentracing/opentracing-go v1.2.0
github.com/stretchr/testify v1.7.2
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
8 changes: 4 additions & 4 deletions example/fib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib
go 1.17

require (
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
8 changes: 4 additions & 4 deletions example/jaeger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ replace (
)

require (
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/jaeger v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/jaeger v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/stretchr/objx v0.4.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect
)

Expand Down
8 changes: 4 additions & 4 deletions example/namedtracer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ replace (

require (
github.com/go-logr/stdr v1.2.2
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
12 changes: 6 additions & 6 deletions example/otel-collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ replace (
)

require (
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
google.golang.org/grpc v1.46.2
)

Expand All @@ -21,8 +21,8 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
Expand Down
8 changes: 4 additions & 4 deletions example/passthrough/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough
go 1.17

require (
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
8 changes: 4 additions & 4 deletions example/prometheus/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/open-telemetry/opentelemetry-go/example/prometheus
module go.opentelemetry.io/otel/example/prometheus

go 1.18

require (
github.com/prometheus/client_golang v1.13.0
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/prometheus v0.31.0
go.opentelemetry.io/otel/metric v0.31.0
go.opentelemetry.io/otel/sdk/metric v0.31.0
Expand All @@ -20,8 +20,8 @@ require (
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
go.opentelemetry.io/otel/sdk v1.8.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
Expand Down
8 changes: 4 additions & 4 deletions example/zipkin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ replace (
)

require (
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/zipkin v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/zipkin v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
22 changes: 22 additions & 0 deletions exporters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# OpenTelemetry Exporters

Once the OpenTelemetry SDK has created and processed telemetry, it needs to be exported.
This package contains exporters for this purpose.

## Exporter Packages

The following exporter packages are provided with the following OpenTelemetry signal support.

| Exporter Package | Metrics | Traces |
| :-----------------------------------------------------------------------------: | :-----: | :----: |
| [go.opentelemetry.io/otel/exporters/jaeger](./jaeger) | ||
| [go.opentelemetry.io/otel/exporters/otlp/otlpmetric](./otlp/otlpmetric) || |
| [go.opentelemetry.io/otel/exporters/otlp/otlptrace](./otlp/otlptrace) | ||
| [go.opentelemetry.io/otel/exporters/prometheus](./prometheus) || |
| [go.opentelemetry.io/otel/exporters/stdout/stdoutmetric](./stdout/stdoutmetric) || |
| [go.opentelemetry.io/otel/exporters/stdout/stdouttrace](./stdout/stdouttrace) | ||
| [go.opentelemetry.io/otel/exporters/zipkin](./zipkin) | ||

See the [OpenTelemetry registry] for 3rd-part exporters compatible with this project.

[OpenTelemetry registry]: https://opentelemetry.io/registry/?language=go&component=exporter
6 changes: 3 additions & 3 deletions exporters/jaeger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ go 1.17
require (
github.com/google/go-cmp v0.5.8
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
)

require (
Expand Down
68 changes: 68 additions & 0 deletions exporters/otlp/internal/partialsuccess.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal"

import "fmt"

// PartialSuccessDropKind indicates the kind of partial success error
// received by an OTLP exporter, which corresponds with the signal
// being exported.
type PartialSuccessDropKind string

const (
// TracingPartialSuccess indicates that some spans were rejected.
TracingPartialSuccess PartialSuccessDropKind = "spans"

// MetricsPartialSuccess indicates that some metric data points were rejected.
MetricsPartialSuccess PartialSuccessDropKind = "metric data points"
)

// PartialSuccess represents the underlying error for all handling
// OTLP partial success messages. Use `errors.Is(err,
// PartialSuccess{})` to test whether an error passed to the OTel
// error handler belongs to this category.
type PartialSuccess struct {
ErrorMessage string
RejectedItems int64
RejectedKind PartialSuccessDropKind
}

var _ error = PartialSuccess{}

// Error implements the error interface.
func (ps PartialSuccess) Error() string {
msg := ps.ErrorMessage
if msg == "" {
msg = "empty message"
}
return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind)
}

// Is supports the errors.Is() interface.
func (ps PartialSuccess) Is(err error) bool {
_, ok := err.(PartialSuccess)
return ok
}

// PartialSuccessToError produces an error suitable for passing to
// `otel.Handle()` out of the fields in a partial success response,
// independent of which signal produced the outcome.
func PartialSuccessToError(kind PartialSuccessDropKind, itemsRejected int64, errorMessage string) error {
return PartialSuccess{
ErrorMessage: errorMessage,
RejectedItems: itemsRejected,
RejectedKind: kind,
}
}
44 changes: 44 additions & 0 deletions exporters/otlp/internal/partialsuccess_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal"

import (
"errors"
"strings"
"testing"

"github.com/stretchr/testify/require"
)

func requireErrorString(t *testing.T, expect string, err error) {
t.Helper()
require.NotNil(t, err)
require.Error(t, err)
require.True(t, errors.Is(err, PartialSuccess{}))

const pfx = "OTLP partial success: "

msg := err.Error()
require.True(t, strings.HasPrefix(msg, pfx))
require.Equal(t, expect, msg[len(pfx):])
}

func TestPartialSuccessFormat(t *testing.T) {
requireErrorString(t, "empty message (0 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 0, ""))
requireErrorString(t, "help help (0 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 0, "help help"))
requireErrorString(t, "what happened (10 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 10, "what happened"))
requireErrorString(t, "what happened (15 spans rejected)", PartialSuccessToError(TracingPartialSuccess, 15, "what happened"))
requireErrorString(t, "empty message (7 log records rejected)", PartialSuccessToError("log records", 7, ""))
}
Loading

0 comments on commit 03c2e0b

Please sign in to comment.