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

Deprecate the syncint64/syncfloat64/asyncint64/asyncfloat64 packages #3575

Merged
merged 6 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578)
- Add the `go.opentelemetry.io/otel/semconv/v1.16.0` package.
The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579)
- Metric instruments were added to `go.opentelemetry.io/otel/metric/instrument`.
These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575)
- `Float64ObservableCounter` replaces the `asyncfloat64.Counter`
- `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter`
- `Float64ObservableGauge` replaces the `asyncfloat64.Gauge`
- `Int64ObservableCounter` replaces the `asyncint64.Counter`
- `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter`
- `Int64ObservableGauge` replaces the `asyncint64.Gauge`
- `Float64Counter` replaces the `syncfloat64.Counter`
- `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter`
- `Float64Histogram` replaces the `syncfloat64.Histogram`
- `Int64Counter` replaces the `syncint64.Counter`
- `Int64UpDownCounter` replaces the `syncint64.UpDownCounter`
- `Int64Histogram` replaces the `syncint64.Histogram`

### Changed

Expand Down Expand Up @@ -89,6 +103,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Deprecated

- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. Use `NewMetricProducer` instead. (#3541)
- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated.
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated.
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated.
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated.
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)

### Removed

Expand Down
3 changes: 1 addition & 2 deletions metric/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
"go.opentelemetry.io/otel/metric/unit"
)

Expand Down Expand Up @@ -112,4 +111,4 @@ func ExampleMeter_asynchronous_multiple() {
}

// This is just an example, see the the contrib runtime instrumentation for real implementation.
func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) {}
func computeGCPauses(ctx context.Context, recorder instrument.Float64Histogram, pauseBuff []uint64) {}
24 changes: 24 additions & 0 deletions metric/instrument/asyncfloat64.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ type Float64Observer interface {
Observe(ctx context.Context, value float64, attributes ...attribute.KeyValue)
}

// Float64ObservableCounter is an instrument used to asynchronously record
// increasing float64 measurements once per a measurement collection cycle. The
// Observe method is used to record the measured state of the instrument when
// it is called. Implementations will assume the observed value to be the
// cumulative sum of the count.
//
// Warning: methods may be added to this interface in minor releases.
type Float64ObservableCounter interface{ Float64Observer }

// Float64ObservableUpDownCounter is an instrument used to asynchronously
// record float64 measurements once per a measurement collection cycle. The
// Observe method is used to record the measured state of the instrument when
// it is called. Implementations will assume the observed value to be the
// cumulative sum of the count.
//
// Warning: methods may be added to this interface in minor releases.
type Float64ObservableUpDownCounter interface{ Float64Observer }

// Float64ObservableGauge is an instrument used to asynchronously record
// instantaneous float64 measurements once per a measurement collection cycle.
//
// Warning: methods may be added to this interface in minor releases.
type Float64ObservableGauge interface{ Float64Observer }

// Float64Callback is a function registered with a Meter that makes
// observations for a Float64Observer it is registered with.
//
Expand Down
14 changes: 14 additions & 0 deletions metric/instrument/asyncfloat64/asyncfloat64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package asyncfloat64 provides asynchronous instruments that accept float64
// measurments.
//
// Deprecated: Use the instruments provided by
// go.opentelemetry.io/otel/metric/instrument instead.
package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64"

import "go.opentelemetry.io/otel/metric/instrument"
Expand All @@ -23,6 +28,9 @@ import "go.opentelemetry.io/otel/metric/instrument"
// the count.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Float64ObservableCounter in
// go.opentelemetry.io/otel/metric/instrument instead.
type Counter interface{ instrument.Float64Observer }

// UpDownCounter is an instrument used to asynchronously record float64
Expand All @@ -32,10 +40,16 @@ type Counter interface{ instrument.Float64Observer }
// the count.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Float64ObservableUpDownCounter in
// go.opentelemetry.io/otel/metric/instrument instead.
type UpDownCounter interface{ instrument.Float64Observer }

// Gauge is an instrument used to asynchronously record instantaneous float64
// measurements once per a measurement collection cycle.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Float64ObservableGauge in
// go.opentelemetry.io/otel/metric/instrument instead.
type Gauge interface{ instrument.Float64Observer }
24 changes: 24 additions & 0 deletions metric/instrument/asyncint64.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ type Int64Observer interface {
Observe(ctx context.Context, value int64, attributes ...attribute.KeyValue)
}

// Int64ObservableCounter is an instrument used to asynchronously record
// increasing int64 measurements once per a measurement collection cycle. The
// Observe method is used to record the measured state of the instrument when
// it is called. Implementations will assume the observed value to be the
// cumulative sum of the count.
//
// Warning: methods may be added to this interface in minor releases.
type Int64ObservableCounter interface{ Int64Observer }

// Int64ObservableUpDownCounter is an instrument used to asynchronously record
// int64 measurements once per a measurement collection cycle. The Observe
// method is used to record the measured state of the instrument when it is
// called. Implementations will assume the observed value to be the cumulative
// sum of the count.
//
// Warning: methods may be added to this interface in minor releases.
type Int64ObservableUpDownCounter interface{ Int64Observer }

// Int64ObservableGauge is an instrument used to asynchronously record
// instantaneous int64 measurements once per a measurement collection cycle.
//
// Warning: methods may be added to this interface in minor releases.
type Int64ObservableGauge interface{ Int64Observer }

// Int64Callback is a function registered with a Meter that makes
// observations for an Int64Observer it is registered with.
//
Expand Down
14 changes: 14 additions & 0 deletions metric/instrument/asyncint64/asyncint64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package asyncint64 provides asynchronous instruments that accept int64
// measurments.
//
// Deprecated: Use the instruments provided by
// go.opentelemetry.io/otel/metric/instrument instead.
package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64"

import "go.opentelemetry.io/otel/metric/instrument"
Expand All @@ -23,6 +28,9 @@ import "go.opentelemetry.io/otel/metric/instrument"
// the count.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Int64ObservableCounter in
// go.opentelemetry.io/otel/metric/instrument instead.
type Counter interface{ instrument.Int64Observer }

// UpDownCounter is an instrument used to asynchronously record int64
Expand All @@ -32,10 +40,16 @@ type Counter interface{ instrument.Int64Observer }
// the count.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Int64ObservableUpDownCounter in
// go.opentelemetry.io/otel/metric/instrument instead.
type UpDownCounter interface{ instrument.Int64Observer }

// Gauge is an instrument used to asynchronously record instantaneous int64
// measurements once per a measurement collection cycle.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Int64ObservableGauge in
// go.opentelemetry.io/otel/metric/instrument instead.
type Gauge interface{ instrument.Int64Observer }
35 changes: 35 additions & 0 deletions metric/instrument/syncfloat64.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,44 @@
package instrument // import "go.opentelemetry.io/otel/metric/instrument"

import (
"context"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric/unit"
)

// Float64Counter is an instrument that records increasing float64 values.
//
// Warning: methods may be added to this interface in minor releases.
type Float64Counter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)

Synchronous
}

// Float64UpDownCounter is an instrument that records increasing or decreasing
// float64 values.
//
// Warning: methods may be added to this interface in minor releases.
type Float64UpDownCounter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)

Synchronous
}

// Float64Histogram is an instrument that records a distribution of float64
// values.
//
// Warning: methods may be added to this interface in minor releases.
type Float64Histogram interface {
// Record adds an additional value to the distribution.
Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue)

Synchronous
}

// Float64Config contains options for Asynchronous instruments that
// observe float64 values.
type Float64Config struct {
Expand Down
14 changes: 14 additions & 0 deletions metric/instrument/syncfloat64/syncfloat64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package syncfloat64 provides synchronous instruments that accept float64
// measurments.
//
// Deprecated: Use the instruments provided by
// go.opentelemetry.io/otel/metric/instrument instead.
package syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64"

import (
Expand All @@ -24,6 +29,9 @@ import (
// Counter is an instrument that records increasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Float64Counter in
// go.opentelemetry.io/otel/metric/instrument instead.
type Counter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
Expand All @@ -34,6 +42,9 @@ type Counter interface {
// UpDownCounter is an instrument that records increasing or decreasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Float64UpDownCounter in
// go.opentelemetry.io/otel/metric/instrument instead.
type UpDownCounter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
Expand All @@ -44,6 +55,9 @@ type UpDownCounter interface {
// Histogram is an instrument that records a distribution of values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Float64Histogram in
// go.opentelemetry.io/otel/metric/instrument instead.
type Histogram interface {
// Record adds an additional value to the distribution.
Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
Expand Down
35 changes: 35 additions & 0 deletions metric/instrument/syncint64.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,44 @@
package instrument // import "go.opentelemetry.io/otel/metric/instrument"

import (
"context"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric/unit"
)

// Int64Counter is an instrument that records increasing int64 values.
//
// Warning: methods may be added to this interface in minor releases.
type Int64Counter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Synchronous
}

// Int64UpDownCounter is an instrument that records increasing or decreasing
// int64 values.
//
// Warning: methods may be added to this interface in minor releases.
type Int64UpDownCounter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Synchronous
}

// Int64Histogram is an instrument that records a distribution of int64
// values.
//
// Warning: methods may be added to this interface in minor releases.
type Int64Histogram interface {
// Record adds an additional value to the distribution.
Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue)

Synchronous
}

// Int64Config contains options for Synchronous instruments that record int64
// values.
type Int64Config struct {
Expand Down
14 changes: 14 additions & 0 deletions metric/instrument/syncint64/syncint64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package syncint64 provides synchronous instruments that accept int64
// measurments.
//
// Deprecated: Use the instruments provided by
// go.opentelemetry.io/otel/metric/instrument instead.
package syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64"

import (
Expand All @@ -24,6 +29,9 @@ import (
// Counter is an instrument that records increasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Int64Counter in
// go.opentelemetry.io/otel/metric/instrument instead.
type Counter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Expand All @@ -34,6 +42,9 @@ type Counter interface {
// UpDownCounter is an instrument that records increasing or decreasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Int64UpDownCounter in
// go.opentelemetry.io/otel/metric/instrument instead.
type UpDownCounter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Expand All @@ -44,6 +55,9 @@ type UpDownCounter interface {
// Histogram is an instrument that records a distribution of values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: Use the Int64Histogram in
// go.opentelemetry.io/otel/metric/instrument instead.
type Histogram interface {
// Record adds an additional value to the distribution.
Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Expand Down