diff options
Diffstat (limited to 'vendor/go.opentelemetry.io/contrib')
5 files changed, 56 insertions, 94 deletions
diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/doc.go b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/doc.go index 2b5e78686..fabf952c4 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/doc.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/doc.go @@ -5,6 +5,18 @@ // // The metric events produced are: // +// go.memory.used By Memory used by the Go runtime. +// go.memory.limit By Go runtime memory limit configured by the user, if a limit exists. +// go.memory.allocated By Memory allocated to the heap by the application. +// go.memory.allocations {allocation} Count of allocations to the heap by the application. +// go.memory.gc.goal By Heap size target for the end of the GC cycle. +// go.goroutine.count {goroutine} Count of live goroutines. +// go.processor.limit {thread} The number of OS threads that can execute user-level Go code simultaneously. +// go.config.gogc % Heap size target percentage configured by the user, otherwise 100. +// +// When the OTEL_GO_X_DEPRECATED_RUNTIME_METRICS environment variable is set to +// true, the following deprecated metrics are produced: +// // runtime.go.cgo.calls - Number of cgo calls made by the current process // runtime.go.gc.count - Number of completed garbage collection cycles // runtime.go.gc.pause_ns (ns) Amount of nanoseconds in GC stop-the-world pauses @@ -19,16 +31,4 @@ // runtime.go.mem.heap_sys (bytes) Bytes of heap memory obtained from the OS // runtime.go.mem.live_objects - Number of live objects is the number of cumulative Mallocs - Frees // runtime.uptime (ms) Milliseconds since application was initialized -// -// When the OTEL_GO_X_DEPRECATED_RUNTIME_METRICS environment variable is set to -// false, the metrics produced are: -// -// go.memory.used By Memory used by the Go runtime. -// go.memory.limit By Go runtime memory limit configured by the user, if a limit exists. -// go.memory.allocated By Memory allocated to the heap by the application. -// go.memory.allocations {allocation} Count of allocations to the heap by the application. -// go.memory.gc.goal By Heap size target for the end of the GC cycle. -// go.goroutine.count {goroutine} Count of live goroutines. -// go.processor.limit {thread} The number of OS threads that can execute user-level Go code simultaneously. -// go.config.gogc % Heap size target percentage configured by the user, otherwise 100. package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/README.md b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/README.md index a2367651a..00170e1a6 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/README.md +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/README.md @@ -13,22 +13,13 @@ change in backwards incompatible ways as feedback is applied. ### Include Deprecated Metrics -Once new experimental runtime metrics are added, they will be produced -**in addition to** the existing runtime metrics. Users that migrate right away -can disable the old runtime metrics: - -```console -export OTEL_GO_X_DEPRECATED_RUNTIME_METRICS=false -``` - -In a later release, the deprecated runtime metrics will stop being produced by -default. To temporarily re-enable the deprecated metrics: +To temporarily re-enable the deprecated metrics: ```console export OTEL_GO_X_DEPRECATED_RUNTIME_METRICS=true ``` -After two additional releases, the deprecated runtime metrics will be removed, +Eventually, the deprecated runtime metrics will be removed, and setting the environment variable will no longer have any effect. The value set must be the case-insensitive string of `"true"` to enable the diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/x.go b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/x.go index 7ffb473ad..95a05d599 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/x.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/internal/x/x.go @@ -9,17 +9,17 @@ package x // import "go.opentelemetry.io/contrib/instrumentation/runtime/interna import ( "os" - "strings" + "strconv" ) // DeprecatedRuntimeMetrics is an experimental feature flag that defines if the deprecated // runtime metrics should be produced. During development of the new // conventions, it is enabled by default. // -// To disable this feature set the OTEL_GO_X_DEPRECATED_RUNTIME_METRICS environment variable -// to the case-insensitive string value of "false" (i.e. "False" and "FALSE" +// To enable this feature set the OTEL_GO_X_DEPRECATED_RUNTIME_METRICS environment variable +// to the case-insensitive string value of "true" (i.e. "True" and "TRUE" // will also enable this). -var DeprecatedRuntimeMetrics = newFeature("DEPRECATED_RUNTIME_METRICS", true) +var DeprecatedRuntimeMetrics = newFeature("DEPRECATED_RUNTIME_METRICS", false) // BoolFeature is an experimental feature control flag. It provides a uniform way // to interact with these feature flags and parse their values. @@ -43,11 +43,11 @@ func (f BoolFeature) Key() string { return f.key } // Enabled returns if the feature is enabled. func (f BoolFeature) Enabled() bool { v := os.Getenv(f.key) - if strings.ToLower(v) == "false" { - return false - } - if strings.ToLower(v) == "true" { - return true + + val, err := strconv.ParseBool(v) + if err != nil { + return f.defaultVal } - return f.defaultVal + + return val } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/runtime.go b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/runtime.go index d0ffe2764..fec833b57 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/runtime.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/runtime.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/semconv/v1.34.0/goconv" "go.opentelemetry.io/contrib/instrumentation/runtime/internal/deprecatedruntime" "go.opentelemetry.io/contrib/instrumentation/runtime/internal/x" @@ -43,78 +44,48 @@ func Start(opts ...Option) error { metric.WithInstrumentationVersion(Version()), ) if x.DeprecatedRuntimeMetrics.Enabled() { - return deprecatedruntime.Start(meter, c.MinimumReadMemStatsInterval) + if err := deprecatedruntime.Start(meter, c.MinimumReadMemStatsInterval); err != nil { + return err + } } - memoryUsedInstrument, err := meter.Int64ObservableUpDownCounter( - "go.memory.used", - metric.WithUnit("By"), - metric.WithDescription("Memory used by the Go runtime."), - ) + memoryUsed, err := goconv.NewMemoryUsed(meter) if err != nil { return err } - memoryLimitInstrument, err := meter.Int64ObservableUpDownCounter( - "go.memory.limit", - metric.WithUnit("By"), - metric.WithDescription("Go runtime memory limit configured by the user, if a limit exists."), - ) + memoryLimit, err := goconv.NewMemoryLimit(meter) if err != nil { return err } - memoryAllocatedInstrument, err := meter.Int64ObservableCounter( - "go.memory.allocated", - metric.WithUnit("By"), - metric.WithDescription("Memory allocated to the heap by the application."), - ) + memoryAllocated, err := goconv.NewMemoryAllocated(meter) if err != nil { return err } - memoryAllocationsInstrument, err := meter.Int64ObservableCounter( - "go.memory.allocations", - metric.WithUnit("{allocation}"), - metric.WithDescription("Count of allocations to the heap by the application."), - ) + memoryAllocations, err := goconv.NewMemoryAllocations(meter) if err != nil { return err } - memoryGCGoalInstrument, err := meter.Int64ObservableUpDownCounter( - "go.memory.gc.goal", - metric.WithUnit("By"), - metric.WithDescription("Heap size target for the end of the GC cycle."), - ) + memoryGCGoal, err := goconv.NewMemoryGCGoal(meter) if err != nil { return err } - goroutineCountInstrument, err := meter.Int64ObservableUpDownCounter( - "go.goroutine.count", - metric.WithUnit("{goroutine}"), - metric.WithDescription("Count of live goroutines."), - ) + goroutineCount, err := goconv.NewGoroutineCount(meter) if err != nil { return err } - processorLimitInstrument, err := meter.Int64ObservableUpDownCounter( - "go.processor.limit", - metric.WithUnit("{thread}"), - metric.WithDescription("The number of OS threads that can execute user-level Go code simultaneously."), - ) + processorLimit, err := goconv.NewProcessorLimit(meter) if err != nil { return err } - gogcConfigInstrument, err := meter.Int64ObservableUpDownCounter( - "go.config.gogc", - metric.WithUnit("%"), - metric.WithDescription("Heap size target percentage configured by the user, otherwise 100."), - ) + configGogc, err := goconv.NewConfigGogc(meter) if err != nil { return err } otherMemoryOpt := metric.WithAttributeSet( - attribute.NewSet(attribute.String("go.memory.type", "other")), + attribute.NewSet(memoryUsed.AttrMemoryType(goconv.MemoryTypeOther)), ) stackMemoryOpt := metric.WithAttributeSet( - attribute.NewSet(attribute.String("go.memory.type", "stack")), + attribute.NewSet(memoryUsed.AttrMemoryType(goconv.MemoryTypeStack)), ) collector := newCollector(c.MinimumReadMemStatsInterval, runtimeMetrics) var lock sync.Mutex @@ -124,30 +95,30 @@ func Start(opts ...Option) error { defer lock.Unlock() collector.refresh() stackMemory := collector.getInt(goHeapMemory) - o.ObserveInt64(memoryUsedInstrument, stackMemory, stackMemoryOpt) + o.ObserveInt64(memoryUsed.Inst(), stackMemory, stackMemoryOpt) totalMemory := collector.getInt(goTotalMemory) - collector.getInt(goMemoryReleased) otherMemory := totalMemory - stackMemory - o.ObserveInt64(memoryUsedInstrument, otherMemory, otherMemoryOpt) + o.ObserveInt64(memoryUsed.Inst(), otherMemory, otherMemoryOpt) // Only observe the limit metric if a limit exists if limit := collector.getInt(goMemoryLimit); limit != math.MaxInt64 { - o.ObserveInt64(memoryLimitInstrument, limit) + o.ObserveInt64(memoryLimit.Inst(), limit) } - o.ObserveInt64(memoryAllocatedInstrument, collector.getInt(goMemoryAllocated)) - o.ObserveInt64(memoryAllocationsInstrument, collector.getInt(goMemoryAllocations)) - o.ObserveInt64(memoryGCGoalInstrument, collector.getInt(goMemoryGoal)) - o.ObserveInt64(goroutineCountInstrument, collector.getInt(goGoroutines)) - o.ObserveInt64(processorLimitInstrument, collector.getInt(goMaxProcs)) - o.ObserveInt64(gogcConfigInstrument, collector.getInt(goConfigGC)) + o.ObserveInt64(memoryAllocated.Inst(), collector.getInt(goMemoryAllocated)) + o.ObserveInt64(memoryAllocations.Inst(), collector.getInt(goMemoryAllocations)) + o.ObserveInt64(memoryGCGoal.Inst(), collector.getInt(goMemoryGoal)) + o.ObserveInt64(goroutineCount.Inst(), collector.getInt(goGoroutines)) + o.ObserveInt64(processorLimit.Inst(), collector.getInt(goMaxProcs)) + o.ObserveInt64(configGogc.Inst(), collector.getInt(goConfigGC)) return nil }, - memoryUsedInstrument, - memoryLimitInstrument, - memoryAllocatedInstrument, - memoryAllocationsInstrument, - memoryGCGoalInstrument, - goroutineCountInstrument, - processorLimitInstrument, - gogcConfigInstrument, + memoryUsed.Inst(), + memoryLimit.Inst(), + memoryAllocated.Inst(), + memoryAllocations.Inst(), + memoryGCGoal.Inst(), + goroutineCount.Inst(), + processorLimit.Inst(), + configGogc.Inst(), ) if err != nil { return err diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/version.go index 4161ec624..2d1da2549 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/runtime/version.go @@ -5,6 +5,6 @@ package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" // Version is the current release version of the runtime instrumentation. func Version() string { - return "0.61.0" + return "0.62.0" // This string is updated by the pre_release.sh script during release } |
