You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-17 01:12:45 +02:00
Move metric api package into otel
(#1252)
* Update metric Kind to InstrumentKind * Update all the other modules with Kind rename * Update metric Descriptor with instrument Kind rename * Update other modules with Descriptor method rename * Update OTLP exporter test field name * Rename kind filenames * Add changes to CHANGELOG * Fix documentation for Grouping and PrecomputedSum * Rename meter.go to metric.go * Move descriptor.go into metric.go * Move must.go into metric.go * Move instruments into metric_instrument.go * Rename metric api_test.go to metric_test.go * Move instrumentkind_test.go into metric_test.go * Rename sdkapi.go metric_sdkapi.go * Move api/metric into otel * Update to use moved packages * Rename otel.go to error_handler.go * Add changes to CHANGELOG * Fix merge conflict resolution error
This commit is contained in:
@ -20,7 +20,6 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/api/global"
|
||||
"go.opentelemetry.io/otel/api/metric"
|
||||
"go.opentelemetry.io/otel/exporters/stdout"
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/propagators"
|
||||
@ -68,14 +67,14 @@ func main() {
|
||||
|
||||
commonLabels := []label.KeyValue{lemonsKey.Int(10), label.String("A", "1"), label.String("B", "2"), label.String("C", "3")}
|
||||
|
||||
oneMetricCB := func(_ context.Context, result metric.Float64ObserverResult) {
|
||||
oneMetricCB := func(_ context.Context, result otel.Float64ObserverResult) {
|
||||
result.Observe(1, commonLabels...)
|
||||
}
|
||||
_ = metric.Must(meter).NewFloat64ValueObserver("ex.com.one", oneMetricCB,
|
||||
metric.WithDescription("A ValueObserver set to 1.0"),
|
||||
_ = otel.Must(meter).NewFloat64ValueObserver("ex.com.one", oneMetricCB,
|
||||
otel.WithDescription("A ValueObserver set to 1.0"),
|
||||
)
|
||||
|
||||
valuerecorderTwo := metric.Must(meter).NewFloat64ValueRecorder("ex.com.two")
|
||||
valuerecorderTwo := otel.Must(meter).NewFloat64ValueRecorder("ex.com.two")
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = otel.ContextWithBaggageValues(ctx, fooKey.String("foo1"), barKey.String("bar1"))
|
||||
|
Reference in New Issue
Block a user