Skip to content

Commit

Permalink
Deprecate instrument/** packages
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Nov 9, 2022
1 parent 9aebc3d commit e710a14
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 0 deletions.
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,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package asyncfloat64 provides asynchronous float64 instrument types.
//
// Deprecated: Use go.opentelemetry.io/otel/metric instead.
package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64"

import (
Expand All @@ -24,6 +27,8 @@ import (
// InstrumentProvider provides access to individual instruments.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use the go.opentelemetry.io/otel/metric.Meter methods instead.
type InstrumentProvider interface {
// Counter creates an instrument for recording increasing values.
Counter(name string, opts ...instrument.Option) (Counter, error)
Expand All @@ -38,6 +43,9 @@ type InstrumentProvider interface {
// Counter is an instrument that records increasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Float64ObservableCounter
// instead.
type Counter interface {
// Observe records the state of the instrument to be x. Implementations
// will assume x to be the cumulative sum of the count.
Expand All @@ -53,6 +61,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
// go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter instead.
type UpDownCounter interface {
// Observe records the state of the instrument to be x. Implementations
// will assume x to be the cumulative sum of the count.
Expand All @@ -68,6 +79,9 @@ type UpDownCounter interface {
// Gauge is an instrument that records independent readings.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Float64ObservableGauge
// instead.
type Gauge interface {
// Observe records the state of the instrument to be x.
//
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,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package asyncint64 provides asynchronous int64 instrument types.
//
// Deprecated: Use go.opentelemetry.io/otel/metric instead.
package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64"

import (
Expand All @@ -24,6 +27,8 @@ import (
// InstrumentProvider provides access to individual instruments.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use the go.opentelemetry.io/otel/metric.Meter methods instead.
type InstrumentProvider interface {
// Counter creates an instrument for recording increasing values.
Counter(name string, opts ...instrument.Option) (Counter, error)
Expand All @@ -38,6 +43,9 @@ type InstrumentProvider interface {
// Counter is an instrument that records increasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Int64ObservableCounter
// instead.
type Counter interface {
// Observe records the state of the instrument to be x. Implementations
// will assume x to be the cumulative sum of the count.
Expand All @@ -53,6 +61,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 go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter
// instead.
type UpDownCounter interface {
// Observe records the state of the instrument to be x. Implementations
// will assume x to be the cumulative sum of the count.
Expand All @@ -68,6 +79,9 @@ type UpDownCounter interface {
// Gauge is an instrument that records independent readings.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Int64ObservableGauge
// instead.
type Gauge interface {
// Observe records the state of the instrument to be x.
//
Expand Down
13 changes: 13 additions & 0 deletions metric/instrument/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package instrument provides OpenTelemetry metric API instrument types.
//
// Deprecated: Use go.opentelemetry.io/otel/metric instead.
package instrument // import "go.opentelemetry.io/otel/metric/instrument"

import "go.opentelemetry.io/otel/metric/unit"

// Config contains options for metric instrument descriptors.
//
// Deprecated: use go.opentelemetry.io/otel/metric.InstrumentConfig instead.
type Config struct {
description string
unit unit.Unit
Expand All @@ -33,11 +38,15 @@ func (cfg Config) Unit() unit.Unit {
}

// Option is an interface for applying metric instrument options.
//
// Deprecated: use go.opentelemetry.io/otel/metric.InstrumentOption instead.
type Option interface {
applyInstrument(Config) Config
}

// NewConfig creates a new Config and applies all the given options.
//
// Deprecated: use go.opentelemetry.io/otel/metric.NewInstrumentConfig instead.
func NewConfig(opts ...Option) Config {
var config Config
for _, o := range opts {
Expand All @@ -53,6 +62,8 @@ func (fn optionFunc) applyInstrument(cfg Config) Config {
}

// WithDescription applies provided description.
//
// Deprecated: use go.opentelemetry.io/otel/metric.WithDescription instead.
func WithDescription(desc string) Option {
return optionFunc(func(cfg Config) Config {
cfg.description = desc
Expand All @@ -61,6 +72,8 @@ func WithDescription(desc string) Option {
}

// WithUnit applies provided unit.
//
// Deprecated: use go.opentelemetry.io/otel/metric.WithUnit instead.
func WithUnit(u unit.Unit) Option {
return optionFunc(func(cfg Config) Config {
cfg.unit = u
Expand Down
4 changes: 4 additions & 0 deletions metric/instrument/instrument.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument"
// If an instrument is observed outside of it's callback it should be an error.
//
// This interface is used as a grouping mechanism.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Observable instead.
type Asynchronous interface {
asynchronous()
}

// Synchronous instruments are updated in line with application code.
//
// This interface is used as a grouping mechanism.
//
// Deprecated: this interface will be removed in the next release.
type Synchronous interface {
synchronous()
}
11 changes: 11 additions & 0 deletions metric/instrument/syncfloat64/syncfloat64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package syncfloat64 provides asynchronous float64 instrument types.
//
// Deprecated: Use go.opentelemetry.io/otel/metric instead.
package syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64"

import (
Expand All @@ -24,6 +27,8 @@ import (
// InstrumentProvider provides access to individual instruments.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use the go.opentelemetry.io/otel/metric.Meter methods instead.
type InstrumentProvider interface {
// Counter creates an instrument for recording increasing values.
Counter(name string, opts ...instrument.Option) (Counter, error)
Expand All @@ -36,6 +41,8 @@ type InstrumentProvider interface {
// Counter is an instrument that records increasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Float64Counter instead.
type Counter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
Expand All @@ -46,6 +53,8 @@ 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 go.opentelemetry.io/otel/metric.Float64UpDownCounter instead.
type UpDownCounter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
Expand All @@ -56,6 +65,8 @@ 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 go.opentelemetry.io/otel/metric.Float64Histogram instead.
type Histogram interface {
// Record adds an additional value to the distribution.
Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
Expand Down
11 changes: 11 additions & 0 deletions metric/instrument/syncint64/syncint64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package syncint64 provides asynchronous int64 instrument types.
//
// Deprecated: Use go.opentelemetry.io/otel/metric instead.
package syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64"

import (
Expand All @@ -24,6 +27,8 @@ import (
// InstrumentProvider provides access to individual instruments.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use the go.opentelemetry.io/otel/metric.Meter methods instead.
type InstrumentProvider interface {
// Counter creates an instrument for recording increasing values.
Counter(name string, opts ...instrument.Option) (Counter, error)
Expand All @@ -36,6 +41,8 @@ type InstrumentProvider interface {
// Counter is an instrument that records increasing values.
//
// Warning: methods may be added to this interface in minor releases.
//
// Deprecated: use go.opentelemetry.io/otel/metric.Int64Counter instead.
type Counter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Expand All @@ -46,6 +53,8 @@ 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 go.opentelemetry.io/otel/metric.Int64UpDownCounter instead.
type UpDownCounter interface {
// Add records a change to the counter.
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Expand All @@ -56,6 +65,8 @@ 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 go.opentelemetry.io/otel/metric.Int64Histogram instead.
type Histogram interface {
// Record adds an additional value to the distribution.
Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Expand Down

0 comments on commit e710a14

Please sign in to comment.