mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-04-17 11:46:27 +02:00
Remove unneeded metrictest types (#2864)
* Remove unneeded metrictest types * Add changes to changelog * Revert removal of NewDescriptor
This commit is contained in:
parent
d342bdefa9
commit
776accd250
@ -42,6 +42,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
- The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated.
|
- The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated.
|
||||||
Use the equivalent `MergeIterator.Attribute` method instead. (#2790)
|
Use the equivalent `MergeIterator.Attribute` method instead. (#2790)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Removed the `Batch` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864)
|
||||||
|
- Removed the `Measurement` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864)
|
||||||
|
|
||||||
## [0.29.0] - 2022-04-11
|
## [0.29.0] - 2022-04-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
// 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 metrictest
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/internal/internaltest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// TestMain ensures struct alignment prior to running tests.
|
|
||||||
func TestMain(m *testing.M) {
|
|
||||||
fields := []internaltest.FieldOffset{
|
|
||||||
{
|
|
||||||
Name: "Batch.Measurments",
|
|
||||||
Offset: unsafe.Offsetof(Batch{}.Measurements),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "Measurement.Number",
|
|
||||||
Offset: unsafe.Offsetof(Measurement{}.Number),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if !internaltest.Aligned8Byte(fields, os.Stderr) {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(m.Run())
|
|
||||||
}
|
|
@ -20,12 +20,14 @@ import (
|
|||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/metric"
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||||
controller "go.opentelemetry.io/otel/sdk/metric/controller/basic"
|
controller "go.opentelemetry.io/otel/sdk/metric/controller/basic"
|
||||||
"go.opentelemetry.io/otel/sdk/metric/export"
|
"go.opentelemetry.io/otel/sdk/metric/export"
|
||||||
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
|
"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
|
||||||
"go.opentelemetry.io/otel/sdk/metric/number"
|
"go.opentelemetry.io/otel/sdk/metric/number"
|
||||||
processor "go.opentelemetry.io/otel/sdk/metric/processor/basic"
|
processor "go.opentelemetry.io/otel/sdk/metric/processor/basic"
|
||||||
|
"go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
||||||
selector "go.opentelemetry.io/otel/sdk/metric/selector/simple"
|
selector "go.opentelemetry.io/otel/sdk/metric/selector/simple"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -62,6 +64,14 @@ func NewTestMeterProvider(opts ...Option) (metric.MeterProvider, *Exporter) {
|
|||||||
return c, exp
|
return c, exp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Library is the same as "sdk/instrumentation".Library but there is
|
||||||
|
// a package cycle to use it so it is redeclared here.
|
||||||
|
type Library struct {
|
||||||
|
InstrumentationName string
|
||||||
|
InstrumentationVersion string
|
||||||
|
SchemaURL string
|
||||||
|
}
|
||||||
|
|
||||||
// ExportRecord represents one collected datapoint from the Exporter.
|
// ExportRecord represents one collected datapoint from the Exporter.
|
||||||
type ExportRecord struct {
|
type ExportRecord struct {
|
||||||
InstrumentName string
|
InstrumentName string
|
||||||
@ -178,3 +188,10 @@ func subSet(attributesA, attributesB []attribute.KeyValue) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewDescriptor is a test helper for constructing test metric
|
||||||
|
// descriptors using standard options.
|
||||||
|
func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...instrument.Option) sdkapi.Descriptor {
|
||||||
|
cfg := instrument.NewConfig(opts...)
|
||||||
|
return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit())
|
||||||
|
}
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
// 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 metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/metric/instrument"
|
|
||||||
"go.opentelemetry.io/otel/sdk/metric/number"
|
|
||||||
"go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
|
|
||||||
// Library is the same as "sdk/instrumentation".Library but there is
|
|
||||||
// a package cycle to use it.
|
|
||||||
Library struct {
|
|
||||||
InstrumentationName string
|
|
||||||
InstrumentationVersion string
|
|
||||||
SchemaURL string
|
|
||||||
}
|
|
||||||
|
|
||||||
Batch struct {
|
|
||||||
// Measurement needs to be aligned for 64-bit atomic operations.
|
|
||||||
Measurements []Measurement
|
|
||||||
Ctx context.Context
|
|
||||||
Attributes []attribute.KeyValue
|
|
||||||
Library Library
|
|
||||||
}
|
|
||||||
|
|
||||||
Measurement struct {
|
|
||||||
// Number needs to be aligned for 64-bit atomic operations.
|
|
||||||
Number number.Number
|
|
||||||
Instrument sdkapi.InstrumentImpl
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewDescriptor is a test helper for constructing test metric
|
|
||||||
// descriptors using standard options.
|
|
||||||
func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...instrument.Option) sdkapi.Descriptor {
|
|
||||||
cfg := instrument.NewConfig(opts...)
|
|
||||||
return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit())
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user