Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move otlpmetrics Client to an internal package. #3486

Merged
merged 5 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432)
- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440)

## Removed

- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#????)
- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#????)
MadVikingGod marked this conversation as resolved.
Show resolved Hide resolved

MrAlias marked this conversation as resolved.
Show resolved Hide resolved
## [1.11.1/0.33.0] 2022-10-19

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

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

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

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

package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
MadVikingGod marked this conversation as resolved.
Show resolved Hide resolved
import (
"context"
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

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

import (
"context"
Expand Down
6 changes: 3 additions & 3 deletions exporters/otlp/otlpmetric/internal/otest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"google.golang.org/protobuf/proto"

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
"go.opentelemetry.io/otel/metric/unit"
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
Expand Down Expand Up @@ -168,13 +168,13 @@ var (
)

// ClientFactory is a function that when called returns a
// otlpmetric.Client implementation that is connected to also returned
// internal.Client implementation that is connected to also returned
// Collector implementation. The Client is ready to upload metric data to the
// Collector which is ready to store that data.
//
// If resultCh is not nil, the returned Collector needs to use the responses
// from that channel to send back to the client for every export request.
type ClientFactory func(resultCh <-chan ExportResult) (otlpmetric.Client, Collector)
type ClientFactory func(resultCh <-chan ExportResult) (internal.Client, Collector)

// RunClientTests runs a suite of Client integration tests. For example:
//
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/otlpmetric/internal/otest/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/internal"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
Expand Down Expand Up @@ -67,7 +67,7 @@ func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() }
func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() }

func TestClientTests(t *testing.T) {
factory := func(rCh <-chan ExportResult) (otlpmetric.Client, Collector) {
factory := func(rCh <-chan ExportResult) (ominternal.Client, Collector) {
c := &client{rCh: rCh, storage: NewStorage()}
return c, c
}
Expand Down
6 changes: 3 additions & 3 deletions exporters/otlp/otlpmetric/otlpmetricgrpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/internal"
"go.opentelemetry.io/otel/exporters/otlp/internal/retry"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"
Expand All @@ -49,7 +49,7 @@ func New(ctx context.Context, options ...Option) (metric.Exporter, error) {
if err != nil {
return nil, err
}
return otlpmetric.New(c), nil
return ominternal.New(c), nil
}

type client struct {
Expand All @@ -70,7 +70,7 @@ type client struct {
}

// newClient creates a new gRPC metric client.
func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error) {
func newClient(ctx context.Context, options ...Option) (ominternal.Client, error) {
cfg := oconf.NewGRPCConfig(asGRPCOptions(options)...)

c := &client{
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/durationpb"

"go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestRetryable(t *testing.T) {
}

func TestClient(t *testing.T) {
factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) {
factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) {
coll, err := otest.NewGRPCCollector("", rCh)
require.NoError(t, err)

Expand Down
6 changes: 3 additions & 3 deletions exporters/otlp/otlpmetric/otlpmetrichttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/internal"
"go.opentelemetry.io/otel/exporters/otlp/internal/retry"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/aggregation"
Expand All @@ -49,7 +49,7 @@ func New(_ context.Context, opts ...Option) (metric.Exporter, error) {
if err != nil {
return nil, err
}
return otlpmetric.New(c), nil
return ominternal.New(c), nil
}

type client struct {
Expand Down Expand Up @@ -81,7 +81,7 @@ var ourTransport = &http.Transport{
}

// newClient creates a new HTTP metric client.
func newClient(opts ...Option) (otlpmetric.Client, error) {
func newClient(opts ...Option) (ominternal.Client, error) {
cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...)

httpClient := &http.Client{
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
)

func TestClient(t *testing.T) {
factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) {
factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) {
coll, err := otest.NewHTTPCollector("", rCh)
require.NoError(t, err)

Expand Down