Skip to content

Commit

Permalink
Remove sdk/export/metric module, embed into the sdk/metric
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Nov 15, 2021
1 parent 6483b5c commit 9b2404b
Show file tree
Hide file tree
Showing 87 changed files with 109 additions and 264 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Changed

- Move export module `"go.opentelemetry.io/otel/sdk/export/metric"` into the "go.opentelemetry.io/otel/sdk/metric" module:
- Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382).

## [1.2.0] - 2021-11-12

## Changed
### Changed

- Metric SDK `export.ExportKind`, `export.ExportKindSelector` types have been renamed to `aggregation.Temporality` and `aggregation.TemporalitySelector` respectively to keep in line with current specification and protocol along with built-in selectors (e.g., `aggregation.CumulativeTemporalitySelector`, ...). (#2274)
- The Metric `Exporter` interface now requires a `TemporalitySelector` method instead of an `ExportKindSelector`. (#2274)
Expand Down
2 changes: 1 addition & 1 deletion bridge/opencensus/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"go.opencensus.io/metric/metricdata"

"go.opentelemetry.io/otel/metric/number"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion bridge/opencensus/aggregation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"go.opencensus.io/metric/metricdata"

"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
)

func TestNewAggregationFromPoints(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions bridge/opencensus/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"go.opentelemetry.io/otel/metric/number"
"go.opentelemetry.io/otel/metric/sdkapi"
"go.opentelemetry.io/otel/metric/unit"
export "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/export"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
"go.opentelemetry.io/otel/sdk/resource"
)

Expand Down
9 changes: 4 additions & 5 deletions bridge/opencensus/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ import (
"go.opentelemetry.io/otel/metric/number"
"go.opentelemetry.io/otel/metric/sdkapi"
"go.opentelemetry.io/otel/metric/unit"
export "go.opentelemetry.io/otel/sdk/export/metric"
exportmetric "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/controller/controllertest"
"go.opentelemetry.io/otel/sdk/metric/export"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
"go.opentelemetry.io/otel/sdk/resource"
)

Expand All @@ -46,9 +45,9 @@ type fakeExporter struct {
err error
}

func (f *fakeExporter) Export(ctx context.Context, res *resource.Resource, ilr exportmetric.InstrumentationLibraryReader) error {
func (f *fakeExporter) Export(ctx context.Context, res *resource.Resource, ilr export.InstrumentationLibraryReader) error {
return controllertest.ReadAll(ilr, aggregation.StatelessTemporalitySelector(),
func(_ instrumentation.Library, record exportmetric.Record) error {
func(_ instrumentation.Library, record export.Record) error {
f.resource = res
f.records = append(f.records, record)
return f.err
Expand Down
3 changes: 0 additions & 3 deletions bridge/opencensus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/metric v0.25.0
go.opentelemetry.io/otel/sdk v1.2.0
go.opentelemetry.io/otel/sdk/export/metric v0.25.0
go.opentelemetry.io/otel/sdk/metric v0.25.0
go.opentelemetry.io/otel/trace v1.2.0
)
Expand Down Expand Up @@ -44,8 +43,6 @@ replace go.opentelemetry.io/otel/sdk => ../../sdk

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 0 additions & 2 deletions bridge/opencensus/test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ replace go.opentelemetry.io/otel/metric => ../../../metric

replace go.opentelemetry.io/otel/sdk => ../../../sdk

replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../../trace
Expand Down
2 changes: 0 additions & 2 deletions bridge/opentracing/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ replace go.opentelemetry.io/otel/sdk => ../../sdk

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 0 additions & 2 deletions example/fib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk => ../../sdk

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 0 additions & 2 deletions example/jaeger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 0 additions & 2 deletions example/namedtracer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
4 changes: 1 addition & 3 deletions example/opencensus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.25.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.2.0
go.opentelemetry.io/otel/sdk v1.2.0
go.opentelemetry.io/otel/sdk/export/metric v0.25.0
go.opentelemetry.io/otel/sdk/metric v0.25.0
)

replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing
Expand Down Expand Up @@ -44,8 +44,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
4 changes: 2 additions & 2 deletions example/opencensus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"go.opentelemetry.io/otel/bridge/opencensus"
"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric"
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
otmetricexport "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/metric/export"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

Expand Down Expand Up @@ -100,7 +100,7 @@ func tracing(otExporter sdktrace.SpanExporter) {
// monitoring demonstrates creating an IntervalReader using the OpenTelemetry
// exporter to send metrics to the exporter by using either an OpenCensus
// registry or an OpenCensus view.
func monitoring(otExporter otmetricexport.Exporter) {
func monitoring(otExporter export.Exporter) {
log.Println("Using the OpenTelemetry stdoutmetric exporter to export OpenCensus metrics. This allows routing telemetry from both OpenTelemetry and OpenCensus to a single exporter.")
ocExporter := opencensus.NewMetricExporter(otExporter)
intervalReader, err := metricexport.NewIntervalReader(&metricexport.Reader{}, ocExporter)
Expand Down
2 changes: 0 additions & 2 deletions example/otel-collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 0 additions & 2 deletions example/passthrough/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/sdk/trace => ../../sdk/trace
Expand Down
3 changes: 0 additions & 3 deletions example/prometheus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/exporters/prometheus v0.25.0
go.opentelemetry.io/otel/metric v0.25.0
go.opentelemetry.io/otel/sdk/export/metric v0.25.0
go.opentelemetry.io/otel/sdk/metric v0.25.0
)

Expand Down Expand Up @@ -42,8 +41,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 1 addition & 1 deletion example/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
"go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/global"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/aggregator/histogram"
controller "go.opentelemetry.io/otel/sdk/metric/controller/basic"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
processor "go.opentelemetry.io/otel/sdk/metric/processor/basic"
selector "go.opentelemetry.io/otel/sdk/metric/selector/simple"
)
Expand Down
2 changes: 0 additions & 2 deletions example/zipkin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
2 changes: 0 additions & 2 deletions exporters/jaeger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools

replace go.opentelemetry.io/otel/metric => ../../metric

replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric

replace go.opentelemetry.io/otel/trace => ../../trace
Expand Down
8 changes: 4 additions & 4 deletions exporters/otlp/otlpmetric/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform"
"go.opentelemetry.io/otel/metric/sdkapi"
metricsdk "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/export"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
"go.opentelemetry.io/otel/sdk/resource"
metricpb "go.opentelemetry.io/proto/otlp/metrics/v1"
)
Expand All @@ -44,7 +44,7 @@ type Exporter struct {
}

// Export exports a batch of metrics.
func (e *Exporter) Export(ctx context.Context, res *resource.Resource, ilr metricsdk.InstrumentationLibraryReader) error {
func (e *Exporter) Export(ctx context.Context, res *resource.Resource, ilr export.InstrumentationLibraryReader) error {
rm, err := metrictransform.InstrumentationLibraryReader(ctx, e, res, ilr, 1)
if err != nil {
return err
Expand Down Expand Up @@ -100,7 +100,7 @@ func (e *Exporter) TemporalityFor(descriptor *sdkapi.Descriptor, kind aggregatio
return e.temporalitySelector.TemporalityFor(descriptor, kind)
}

var _ metricsdk.Exporter = (*Exporter)(nil)
var _ export.Exporter = (*Exporter)(nil)

// New constructs a new Exporter and starts it.
func New(ctx context.Context, client Client, opts ...Option) (*Exporter, error) {
Expand Down
18 changes: 9 additions & 9 deletions exporters/otlp/otlpmetric/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import (
"go.opentelemetry.io/otel/metric/metrictest"
"go.opentelemetry.io/otel/metric/number"
"go.opentelemetry.io/otel/metric/sdkapi"
metricsdk "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/aggregator/histogram"
"go.opentelemetry.io/otel/sdk/metric/aggregator/sum"
"go.opentelemetry.io/otel/sdk/metric/export"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
"go.opentelemetry.io/otel/sdk/metric/processor/processortest"
"go.opentelemetry.io/otel/sdk/resource"
commonpb "go.opentelemetry.io/proto/otlp/common/v1"
Expand Down Expand Up @@ -675,14 +675,14 @@ func TestStatelessAggregationTemporality(t *testing.T) {
func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource.Resource, records []testRecord, expected []*metricpb.ResourceMetrics) {
exp, driver := newExporter(t, opts...)

libraryRecs := map[instrumentation.Library][]metricsdk.Record{}
libraryRecs := map[instrumentation.Library][]export.Record{}
for _, r := range records {
lcopy := make([]attribute.KeyValue, len(r.labels))
copy(lcopy, r.labels)
desc := metrictest.NewDescriptor(r.name, r.iKind, r.nKind)
labs := attribute.NewSet(lcopy...)

var agg, ckpt metricsdk.Aggregator
var agg, ckpt export.Aggregator
if r.iKind.Adding() {
sums := sum.New(2)
agg, ckpt = &sums[0], &sums[1]
Expand Down Expand Up @@ -723,7 +723,7 @@ func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource.
Version: meterCfg.InstrumentationVersion(),
SchemaURL: meterCfg.SchemaURL(),
}
libraryRecs[lib] = append(libraryRecs[lib], metricsdk.NewRecord(&desc, &labs, ckpt.Aggregation(), intervalStart, intervalEnd))
libraryRecs[lib] = append(libraryRecs[lib], export.NewRecord(&desc, &labs, ckpt.Aggregation(), intervalStart, intervalEnd))
}
assert.NoError(t, exp.Export(context.Background(), res, processortest.MultiInstrumentationLibraryReader(libraryRecs)))

Expand Down Expand Up @@ -772,20 +772,20 @@ func TestEmptyMetricExport(t *testing.T) {
exp, driver := newExporter(t)

for _, test := range []struct {
records []metricsdk.Record
records []export.Record
want []*metricpb.ResourceMetrics
}{
{
[]metricsdk.Record(nil),
[]export.Record(nil),
[]*metricpb.ResourceMetrics(nil),
},
{
[]metricsdk.Record{},
[]export.Record{},
[]*metricpb.ResourceMetrics(nil),
},
} {
driver.Reset()
require.NoError(t, exp.Export(context.Background(), resource.Empty(), processortest.MultiInstrumentationLibraryReader(map[instrumentation.Library][]metricsdk.Record{
require.NoError(t, exp.Export(context.Background(), resource.Empty(), processortest.MultiInstrumentationLibraryReader(map[instrumentation.Library][]export.Record{
{
Name: testLibName,
}: test.records,
Expand Down
3 changes: 0 additions & 3 deletions exporters/otlp/otlpmetric/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/metric v0.25.0
go.opentelemetry.io/otel/sdk v1.2.0
go.opentelemetry.io/otel/sdk/export/metric v0.25.0
go.opentelemetry.io/otel/sdk/metric v0.25.0
go.opentelemetry.io/proto/otlp v0.11.0
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
Expand All @@ -27,8 +26,6 @@ replace go.opentelemetry.io/otel/metric => ../../../metric

replace go.opentelemetry.io/otel/trace => ../../../trace

replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric

replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric

replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/otlpmetric/internal/metrictransform/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"time"

"go.opentelemetry.io/otel/metric/number"
export "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/export"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
"go.opentelemetry.io/otel/sdk/resource"
commonpb "go.opentelemetry.io/proto/otlp/common/v1"
metricpb "go.opentelemetry.io/proto/otlp/metrics/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
"go.opentelemetry.io/otel/metric/metrictest"
"go.opentelemetry.io/otel/metric/number"
"go.opentelemetry.io/otel/metric/sdkapi"
export "go.opentelemetry.io/otel/sdk/export/metric"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
"go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue"
"go.opentelemetry.io/otel/sdk/metric/aggregator/minmaxsumcount"
"go.opentelemetry.io/otel/sdk/metric/aggregator/sum"
"go.opentelemetry.io/otel/sdk/metric/export"
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
commonpb "go.opentelemetry.io/proto/otlp/common/v1"
metricpb "go.opentelemetry.io/proto/otlp/metrics/v1"
)
Expand Down
Loading

0 comments on commit 9b2404b

Please sign in to comment.