From 5ee3a977309e4755335b2952760302d7a602e231 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 09:10:25 +0200 Subject: [PATCH 01/16] fix(deps): update module github.com/aws/aws-sdk-go to v1.54.19 (#5909) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) | `v1.54.18` -> `v1.54.19` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.19?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.19?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.18/v1.54.19?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.18/v1.54.19?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
aws/aws-sdk-go (github.com/aws/aws-sdk-go) ### [`v1.54.19`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v15419-2024-07-12) [Compare Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.18...v1.54.19) \=== ##### Service Client Updates - `service/acm-pca`: Updates service API, documentation, waiters, and paginators - `service/arc-zonal-shift`: Updates service API and documentation - `service/autoscaling`: Adds new service - Add v2 smoke tests and smithy smokeTests trait for SDK testing. - `service/codebuild`: Adds new service - Add v2 smoke tests and smithy smokeTests trait for SDK testing. - `service/dynamodb`: Updates service API, documentation, waiters, paginators, and examples - Add v2 smoke tests and smithy smokeTests trait for SDK testing. - `service/globalaccelerator`: Updates service API - `service/pinpoint`: Updates service API and documentation - Add v2 smoke tests and smithy smokeTests trait for SDK testing. - `service/quicksight`: Updates service API and documentation - Vega ally control options and Support for Reviewed Answers in Topics - `service/rds`: Updates service API, documentation, waiters, paginators, and examples - Update path for CreateDBCluster resource identifier, and Add v2 smoke tests and smithy smokeTests trait for SDK testing. - `service/sns`: Adds new service - Add v2 smoke tests and smithy smokeTests trait for SDK testing.
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- detectors/aws/ec2/go.mod | 2 +- detectors/aws/ec2/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/detectors/aws/ec2/go.mod b/detectors/aws/ec2/go.mod index 62f98b59b8d..7ce24217885 100644 --- a/detectors/aws/ec2/go.mod +++ b/detectors/aws/ec2/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/contrib/detectors/aws/ec2 go 1.21 require ( - github.com/aws/aws-sdk-go v1.54.18 + github.com/aws/aws-sdk-go v1.54.19 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/sdk v1.28.0 diff --git a/detectors/aws/ec2/go.sum b/detectors/aws/ec2/go.sum index 787c7f3cdbe..64b14681ad9 100644 --- a/detectors/aws/ec2/go.sum +++ b/detectors/aws/ec2/go.sum @@ -1,5 +1,5 @@ -github.com/aws/aws-sdk-go v1.54.18 h1:t8DGtN8A2wEiazoJxeDbfPsbxCKtjoRLuO7jBSgJzo4= -github.com/aws/aws-sdk-go v1.54.18/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.19 h1:tyWV+07jagrNiCcGRzRhdtVjQs7Vy41NwsuOcl0IbVI= +github.com/aws/aws-sdk-go v1.54.19/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 3fea6fd9104c3bada7c3616f9b2ae48e07187726 Mon Sep 17 00:00:00 2001 From: Akhigbe Eromosele David Date: Mon, 15 Jul 2024 09:02:42 +0100 Subject: [PATCH 02/16] added codeowners for zerolog bridge (#5905) Added @dmathieu and @AkhigbeEromo as codeowners for the zerolog bridge part of #5405 --------- Co-authored-by: Tyler Yahn Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index 077f34e7d6c..d4abc2b9d36 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -29,6 +29,7 @@ bridges/otelslog @open-te bridges/otellogrus/ @open-telemetry/go-approvers @dmathieu @pellared bridges/prometheus/ @open-telemetry/go-approvers @dashpole bridges/otelzap/ @open-telemetry/go-approvers @pellared @khushijain21 +bridges/otelzerolog/ @open-telemetry/go-approvers @dmathieu @AkhigbeEromo config/ @open-telemetry/go-approvers @MadVikingGod @pellared @codeboten From b0e96a9b43859f30ac71f32b544e9ca79cb86bd5 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Mon, 15 Jul 2024 01:48:58 -0700 Subject: [PATCH 03/16] Protect released changelog in CI (#5906) Mirror of https://github.com/open-telemetry/opentelemetry-go/pull/5560. It also includes the fix from https://github.com/open-telemetry/opentelemetry-go/pull/5616 --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> --- .../workflows/protect-released-changelog.yml | 20 +++++++++ CHANGELOG.md | 5 +++ RELEASING.md | 3 ++ tools/verify_released_changelog.sh | 42 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 .github/workflows/protect-released-changelog.yml create mode 100755 tools/verify_released_changelog.sh diff --git a/.github/workflows/protect-released-changelog.yml b/.github/workflows/protect-released-changelog.yml new file mode 100644 index 00000000000..5634b78b813 --- /dev/null +++ b/.github/workflows/protect-released-changelog.yml @@ -0,0 +1,20 @@ +# This action against that any PR targeting the main branch touches released +# sections in CHANGELOG file. If change to released CHANGELOG is required, like +# doing a release, add the \"Unlock Released Changelog\" label to disable this action. + +name: Protect released changelog + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] +jobs: + protect-released-changelog: + runs-on: ubuntu-latest + if: ${{ !contains(github.event.pull_request.labels.*.name, 'Unlock Released Changelog')}} + + steps: + - uses: actions/checkout@v4 + + - name: Protect the released changelog + run: | + ./tools/verify_released_changelog.sh ${{ github.base_ref }} diff --git a/CHANGELOG.md b/CHANGELOG.md index f6ae2ffb08c..663e58642b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The deprecated `go.opentelemetry.io/contrib/processors/baggagecopy` package is removed. (#5853) + + + ## [1.28.0/0.53.0/0.22.0/0.8.0/0.3.0/0.1.0] - 2024-07-02 ### Added @@ -1132,6 +1135,8 @@ First official tagged release of `contrib` repository. [0.7.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.7.0 [0.6.1]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.6.1 + + [Go 1.22]: https://go.dev/doc/go1.22 [Go 1.21]: https://go.dev/doc/go1.21 [Go 1.20]: https://go.dev/doc/go1.20 diff --git a/RELEASING.md b/RELEASING.md index b2b5700a147..a345df17546 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -108,6 +108,9 @@ since the last release tag. git --no-pager log --pretty=oneline "..HEAD" ``` +Make sure the new released section is under the comment for released section, +like ``, so it is protected from being overwritten in the future. + Be sure to update all the appropriate links at the bottom of the file. Finally, commit this change to your release branch. diff --git a/tools/verify_released_changelog.sh b/tools/verify_released_changelog.sh new file mode 100755 index 00000000000..c9b7cdbbfef --- /dev/null +++ b/tools/verify_released_changelog.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -euo pipefail + +TARGET="${1:?Must provide target ref}" + +FILE="CHANGELOG.md" +TEMP_DIR=$(mktemp -d) +echo "Temp folder: $TEMP_DIR" + +# Only the latest commit of the feature branch is available +# automatically. To diff with the base branch, we need to +# fetch that too (and we only need its latest commit). +git fetch origin "${TARGET}" --depth=1 + +# Checkout the previous version on the base branch of the changelog to tmpfolder +git --work-tree="$TEMP_DIR" checkout FETCH_HEAD $FILE + +PREVIOUS_FILE="$TEMP_DIR/$FILE" +CURRENT_FILE="$FILE" +PREVIOUS_LOCKED_FILE="$TEMP_DIR/previous_locked_section.md" +CURRENT_LOCKED_FILE="$TEMP_DIR/current_locked_section.md" + +# Extract released sections from the previous version +awk '/^/ {flag=1} /^/ {flag=0} flag' "$PREVIOUS_FILE" > "$PREVIOUS_LOCKED_FILE" + +# Extract released sections from the current version +awk '/^/ {flag=1} /^/ {flag=0} flag' "$CURRENT_FILE" > "$CURRENT_LOCKED_FILE" + +# Compare the released sections +if ! diff -q "$PREVIOUS_LOCKED_FILE" "$CURRENT_LOCKED_FILE"; then + echo "Error: The released sections of the changelog file have been modified." + diff "$PREVIOUS_LOCKED_FILE" "$CURRENT_LOCKED_FILE" + rm -rf "$TEMP_DIR" + false +fi + +rm -rf "$TEMP_DIR" +echo "The released sections remain unchanged." From 62e857bff55472dc1da52887ce3fed4e3ffb9b55 Mon Sep 17 00:00:00 2001 From: Khushi Jain Date: Mon, 15 Jul 2024 14:32:32 +0530 Subject: [PATCH 04/16] otelzap: Add otelzap under experimental bridge (#5907) Completes #5191 Can we also request for a review from zap maintainers? --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 2 ++ versions.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 663e58642b7..4d22a22c1dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support for stdoutlog exporter in `go.opentelemetry.io/contrib/config`. (#5850) - Add macOS ARM64 platform to the compatibility testing suite. (#5868) +- The `go.opentelemetry.io/contrib/bridges/otelzap` module. + This module provides an OpenTelemetry logging bridge for `go.uber.org/zap`. (#5191) ### Removed diff --git a/versions.yaml b/versions.yaml index e24308efac4..a66ee6e247c 100644 --- a/versions.yaml +++ b/versions.yaml @@ -78,6 +78,7 @@ module-sets: modules: - go.opentelemetry.io/contrib/bridges/otelslog - go.opentelemetry.io/contrib/bridges/otellogrus + - go.opentelemetry.io/contrib/bridges/otelzap experimental-processors: version: v0.1.0 modules: @@ -89,7 +90,6 @@ module-sets: - go.opentelemetry.io/contrib/detectors/azure/azurevm excluded-modules: - go.opentelemetry.io/contrib/bridges/otelzerolog - - go.opentelemetry.io/contrib/bridges/otelzap - go.opentelemetry.io/contrib/instrgen - go.opentelemetry.io/contrib/instrgen/driver - go.opentelemetry.io/contrib/instrgen/testdata/interface From 879727b041e3c32c23c7a48acd56b9165655506b Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 15 Jul 2024 07:31:24 -0700 Subject: [PATCH 05/16] config: add support for with_resource_constant_labels option (#5890) This provides users the ability to apply labels for resource attributes to prometheus exported metrics. --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + config/metric.go | 19 ++++++++++++++++--- config/metric_test.go | 11 +++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d22a22c1dd..6554e8f74c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add macOS ARM64 platform to the compatibility testing suite. (#5868) - The `go.opentelemetry.io/contrib/bridges/otelzap` module. This module provides an OpenTelemetry logging bridge for `go.uber.org/zap`. (#5191) +- The `go.opentelemetry.io/contrib/config` package supports configuring `with_resource_constant_labels` for the prometheus exporter. (#5890) ### Removed diff --git a/config/metric.go b/config/metric.go index 72f21cf3850..6c6b34e9f59 100644 --- a/config/metric.go +++ b/config/metric.go @@ -230,6 +230,22 @@ func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmet if prometheusConfig.WithoutUnits != nil && *prometheusConfig.WithoutUnits { opts = append(opts, otelprom.WithoutUnits()) } + if prometheusConfig.WithResourceConstantLabels != nil { + if prometheusConfig.WithResourceConstantLabels.Included != nil { + var keys []attribute.Key + for _, val := range prometheusConfig.WithResourceConstantLabels.Included { + keys = append(keys, attribute.Key(val)) + } + otelprom.WithResourceAsConstantLabels(attribute.NewAllowKeysFilter(keys...)) + } + if prometheusConfig.WithResourceConstantLabels.Excluded != nil { + var keys []attribute.Key + for _, val := range prometheusConfig.WithResourceConstantLabels.Included { + keys = append(keys, attribute.Key(val)) + } + otelprom.WithResourceAsConstantLabels(attribute.NewDenyKeysFilter(keys...)) + } + } reg := prometheus.NewRegistry() opts = append(opts, otelprom.WithRegisterer(reg)) @@ -246,9 +262,6 @@ func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmet } addr := fmt.Sprintf("%s:%d", *prometheusConfig.Host, *prometheusConfig.Port) - // TODO: add support for constant label filter - // otelprom.WithResourceAsConstantLabels(attribute.NewDenyKeysFilter()), - // ) reader, err := otelprom.New(opts...) if err != nil { return nil, fmt.Errorf("error creating otel prometheus exporter: %w", err) diff --git a/config/metric_test.go b/config/metric_test.go index 83aa7a8beb0..34ead1fddb9 100644 --- a/config/metric_test.go +++ b/config/metric_test.go @@ -148,8 +148,15 @@ func TestReader(t *testing.T) { Pull: &PullMetricReader{ Exporter: MetricExporter{ Prometheus: &Prometheus{ - Host: ptr("localhost"), - Port: ptr(8888), + Host: ptr("localhost"), + Port: ptr(8888), + WithoutScopeInfo: ptr(true), + WithoutUnits: ptr(true), + WithoutTypeSuffix: ptr(true), + WithResourceConstantLabels: &IncludeExclude{ + Included: []string{"include"}, + Excluded: []string{"exclude"}, + }, }, }, }, From 7b8afe39618485fa60f15cdc113794013ba4b4ba Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Mon, 15 Jul 2024 12:51:58 -0400 Subject: [PATCH 06/16] Implement new runtime metrics (#5780) Part of https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5655 Changes: * Move the configuration options to `options.go` without modification. * Implements the metrics defined here: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/runtime/go-metrics.md. These are still disabled by default while it is under development. * Add unit tests Notes: It doesn't implement `go.schedule.duration`, as the histogram will need some additional work to figure out. Based on https://github.com/prometheus/client_golang/pull/955#issue-1090830520, using go's runtime metrics should is more efficient than reading memstats. --------- Co-authored-by: Sam Xie --- CHANGELOG.md | 1 + instrumentation/runtime/doc.go | 12 + instrumentation/runtime/options.go | 76 ++++++ instrumentation/runtime/options_test.go | 44 ++++ instrumentation/runtime/runtime.go | 252 ++++++++++++++----- instrumentation/runtime/runtime_test.go | 59 ++++- instrumentation/runtime/test/go.mod | 24 ++ instrumentation/runtime/test/go.sum | 29 +++ instrumentation/runtime/test/runtime_test.go | 157 ++++++++++++ 9 files changed, 580 insertions(+), 74 deletions(-) create mode 100644 instrumentation/runtime/options.go create mode 100644 instrumentation/runtime/options_test.go create mode 100644 instrumentation/runtime/test/go.mod create mode 100644 instrumentation/runtime/test/go.sum create mode 100644 instrumentation/runtime/test/runtime_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 6554e8f74c6..707abe4aece 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/contrib/bridges/otelzap` module. This module provides an OpenTelemetry logging bridge for `go.uber.org/zap`. (#5191) - The `go.opentelemetry.io/contrib/config` package supports configuring `with_resource_constant_labels` for the prometheus exporter. (#5890) +- Add new runtime metrics to `go.opentelemetry.io/contrib/instrumentation/runtime`, which are still disabled by default. (#5870) ### Removed diff --git a/instrumentation/runtime/doc.go b/instrumentation/runtime/doc.go index 5cbcf1e4589..2b5e78686d4 100644 --- a/instrumentation/runtime/doc.go +++ b/instrumentation/runtime/doc.go @@ -19,4 +19,16 @@ // 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/instrumentation/runtime/options.go b/instrumentation/runtime/options.go new file mode 100644 index 00000000000..30046ab3509 --- /dev/null +++ b/instrumentation/runtime/options.go @@ -0,0 +1,76 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" + +import ( + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" +) + +// config contains optional settings for reporting runtime metrics. +type config struct { + // MinimumReadMemStatsInterval sets the minimum interval + // between calls to runtime.ReadMemStats(). Negative values + // are ignored. + MinimumReadMemStatsInterval time.Duration + + // MeterProvider sets the metric.MeterProvider. If nil, the global + // Provider will be used. + MeterProvider metric.MeterProvider +} + +// Option supports configuring optional settings for runtime metrics. +type Option interface { + apply(*config) +} + +// DefaultMinimumReadMemStatsInterval is the default minimum interval +// between calls to runtime.ReadMemStats(). Use the +// WithMinimumReadMemStatsInterval() option to modify this setting in +// Start(). +const DefaultMinimumReadMemStatsInterval time.Duration = 15 * time.Second + +// WithMinimumReadMemStatsInterval sets a minimum interval between calls to +// runtime.ReadMemStats(), which is a relatively expensive call to make +// frequently. This setting is ignored when `d` is negative. +func WithMinimumReadMemStatsInterval(d time.Duration) Option { + return minimumReadMemStatsIntervalOption(d) +} + +type minimumReadMemStatsIntervalOption time.Duration + +func (o minimumReadMemStatsIntervalOption) apply(c *config) { + if o >= 0 { + c.MinimumReadMemStatsInterval = time.Duration(o) + } +} + +// WithMeterProvider sets the Metric implementation to use for +// reporting. If this option is not used, the global metric.MeterProvider +// will be used. `provider` must be non-nil. +func WithMeterProvider(provider metric.MeterProvider) Option { + return metricProviderOption{provider} +} + +type metricProviderOption struct{ metric.MeterProvider } + +func (o metricProviderOption) apply(c *config) { + if o.MeterProvider != nil { + c.MeterProvider = o.MeterProvider + } +} + +// newConfig computes a config from the supplied Options. +func newConfig(opts ...Option) config { + c := config{ + MeterProvider: otel.GetMeterProvider(), + MinimumReadMemStatsInterval: DefaultMinimumReadMemStatsInterval, + } + for _, opt := range opts { + opt.apply(&c) + } + return c +} diff --git a/instrumentation/runtime/options_test.go b/instrumentation/runtime/options_test.go new file mode 100644 index 00000000000..3c32a740938 --- /dev/null +++ b/instrumentation/runtime/options_test.go @@ -0,0 +1,44 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestNewConfig(t *testing.T) { + for _, tt := range []struct { + name string + opts []Option + expect config + }{ + { + name: "default", + expect: config{MinimumReadMemStatsInterval: 15 * time.Second}, + }, + { + name: "negative MinimumReadMemStatsInterval ignored", + opts: []Option{WithMinimumReadMemStatsInterval(-1 * time.Second)}, + expect: config{MinimumReadMemStatsInterval: 15 * time.Second}, + }, + { + name: "set MinimumReadMemStatsInterval", + opts: []Option{WithMinimumReadMemStatsInterval(10 * time.Second)}, + expect: config{MinimumReadMemStatsInterval: 10 * time.Second}, + }, + } { + t.Run(tt.name, func(t *testing.T) { + got := newConfig(tt.opts...) + assert.True(t, configEqual(got, tt.expect)) + }) + } +} + +func configEqual(a, b config) bool { + // ignore MeterProvider + return a.MinimumReadMemStatsInterval == b.MinimumReadMemStatsInterval +} diff --git a/instrumentation/runtime/runtime.go b/instrumentation/runtime/runtime.go index 3c520a49933..be7911bb450 100644 --- a/instrumentation/runtime/runtime.go +++ b/instrumentation/runtime/runtime.go @@ -4,9 +4,14 @@ package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" import ( + "context" + "math" + "runtime/metrics" + "sync" "time" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/contrib/instrumentation/runtime/internal/deprecatedruntime" @@ -16,70 +21,18 @@ import ( // ScopeName is the instrumentation scope name. const ScopeName = "go.opentelemetry.io/contrib/instrumentation/runtime" -// config contains optional settings for reporting runtime metrics. -type config struct { - // MinimumReadMemStatsInterval sets the minimum interval - // between calls to runtime.ReadMemStats(). Negative values - // are ignored. - MinimumReadMemStatsInterval time.Duration - - // MeterProvider sets the metric.MeterProvider. If nil, the global - // Provider will be used. - MeterProvider metric.MeterProvider -} - -// Option supports configuring optional settings for runtime metrics. -type Option interface { - apply(*config) -} - -// DefaultMinimumReadMemStatsInterval is the default minimum interval -// between calls to runtime.ReadMemStats(). Use the -// WithMinimumReadMemStatsInterval() option to modify this setting in -// Start(). -const DefaultMinimumReadMemStatsInterval time.Duration = 15 * time.Second - -// WithMinimumReadMemStatsInterval sets a minimum interval between calls to -// runtime.ReadMemStats(), which is a relatively expensive call to make -// frequently. This setting is ignored when `d` is negative. -func WithMinimumReadMemStatsInterval(d time.Duration) Option { - return minimumReadMemStatsIntervalOption(d) -} - -type minimumReadMemStatsIntervalOption time.Duration - -func (o minimumReadMemStatsIntervalOption) apply(c *config) { - if o >= 0 { - c.MinimumReadMemStatsInterval = time.Duration(o) - } -} - -// WithMeterProvider sets the Metric implementation to use for -// reporting. If this option is not used, the global metric.MeterProvider -// will be used. `provider` must be non-nil. -func WithMeterProvider(provider metric.MeterProvider) Option { - return metricProviderOption{provider} -} - -type metricProviderOption struct{ metric.MeterProvider } - -func (o metricProviderOption) apply(c *config) { - if o.MeterProvider != nil { - c.MeterProvider = o.MeterProvider - } -} - -// newConfig computes a config from the supplied Options. -func newConfig(opts ...Option) config { - c := config{ - MeterProvider: otel.GetMeterProvider(), - MinimumReadMemStatsInterval: DefaultMinimumReadMemStatsInterval, - } - for _, opt := range opts { - opt.apply(&c) - } - return c -} +const ( + goTotalMemory = "/memory/classes/total:bytes" + goMemoryReleased = "/memory/classes/heap/released:bytes" + goHeapMemory = "/memory/classes/heap/stacks:bytes" + goMemoryLimit = "/gc/gomemlimit:bytes" + goMemoryAllocated = "/gc/heap/allocs:bytes" + goMemoryAllocations = "/gc/heap/allocs:objects" + goMemoryGoal = "/gc/heap/goal:bytes" + goGoroutines = "/sched/goroutines:goroutines" + goMaxProcs = "/sched/gomaxprocs:threads" + goConfigGC = "/gc/gogc:percent" +) // Start initializes reporting of runtime metrics using the supplied config. func Start(opts ...Option) error { @@ -97,6 +50,175 @@ func Start(opts ...Option) error { if x.DeprecatedRuntimeMetrics.Enabled() { return deprecatedruntime.Start(meter, c.MinimumReadMemStatsInterval) } - // TODO (#5655) Implement new runtime conventions + memoryUsedInstrument, err := meter.Int64ObservableUpDownCounter( + "go.memory.used", + metric.WithUnit("By"), + metric.WithDescription("Memory used by the Go runtime."), + ) + 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."), + ) + 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."), + ) + 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."), + ) + 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."), + ) + if err != nil { + return err + } + goroutineCountInstrument, err := meter.Int64ObservableUpDownCounter( + "go.goroutine.count", + metric.WithUnit("{goroutine}"), + metric.WithDescription("Count of live goroutines."), + ) + 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."), + ) + 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."), + ) + if err != nil { + return err + } + + otherMemoryOpt := metric.WithAttributeSet( + attribute.NewSet(attribute.String("go.memory.type", "other")), + ) + stackMemoryOpt := metric.WithAttributeSet( + attribute.NewSet(attribute.String("go.memory.type", "stack")), + ) + collector := newCollector(c.MinimumReadMemStatsInterval) + var lock sync.Mutex + _, err = meter.RegisterCallback( + func(ctx context.Context, o metric.Observer) error { + lock.Lock() + defer lock.Unlock() + collector.refresh() + stackMemory := collector.get(goHeapMemory) + o.ObserveInt64(memoryUsedInstrument, stackMemory, stackMemoryOpt) + totalMemory := collector.get(goTotalMemory) - collector.get(goMemoryReleased) + otherMemory := totalMemory - stackMemory + o.ObserveInt64(memoryUsedInstrument, otherMemory, otherMemoryOpt) + // Only observe the limit metric if a limit exists + if limit := collector.get(goMemoryLimit); limit != math.MaxInt64 { + o.ObserveInt64(memoryLimitInstrument, limit) + } + o.ObserveInt64(memoryAllocatedInstrument, collector.get(goMemoryAllocated)) + o.ObserveInt64(memoryAllocationsInstrument, collector.get(goMemoryAllocations)) + o.ObserveInt64(memoryGCGoalInstrument, collector.get(goMemoryGoal)) + o.ObserveInt64(goroutineCountInstrument, collector.get(goGoroutines)) + o.ObserveInt64(processorLimitInstrument, collector.get(goMaxProcs)) + o.ObserveInt64(gogcConfigInstrument, collector.get(goConfigGC)) + return nil + }, + memoryUsedInstrument, + memoryLimitInstrument, + memoryAllocatedInstrument, + memoryAllocationsInstrument, + memoryGCGoalInstrument, + goroutineCountInstrument, + processorLimitInstrument, + gogcConfigInstrument, + ) + if err != nil { + return err + } + // TODO (#5655) support go.schedule.duration return nil } + +// These are the metrics we actually fetch from the go runtime. +var runtimeMetrics = []string{ + goTotalMemory, + goMemoryReleased, + goHeapMemory, + goMemoryLimit, + goMemoryAllocated, + goMemoryAllocations, + goMemoryGoal, + goGoroutines, + goMaxProcs, + goConfigGC, +} + +type goCollector struct { + // now is used to replace the implementation of time.Now for testing + now func() time.Time + // lastCollect tracks the last time metrics were refreshed + lastCollect time.Time + // minimumInterval is the minimum amount of time between calls to metrics.Read + minimumInterval time.Duration + // sampleBuffer is populated by runtime/metrics + sampleBuffer []metrics.Sample + // sampleMap allows us to easily get the value of a single metric + sampleMap map[string]*metrics.Sample +} + +func newCollector(minimumInterval time.Duration) *goCollector { + g := &goCollector{ + sampleBuffer: make([]metrics.Sample, 0, len(runtimeMetrics)), + sampleMap: make(map[string]*metrics.Sample, len(runtimeMetrics)), + minimumInterval: minimumInterval, + now: time.Now, + } + for _, runtimeMetric := range runtimeMetrics { + g.sampleBuffer = append(g.sampleBuffer, metrics.Sample{Name: runtimeMetric}) + // sampleMap references a position in the sampleBuffer slice. If an + // element is appended to sampleBuffer, it must be added to sampleMap + // for the sample to be accessible in sampleMap. + g.sampleMap[runtimeMetric] = &g.sampleBuffer[len(g.sampleBuffer)-1] + } + return g +} + +func (g *goCollector) refresh() { + now := g.now() + if now.Sub(g.lastCollect) < g.minimumInterval { + // refresh was invoked more frequently than allowed by the minimum + // interval. Do nothing. + return + } + metrics.Read(g.sampleBuffer) + g.lastCollect = now +} + +func (g *goCollector) get(name string) int64 { + if s, ok := g.sampleMap[name]; ok && s.Value.Kind() == metrics.KindUint64 { + return int64(s.Value.Uint64()) + } + return 0 +} diff --git a/instrumentation/runtime/runtime_test.go b/instrumentation/runtime/runtime_test.go index 78d89a3c391..8b27e347d27 100644 --- a/instrumentation/runtime/runtime_test.go +++ b/instrumentation/runtime/runtime_test.go @@ -1,12 +1,53 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package runtime_test - -// TODO(#2757): Add integration tests for the runtime instrumentation. These -// tests depend on -// https://github.com/open-telemetry/opentelemetry-go/issues/3031 being -// resolved. -// -// The added tests will depend on the metric SDK. Therefore, they should be -// added to a sub-directory called "test" instead of this file. +package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestRefreshGoCollector(t *testing.T) { + // buffer for allocating memory + var buffer [][]byte + collector := newCollector(10 * time.Second) + testClock := newClock() + collector.now = testClock.now + // before the first refresh, all counters are zero + assert.Zero(t, collector.get(goMemoryAllocations)) + // after the first refresh, counters are non-zero + buffer = allocateMemory(buffer) + collector.refresh() + initialAllocations := collector.get(goMemoryAllocations) + assert.NotZero(t, initialAllocations) + // if less than the refresh time has elapsed, the value is not updated + // on refresh. + testClock.increment(9 * time.Second) + collector.refresh() + buffer = allocateMemory(buffer) + assert.Equal(t, initialAllocations, collector.get(goMemoryAllocations)) + // if greater than the refresh time has elapsed, the value changes. + testClock.increment(2 * time.Second) + collector.refresh() + _ = allocateMemory(buffer) + assert.NotEqual(t, initialAllocations, collector.get(goMemoryAllocations)) +} + +func allocateMemory(buffer [][]byte) [][]byte { + return append(buffer, make([]byte, 1000000)) +} + +func newClock() *clock { + return &clock{current: time.Now()} +} + +type clock struct { + current time.Time +} + +func (c *clock) now() time.Time { return c.current } + +func (c *clock) increment(d time.Duration) { c.current = c.current.Add(d) } diff --git a/instrumentation/runtime/test/go.mod b/instrumentation/runtime/test/go.mod new file mode 100644 index 00000000000..2aea72ac452 --- /dev/null +++ b/instrumentation/runtime/test/go.mod @@ -0,0 +1,24 @@ +module go.opentelemetry.io/contrib/instrumentation/runtime/test + +go 1.21 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/contrib/instrumentation/runtime v0.52.0 + go.opentelemetry.io/otel v1.28.0 + go.opentelemetry.io/otel/sdk v1.27.0 + go.opentelemetry.io/otel/sdk/metric v1.27.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + golang.org/x/sys v0.20.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace go.opentelemetry.io/contrib/instrumentation/runtime => ../ diff --git a/instrumentation/runtime/test/go.sum b/instrumentation/runtime/test/go.sum new file mode 100644 index 00000000000..5fc6b9402cd --- /dev/null +++ b/instrumentation/runtime/test/go.sum @@ -0,0 +1,29 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= +go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= +go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= +go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/runtime/test/runtime_test.go b/instrumentation/runtime/test/runtime_test.go new file mode 100644 index 00000000000..936df2d54f5 --- /dev/null +++ b/instrumentation/runtime/test/runtime_test.go @@ -0,0 +1,157 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime/test" + +import ( + "context" + "fmt" + "math" + "runtime/debug" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/contrib/instrumentation/runtime" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +func TestRuntimeWithLimit(t *testing.T) { + // buffer for allocating memory + var buffer [][]byte + _ = allocateMemory(buffer) + t.Setenv("OTEL_GO_X_DEPRECATED_RUNTIME_METRICS", "false") + debug.SetMemoryLimit(1234567890) + // reset to default + defer debug.SetMemoryLimit(math.MaxInt64) + + reader := metric.NewManualReader() + mp := metric.NewMeterProvider(metric.WithReader(reader)) + err := runtime.Start(runtime.WithMeterProvider(mp)) + assert.NoError(t, err) + rm := metricdata.ResourceMetrics{} + err = reader.Collect(context.Background(), &rm) + assert.NoError(t, err) + require.Len(t, rm.ScopeMetrics, 1) + require.Len(t, rm.ScopeMetrics[0].Metrics, 8) + + expectedScopeMetric := metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{ + Name: "go.opentelemetry.io/contrib/instrumentation/runtime", + Version: runtime.Version(), + }, + Metrics: []metricdata.Metrics{ + { + Name: "go.memory.used", + Description: "Memory used by the Go runtime.", + Unit: "By", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("go.memory.type", "stack")), + }, + { + Attributes: attribute.NewSet(attribute.String("go.memory.type", "other")), + }, + }, + }, + }, + { + Name: "go.memory.limit", + Description: "Go runtime memory limit configured by the user, if a limit exists.", + Unit: "By", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + { + Name: "go.memory.allocated", + Description: "Memory allocated to the heap by the application.", + Unit: "By", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + { + Name: "go.memory.allocations", + Description: "Count of allocations to the heap by the application.", + Unit: "{allocation}", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + { + Name: "go.memory.gc.goal", + Description: "Heap size target for the end of the GC cycle.", + Unit: "By", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + { + Name: "go.goroutine.count", + Description: "Count of live goroutines.", + Unit: "{goroutine}", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + { + Name: "go.processor.limit", + Description: "The number of OS threads that can execute user-level Go code simultaneously.", + Unit: "{thread}", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + { + Name: "go.config.gogc", + Description: "Heap size target percentage configured by the user, otherwise 100.", + Unit: "%", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{{}}, + }, + }, + }, + } + metricdatatest.AssertEqual(t, expectedScopeMetric, rm.ScopeMetrics[0], metricdatatest.IgnoreTimestamp(), metricdatatest.IgnoreValue()) + assertNonZeroValues(t, rm.ScopeMetrics[0]) +} + +func assertNonZeroValues(t *testing.T, sm metricdata.ScopeMetrics) { + for _, m := range sm.Metrics { + switch a := m.Data.(type) { + case metricdata.Sum[int64]: + for _, dp := range a.DataPoints { + assert.True(t, dp.Value > 0, fmt.Sprintf("Metric %q should have a non-zero value for point with attributes %+v", m.Name, dp.Attributes)) + } + default: + t.Fatalf("unexpected data type %v", a) + } + } +} + +func allocateMemory(buffer [][]byte) [][]byte { + return append(buffer, make([]byte, 1000000)) +} From d9af7e0bc726cb81c02c71bc8ffed369d8b996c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:22:38 -0700 Subject: [PATCH 07/16] fix(deps): update module go.opentelemetry.io/contrib/instrumentation/runtime to v0.53.0 (#5912) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [go.opentelemetry.io/contrib/instrumentation/runtime](https://togithub.com/open-telemetry/opentelemetry-go-contrib) | `v0.52.0` -> `v0.53.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fcontrib%2finstrumentation%2fruntime/v0.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/go.opentelemetry.io%2fcontrib%2finstrumentation%2fruntime/v0.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/go.opentelemetry.io%2fcontrib%2finstrumentation%2fruntime/v0.52.0/v0.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fcontrib%2finstrumentation%2fruntime/v0.52.0/v0.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- instrumentation/runtime/test/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/runtime/test/go.mod b/instrumentation/runtime/test/go.mod index 2aea72ac452..37c620306cd 100644 --- a/instrumentation/runtime/test/go.mod +++ b/instrumentation/runtime/test/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/contrib/instrumentation/runtime v0.52.0 + go.opentelemetry.io/contrib/instrumentation/runtime v0.53.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/sdk v1.27.0 go.opentelemetry.io/otel/sdk/metric v1.27.0 From 1a6d10e4c0beb8f8c8e118c8c600c0df4d0134fc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:09:02 -0700 Subject: [PATCH 08/16] chore(deps): update module golang.org/x/sys to v0.22.0 (#5911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | golang.org/x/sys | `v0.20.0` -> `v0.22.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.20.0/v0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.20.0/v0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- instrumentation/runtime/test/go.mod | 2 +- instrumentation/runtime/test/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/instrumentation/runtime/test/go.mod b/instrumentation/runtime/test/go.mod index 37c620306cd..e5e1c4971c8 100644 --- a/instrumentation/runtime/test/go.mod +++ b/instrumentation/runtime/test/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.22.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/instrumentation/runtime/test/go.sum b/instrumentation/runtime/test/go.sum index 5fc6b9402cd..50769cf3b11 100644 --- a/instrumentation/runtime/test/go.sum +++ b/instrumentation/runtime/test/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2N go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From e11fd0733809e578cc9cbf9fea4a25d85b5bff77 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:33:29 -0700 Subject: [PATCH 09/16] fix(deps): update opentelemetry-go monorepo to v1.28.0 (#5913) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [go.opentelemetry.io/otel/sdk](https://togithub.com/open-telemetry/opentelemetry-go) | `v1.27.0` -> `v1.28.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fotel%2fsdk/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/go.opentelemetry.io%2fotel%2fsdk/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/go.opentelemetry.io%2fotel%2fsdk/v1.27.0/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fotel%2fsdk/v1.27.0/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [go.opentelemetry.io/otel/sdk/metric](https://togithub.com/open-telemetry/opentelemetry-go) | `v1.27.0` -> `v1.28.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fotel%2fsdk%2fmetric/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/go.opentelemetry.io%2fotel%2fsdk%2fmetric/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/go.opentelemetry.io%2fotel%2fsdk%2fmetric/v1.27.0/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fotel%2fsdk%2fmetric/v1.27.0/v1.28.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
open-telemetry/opentelemetry-go (go.opentelemetry.io/otel/sdk) ### [`v1.28.0`](https://togithub.com/open-telemetry/opentelemetry-go/releases/tag/v1.28.0): Releases v1.28.0/v0.50.0/v0.4.0 [Compare Source](https://togithub.com/open-telemetry/opentelemetry-go/compare/v1.27.0...v1.28.0) #### Overview ##### Added - The `IsEmpty` method is added to the `Instrument` type in `go.opentelemetry.io/otel/sdk/metric`. This method is used to check if an `Instrument` instance is a zero-value. ([#​5431](https://togithub.com/open-telemetry/opentelemetry-go/issues/5431)) - Store and provide the emitted `context.Context` in `ScopeRecords` of `go.opentelemetry.io/otel/sdk/log/logtest`. ([#​5468](https://togithub.com/open-telemetry/opentelemetry-go/issues/5468)) - The `go.opentelemetry.io/otel/semconv/v1.26.0` package. The package contains semantic conventions from the `v1.26.0` version of the OpenTelemetry Semantic Conventions. ([#​5476](https://togithub.com/open-telemetry/opentelemetry-go/issues/5476)) - The `AssertRecordEqual` method to `go.opentelemetry.io/otel/log/logtest` to allow comparison of two log records in tests. ([#​5499](https://togithub.com/open-telemetry/opentelemetry-go/issues/5499)) - The `WithHeaders` option to `go.opentelemetry.io/otel/exporters/zipkin` to allow configuring custom http headers while exporting spans. ([#​5530](https://togithub.com/open-telemetry/opentelemetry-go/issues/5530)) ##### Changed - `Tracer.Start` in `go.opentelemetry.io/otel/trace/noop` no longer allocates a span for empty span context. ([#​5457](https://togithub.com/open-telemetry/opentelemetry-go/issues/5457)) - Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/otel-collector`. ([#​5490](https://togithub.com/open-telemetry/opentelemetry-go/issues/5490)) - Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/zipkin`. ([#​5490](https://togithub.com/open-telemetry/opentelemetry-go/issues/5490)) - Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/exporters/zipkin`. ([#​5490](https://togithub.com/open-telemetry/opentelemetry-go/issues/5490)) - The exporter no longer exports the deprecated "otel.library.name" or "otel.library.version" attributes. - Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/resource`. ([#​5490](https://togithub.com/open-telemetry/opentelemetry-go/issues/5490)) - Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/trace`. ([#​5490](https://togithub.com/open-telemetry/opentelemetry-go/issues/5490)) - `SimpleProcessor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` no longer allocates a slice which makes it possible to have a zero-allocation log processing using `SimpleProcessor`. ([#​5493](https://togithub.com/open-telemetry/opentelemetry-go/issues/5493)) - Use non-generic functions in the `Start` method of `"go.opentelemetry.io/otel/sdk/trace".Trace` to reduce memory allocation. ([#​5497](https://togithub.com/open-telemetry/opentelemetry-go/issues/5497)) - `service.instance.id` is populated for a `Resource` created with `"go.opentelemetry.io/otel/sdk/resource".Default` with a default value when `OTEL_GO_X_RESOURCE` is set. ([#​5520](https://togithub.com/open-telemetry/opentelemetry-go/issues/5520)) - Improve performance of metric instruments in `go.opentelemetry.io/otel/sdk/metric` by removing unnecessary calls to `time.Now`. ([#​5545](https://togithub.com/open-telemetry/opentelemetry-go/issues/5545)) ##### Fixed - Log a warning to the OpenTelemetry internal logger when a `Record` in `go.opentelemetry.io/otel/sdk/log` drops an attribute due to a limit being reached. ([#​5376](https://togithub.com/open-telemetry/opentelemetry-go/issues/5376)) - Identify the `Tracer` returned from the global `TracerProvider` in `go.opentelemetry.io/otel/global` with its schema URL. ([#​5426](https://togithub.com/open-telemetry/opentelemetry-go/issues/5426)) - Identify the `Meter` returned from the global `MeterProvider` in `go.opentelemetry.io/otel/global` with its schema URL. ([#​5426](https://togithub.com/open-telemetry/opentelemetry-go/issues/5426)) - Log a warning to the OpenTelemetry internal logger when a `Span` in `go.opentelemetry.io/otel/sdk/trace` drops an attribute, event, or link due to a limit being reached. ([#​5434](https://togithub.com/open-telemetry/opentelemetry-go/issues/5434)) - Document instrument name requirements in `go.opentelemetry.io/otel/metric`. ([#​5435](https://togithub.com/open-telemetry/opentelemetry-go/issues/5435)) - Prevent random number generation data-race for experimental rand exemplars in `go.opentelemetry.io/otel/sdk/metric`. ([#​5456](https://togithub.com/open-telemetry/opentelemetry-go/issues/5456)) - Fix counting number of dropped attributes of `Record` in `go.opentelemetry.io/otel/sdk/log`. ([#​5464](https://togithub.com/open-telemetry/opentelemetry-go/issues/5464)) - Fix panic in baggage creation when a member contains `0x80` char in key or value. ([#​5494](https://togithub.com/open-telemetry/opentelemetry-go/issues/5494)) - Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. ([#​5508](https://togithub.com/open-telemetry/opentelemetry-go/issues/5508)) - Retry trace and span ID generation if it generated an invalid one in `go.opentelemetry.io/otel/sdk/trace`. ([#​5514](https://togithub.com/open-telemetry/opentelemetry-go/issues/5514)) - Fix stale timestamps reported by the last-value aggregation. ([#​5517](https://togithub.com/open-telemetry/opentelemetry-go/issues/5517)) - Indicate the `Exporter` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` must be created by the `New` method. ([#​5521](https://togithub.com/open-telemetry/opentelemetry-go/issues/5521)) - Improved performance in all `{Bool,Int64,Float64,String}SliceValue` functions of `go.opentelemetry.io/attributes` by reducing the number of allocations. ([#​5549](https://togithub.com/open-telemetry/opentelemetry-go/issues/5549)) #### What's Changed - Recheck log message in TestBatchProcessor by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5386](https://togithub.com/open-telemetry/opentelemetry-go/pull/5386) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`dc85e6b`](https://togithub.com/open-telemetry/opentelemetry-go/commit/dc85e6b) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5391](https://togithub.com/open-telemetry/opentelemetry-go/pull/5391) - fix(deps): update module go.opentelemetry.io/contrib/bridges/otelslog to v0.2.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5395](https://togithub.com/open-telemetry/opentelemetry-go/pull/5395) - fix(deps): update module github.com/go-logr/logr to v1.4.2 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5393](https://togithub.com/open-telemetry/opentelemetry-go/pull/5393) - fix(deps): update module go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp to v0.52.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5396](https://togithub.com/open-telemetry/opentelemetry-go/pull/5396) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`d264139`](https://togithub.com/open-telemetry/opentelemetry-go/commit/d264139) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5397](https://togithub.com/open-telemetry/opentelemetry-go/pull/5397) - fix(deps): update module go.opentelemetry.io/otel/sdk/log to v0.3.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5398](https://togithub.com/open-telemetry/opentelemetry-go/pull/5398) - chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.101.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5400](https://togithub.com/open-telemetry/opentelemetry-go/pull/5400) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`d264139`](https://togithub.com/open-telemetry/opentelemetry-go/commit/d264139) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5399](https://togithub.com/open-telemetry/opentelemetry-go/pull/5399) - \[chore] example/otel-collector: Fix README title by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5404](https://togithub.com/open-telemetry/opentelemetry-go/pull/5404) - Pool `otlploghttp` transform maps by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5378](https://togithub.com/open-telemetry/opentelemetry-go/pull/5378) - fix(deps): update module golang.org/x/vuln to v1.1.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5405](https://togithub.com/open-telemetry/opentelemetry-go/pull/5405) - Fix test name in otlploghttp by [@​XSAM](https://togithub.com/XSAM) in [https://github.com/open-telemetry/opentelemetry-go/pull/5411](https://togithub.com/open-telemetry/opentelemetry-go/pull/5411) - sdk/log: Fix BenchmarkLoggerNewRecord to not drop attributes by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5407](https://togithub.com/open-telemetry/opentelemetry-go/pull/5407) - chore(deps): update dependency codespell to v2.3.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5409](https://togithub.com/open-telemetry/opentelemetry-go/pull/5409) - fix(deps): update module github.com/golangci/golangci-lint to v1.59.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5419](https://togithub.com/open-telemetry/opentelemetry-go/pull/5419) - fix(deps): update golang.org/x/tools digest to [`7045d2e`](https://togithub.com/open-telemetry/opentelemetry-go/commit/7045d2e) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5406](https://togithub.com/open-telemetry/opentelemetry-go/pull/5406) - fix(deps): update golang.org/x/exp digest to [`4c93da0`](https://togithub.com/open-telemetry/opentelemetry-go/commit/4c93da0) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5415](https://togithub.com/open-telemetry/opentelemetry-go/pull/5415) - Log a warning when log Record attribute is dropped by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5376](https://togithub.com/open-telemetry/opentelemetry-go/pull/5376) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`a332354`](https://togithub.com/open-telemetry/opentelemetry-go/commit/a332354) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5424](https://togithub.com/open-telemetry/opentelemetry-go/pull/5424) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`a332354`](https://togithub.com/open-telemetry/opentelemetry-go/commit/a332354) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5423](https://togithub.com/open-telemetry/opentelemetry-go/pull/5423) - fix(deps): update golang.org/x/tools digest to [`f10a0f1`](https://togithub.com/open-telemetry/opentelemetry-go/commit/f10a0f1) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5430](https://togithub.com/open-telemetry/opentelemetry-go/pull/5430) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`5315273`](https://togithub.com/open-telemetry/opentelemetry-go/commit/5315273) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5428](https://togithub.com/open-telemetry/opentelemetry-go/pull/5428) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`5315273`](https://togithub.com/open-telemetry/opentelemetry-go/commit/5315273) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5427](https://togithub.com/open-telemetry/opentelemetry-go/pull/5427) - fix(deps): update golang.org/x/tools digest to [`e229045`](https://togithub.com/open-telemetry/opentelemetry-go/commit/e229045) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5432](https://togithub.com/open-telemetry/opentelemetry-go/pull/5432) - fix(deps): update golang.org/x/exp digest to [`23cca88`](https://togithub.com/open-telemetry/opentelemetry-go/commit/23cca88) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5429](https://togithub.com/open-telemetry/opentelemetry-go/pull/5429) - sdk/log: Fix TestBatchProcessor/DroppedLogs flaky test by [@​amanakin](https://togithub.com/amanakin) in [https://github.com/open-telemetry/opentelemetry-go/pull/5421](https://togithub.com/open-telemetry/opentelemetry-go/pull/5421) - Identify global `Tracer`s and `Meter`s with their schema URLs by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5426](https://togithub.com/open-telemetry/opentelemetry-go/pull/5426) - sdk/log: Fix TestBatchProcessor/ForceFlush/ErrorPartialFlush flaky test by [@​amanakin](https://togithub.com/amanakin) in [https://github.com/open-telemetry/opentelemetry-go/pull/5416](https://togithub.com/open-telemetry/opentelemetry-go/pull/5416) - Export the Instrument IsEmpty method by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5431](https://togithub.com/open-telemetry/opentelemetry-go/pull/5431) - fix(deps): update golang.org/x/tools digest to [`01018ba`](https://togithub.com/open-telemetry/opentelemetry-go/commit/01018ba) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5438](https://togithub.com/open-telemetry/opentelemetry-go/pull/5438) - \[chore] ensure codecov uses token by [@​codeboten](https://togithub.com/codeboten) in [https://github.com/open-telemetry/opentelemetry-go/pull/5440](https://togithub.com/open-telemetry/opentelemetry-go/pull/5440) - fix(deps): update golang.org/x/tools digest to [`8d54ca1`](https://togithub.com/open-telemetry/opentelemetry-go/commit/8d54ca1) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5441](https://togithub.com/open-telemetry/opentelemetry-go/pull/5441) - fix(deps): update golang.org/x/tools digest to [`2e977dd`](https://togithub.com/open-telemetry/opentelemetry-go/commit/2e977dd) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5442](https://togithub.com/open-telemetry/opentelemetry-go/pull/5442) - Remove zeroInstrumentKind by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5433](https://togithub.com/open-telemetry/opentelemetry-go/pull/5433) - Log warning when a trace attribute/event/link is discarded due to limits by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5434](https://togithub.com/open-telemetry/opentelemetry-go/pull/5434) - Remove opentelemetry-proto in .gitsubmodule by [@​YHM404](https://togithub.com/YHM404) in [https://github.com/open-telemetry/opentelemetry-go/pull/5267](https://togithub.com/open-telemetry/opentelemetry-go/pull/5267) - Document instrument name requirements by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5435](https://togithub.com/open-telemetry/opentelemetry-go/pull/5435) - fix(deps): update golang.org/x/exp digest to [`404ba88`](https://togithub.com/open-telemetry/opentelemetry-go/commit/404ba88) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5445](https://togithub.com/open-telemetry/opentelemetry-go/pull/5445) - Move `MonotonicEndTime` to only use by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5443](https://togithub.com/open-telemetry/opentelemetry-go/pull/5443) - fix(deps): update golang.org/x/tools digest to [`624dbd0`](https://togithub.com/open-telemetry/opentelemetry-go/commit/624dbd0) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5446](https://togithub.com/open-telemetry/opentelemetry-go/pull/5446) - fix(deps): update golang.org/x/exp digest to [`fd00a4e`](https://togithub.com/open-telemetry/opentelemetry-go/commit/fd00a4e) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5450](https://togithub.com/open-telemetry/opentelemetry-go/pull/5450) - fix(deps): update golang.org/x/tools digest to [`2f8e378`](https://togithub.com/open-telemetry/opentelemetry-go/commit/2f8e378) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5451](https://togithub.com/open-telemetry/opentelemetry-go/pull/5451) - fix(deps): update golang.org/x/tools digest to [`cc29c91`](https://togithub.com/open-telemetry/opentelemetry-go/commit/cc29c91) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5452](https://togithub.com/open-telemetry/opentelemetry-go/pull/5452) - chore(deps): update module github.com/prometheus/procfs to v0.15.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5453](https://togithub.com/open-telemetry/opentelemetry-go/pull/5453) - sdk/log: Add processor benchmarks by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5448](https://togithub.com/open-telemetry/opentelemetry-go/pull/5448) - fix(deps): update module github.com/itchyny/gojq to v0.12.16 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5460](https://togithub.com/open-telemetry/opentelemetry-go/pull/5460) - Guard rng in exemplar rand computation by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5456](https://togithub.com/open-telemetry/opentelemetry-go/pull/5456) - chore(deps): update module github.com/prometheus/common to v0.54.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5472](https://togithub.com/open-telemetry/opentelemetry-go/pull/5472) - add `log` package to depguard linter by [@​amanakin](https://togithub.com/amanakin) in [https://github.com/open-telemetry/opentelemetry-go/pull/5463](https://togithub.com/open-telemetry/opentelemetry-go/pull/5463) - fix(deps): update golang.org/x/tools digest to [`58cc8a4`](https://togithub.com/open-telemetry/opentelemetry-go/commit/58cc8a4) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5473](https://togithub.com/open-telemetry/opentelemetry-go/pull/5473) - fix(deps): update golang.org/x/tools digest to [`4478db0`](https://togithub.com/open-telemetry/opentelemetry-go/commit/4478db0) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5474](https://togithub.com/open-telemetry/opentelemetry-go/pull/5474) - sdk/log: Fix counting number of dropped attributes of log `Record` by [@​amanakin](https://togithub.com/amanakin) in [https://github.com/open-telemetry/opentelemetry-go/pull/5464](https://togithub.com/open-telemetry/opentelemetry-go/pull/5464) - fix(deps): update golang.org/x/tools digest to [`2088083`](https://togithub.com/open-telemetry/opentelemetry-go/commit/2088083) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5477](https://togithub.com/open-telemetry/opentelemetry-go/pull/5477) - trace: Span in noop.Start is no longer allocated by [@​tttoad](https://togithub.com/tttoad) in [https://github.com/open-telemetry/opentelemetry-go/pull/5457](https://togithub.com/open-telemetry/opentelemetry-go/pull/5457) - chore(deps): update module golang.org/x/sys to v0.21.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5481](https://togithub.com/open-telemetry/opentelemetry-go/pull/5481) - fix(deps): update module golang.org/x/tools to v0.22.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5485](https://togithub.com/open-telemetry/opentelemetry-go/pull/5485) - Bump min Go version used in CI by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5489](https://togithub.com/open-telemetry/opentelemetry-go/pull/5489) - chore(deps): update module golang.org/x/text to v0.16.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5482](https://togithub.com/open-telemetry/opentelemetry-go/pull/5482) - Add `semconv/v1.26.0`, removes deprecated semconvs by [@​MadVikingGod](https://togithub.com/MadVikingGod) in [https://github.com/open-telemetry/opentelemetry-go/pull/5476](https://togithub.com/open-telemetry/opentelemetry-go/pull/5476) - Add the sdk/internal/x package by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5444](https://togithub.com/open-telemetry/opentelemetry-go/pull/5444) - chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.102.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5479](https://togithub.com/open-telemetry/opentelemetry-go/pull/5479) - chore(deps): update module golang.org/x/net to v0.26.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5484](https://togithub.com/open-telemetry/opentelemetry-go/pull/5484) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`ef581f9`](https://togithub.com/open-telemetry/opentelemetry-go/commit/ef581f9) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5486](https://togithub.com/open-telemetry/opentelemetry-go/pull/5486) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`ef581f9`](https://togithub.com/open-telemetry/opentelemetry-go/commit/ef581f9) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5487](https://togithub.com/open-telemetry/opentelemetry-go/pull/5487) - fix(deps): update golang.org/x/exp digest to [`fc45aab`](https://togithub.com/open-telemetry/opentelemetry-go/commit/fc45aab) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5488](https://togithub.com/open-telemetry/opentelemetry-go/pull/5488) - log/logtest: provide record with their context by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5468](https://togithub.com/open-telemetry/opentelemetry-go/pull/5468) - Upgrade semconv use to v1.26.0 by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5490](https://togithub.com/open-telemetry/opentelemetry-go/pull/5490) - sdk/log: Remove slice allocation from SimpleProcessor.OnEmit by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5493](https://togithub.com/open-telemetry/opentelemetry-go/pull/5493) - fix(deps): update module golang.org/x/vuln to v1.1.2 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5496](https://togithub.com/open-telemetry/opentelemetry-go/pull/5496) - fix(deps): update module github.com/golangci/golangci-lint to v1.59.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5498](https://togithub.com/open-telemetry/opentelemetry-go/pull/5498) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`a8a6208`](https://togithub.com/open-telemetry/opentelemetry-go/commit/a8a6208) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5501](https://togithub.com/open-telemetry/opentelemetry-go/pull/5501) - Introduce logtest.AssertRecordEqual by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5499](https://togithub.com/open-telemetry/opentelemetry-go/pull/5499) - Add implementation of otlploggrpc configuration by [@​XSAM](https://togithub.com/XSAM) in [https://github.com/open-telemetry/opentelemetry-go/pull/5383](https://togithub.com/open-telemetry/opentelemetry-go/pull/5383) - fix(deps): update golang.org/x/exp digest to [`7f521ea`](https://togithub.com/open-telemetry/opentelemetry-go/commit/7f521ea) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5512](https://togithub.com/open-telemetry/opentelemetry-go/pull/5512) - Move evantorrie to emeritus status by [@​evantorrie](https://togithub.com/evantorrie) in [https://github.com/open-telemetry/opentelemetry-go/pull/5507](https://togithub.com/open-telemetry/opentelemetry-go/pull/5507) - Add missing word in WithView() doc string by [@​juliusv](https://togithub.com/juliusv) in [https://github.com/open-telemetry/opentelemetry-go/pull/5506](https://togithub.com/open-telemetry/opentelemetry-go/pull/5506) - chore(deps): update codecov/codecov-action action to v4.5.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5509](https://togithub.com/open-telemetry/opentelemetry-go/pull/5509) - chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.102.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5491](https://togithub.com/open-telemetry/opentelemetry-go/pull/5491) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`a8a6208`](https://togithub.com/open-telemetry/opentelemetry-go/commit/a8a6208) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5502](https://togithub.com/open-telemetry/opentelemetry-go/pull/5502) - fix(deps): update module google.golang.org/protobuf to v1.34.2 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5503](https://togithub.com/open-telemetry/opentelemetry-go/pull/5503) - trace: Use non-generic to replace newEvictedQueue in trace.start to reduce memory usage. by [@​tttoad](https://togithub.com/tttoad) in [https://github.com/open-telemetry/opentelemetry-go/pull/5497](https://togithub.com/open-telemetry/opentelemetry-go/pull/5497) - chore(deps): update jaegertracing/all-in-one docker tag to v1.58 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5504](https://togithub.com/open-telemetry/opentelemetry-go/pull/5504) - fix(deps): update module go.opentelemetry.io/proto/otlp to v1.3.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5505](https://togithub.com/open-telemetry/opentelemetry-go/pull/5505) - fix(baggage): validate chars panic with 0x80 by [@​fabiobozzo](https://togithub.com/fabiobozzo) in [https://github.com/open-telemetry/opentelemetry-go/pull/5494](https://togithub.com/open-telemetry/opentelemetry-go/pull/5494) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`68d350f`](https://togithub.com/open-telemetry/opentelemetry-go/commit/68d350f) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5516](https://togithub.com/open-telemetry/opentelemetry-go/pull/5516) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`68d350f`](https://togithub.com/open-telemetry/opentelemetry-go/commit/68d350f) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5515](https://togithub.com/open-telemetry/opentelemetry-go/pull/5515) - Correct the comment for the priority of options and environments on otlptracegrpc by [@​XSAM](https://togithub.com/XSAM) in [https://github.com/open-telemetry/opentelemetry-go/pull/5508](https://togithub.com/open-telemetry/opentelemetry-go/pull/5508) - Fix IDGenerator may generate zero TraceId / SpanId by [@​Charlie-lizhihan](https://togithub.com/Charlie-lizhihan) in [https://github.com/open-telemetry/opentelemetry-go/pull/5514](https://togithub.com/open-telemetry/opentelemetry-go/pull/5514) - Fix timestamp handling for the lastvalue aggregation by [@​dashpole](https://togithub.com/dashpole) in [https://github.com/open-telemetry/opentelemetry-go/pull/5517](https://togithub.com/open-telemetry/opentelemetry-go/pull/5517) - Add tenv linter by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5524](https://togithub.com/open-telemetry/opentelemetry-go/pull/5524) - chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.103.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5526](https://togithub.com/open-telemetry/opentelemetry-go/pull/5526) - chore(deps): update prom/prometheus docker tag to v2.53.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5525](https://togithub.com/open-telemetry/opentelemetry-go/pull/5525) - Do not fail CI on codecov create report by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5532](https://togithub.com/open-telemetry/opentelemetry-go/pull/5532) - Add unconvert linter by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5529](https://togithub.com/open-telemetry/opentelemetry-go/pull/5529) - Add unparam linter by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5531](https://togithub.com/open-telemetry/opentelemetry-go/pull/5531) - Add example for synchronous gauge by [@​bagmeg](https://togithub.com/bagmeg) in [https://github.com/open-telemetry/opentelemetry-go/pull/5492](https://togithub.com/open-telemetry/opentelemetry-go/pull/5492) - Add `newClient` method for otlploggrpc gRPC client by [@​XSAM](https://togithub.com/XSAM) in [https://github.com/open-telemetry/opentelemetry-go/pull/5523](https://togithub.com/open-telemetry/opentelemetry-go/pull/5523) - Verify versions.yaml is up to date in CI by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5533](https://togithub.com/open-telemetry/opentelemetry-go/pull/5533) - Populate `service.instance.id` with a default value when `OTEL_GO_X_RESOURCE` is set by [@​pyohannes](https://togithub.com/pyohannes) in [https://github.com/open-telemetry/opentelemetry-go/pull/5520](https://togithub.com/open-telemetry/opentelemetry-go/pull/5520) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`dc46fd2`](https://togithub.com/open-telemetry/opentelemetry-go/commit/dc46fd2) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5538](https://togithub.com/open-telemetry/opentelemetry-go/pull/5538) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`dc46fd2`](https://togithub.com/open-telemetry/opentelemetry-go/commit/dc46fd2) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5539](https://togithub.com/open-telemetry/opentelemetry-go/pull/5539) - chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.103.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5540](https://togithub.com/open-telemetry/opentelemetry-go/pull/5540) - Decouple codecov upload from coverage testing by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5534](https://togithub.com/open-telemetry/opentelemetry-go/pull/5534) - Add errorlint linter by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5535](https://togithub.com/open-telemetry/opentelemetry-go/pull/5535) - Add WithHeaders option for Zipkin exporter by [@​srijan-27](https://togithub.com/srijan-27) in [https://github.com/open-telemetry/opentelemetry-go/pull/5530](https://togithub.com/open-telemetry/opentelemetry-go/pull/5530) - chore(deps): update module github.com/prometheus/common to v0.55.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5552](https://togithub.com/open-telemetry/opentelemetry-go/pull/5552) - Indicate the otlploghttp exporter must be created by the New method by [@​XSAM](https://togithub.com/XSAM) in [https://github.com/open-telemetry/opentelemetry-go/pull/5521](https://togithub.com/open-telemetry/opentelemetry-go/pull/5521) - sdk/log: Add altering Processor example by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5550](https://togithub.com/open-telemetry/opentelemetry-go/pull/5550) - Split the set and add attributes benchmarks by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5546](https://togithub.com/open-telemetry/opentelemetry-go/pull/5546) - Add walk attributes benchmark by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5547](https://togithub.com/open-telemetry/opentelemetry-go/pull/5547) - Add benchmark retrieving a new logger by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5548](https://togithub.com/open-telemetry/opentelemetry-go/pull/5548) - chore(deps): update jaegertracing/all-in-one docker tag to v1.54 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5555](https://togithub.com/open-telemetry/opentelemetry-go/pull/5555) - chore(deps): update jaegertracing/all-in-one docker tag to v1.58 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5556](https://togithub.com/open-telemetry/opentelemetry-go/pull/5556) - Reduces allocation in attributes by [@​Succo](https://togithub.com/Succo) in [https://github.com/open-telemetry/opentelemetry-go/pull/5549](https://togithub.com/open-telemetry/opentelemetry-go/pull/5549) - Generate `internal/transform` in `otlploggrpc` by [@​XSAM](https://togithub.com/XSAM) in [https://github.com/open-telemetry/opentelemetry-go/pull/5553](https://togithub.com/open-telemetry/opentelemetry-go/pull/5553) - Split the span start/end benchmarks and test start with links and attributes by [@​dmathieu](https://togithub.com/dmathieu) in [https://github.com/open-telemetry/opentelemetry-go/pull/5554](https://togithub.com/open-telemetry/opentelemetry-go/pull/5554) - sdk/log: Fix ExampleProcessor_redact to clone the record by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5559](https://togithub.com/open-telemetry/opentelemetry-go/pull/5559) - sdk/log: Add filtering Processor example by [@​pellared](https://togithub.com/pellared) in [https://github.com/open-telemetry/opentelemetry-go/pull/5543](https://togithub.com/open-telemetry/opentelemetry-go/pull/5543) - chore(deps): update google.golang.org/genproto/googleapis/api digest to [`f6361c8`](https://togithub.com/open-telemetry/opentelemetry-go/commit/f6361c8) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5563](https://togithub.com/open-telemetry/opentelemetry-go/pull/5563) - chore(deps): update google.golang.org/genproto/googleapis/rpc digest to [`f6361c8`](https://togithub.com/open-telemetry/opentelemetry-go/commit/f6361c8) by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5564](https://togithub.com/open-telemetry/opentelemetry-go/pull/5564) - Move time.Now call into exemplar reservoir to improve performance by [@​dashpole](https://togithub.com/dashpole) in [https://github.com/open-telemetry/opentelemetry-go/pull/5545](https://togithub.com/open-telemetry/opentelemetry-go/pull/5545) - chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.104.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/open-telemetry/opentelemetry-go/pull/5565](https://togithub.com/open-telemetry/opentelemetry-go/pull/5565) - Add [@​XSAM](https://togithub.com/XSAM) and [@​dmathieu](https://togithub.com/dmathieu) as repository maintainers by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5558](https://togithub.com/open-telemetry/opentelemetry-go/pull/5558) - Releases v1.28.0/v0.50.0/v0.4.0 by [@​MrAlias](https://togithub.com/MrAlias) in [https://github.com/open-telemetry/opentelemetry-go/pull/5569](https://togithub.com/open-telemetry/opentelemetry-go/pull/5569) #### New Contributors - [@​YHM404](https://togithub.com/YHM404) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5267](https://togithub.com/open-telemetry/opentelemetry-go/pull/5267) - [@​juliusv](https://togithub.com/juliusv) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5506](https://togithub.com/open-telemetry/opentelemetry-go/pull/5506) - [@​fabiobozzo](https://togithub.com/fabiobozzo) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5494](https://togithub.com/open-telemetry/opentelemetry-go/pull/5494) - [@​Charlie-lizhihan](https://togithub.com/Charlie-lizhihan) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5514](https://togithub.com/open-telemetry/opentelemetry-go/pull/5514) - [@​bagmeg](https://togithub.com/bagmeg) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5492](https://togithub.com/open-telemetry/opentelemetry-go/pull/5492) - [@​pyohannes](https://togithub.com/pyohannes) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5520](https://togithub.com/open-telemetry/opentelemetry-go/pull/5520) - [@​srijan-27](https://togithub.com/srijan-27) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5530](https://togithub.com/open-telemetry/opentelemetry-go/pull/5530) - [@​Succo](https://togithub.com/Succo) made their first contribution in [https://github.com/open-telemetry/opentelemetry-go/pull/5549](https://togithub.com/open-telemetry/opentelemetry-go/pull/5549) **Full Changelog**: https://github.com/open-telemetry/opentelemetry-go/compare/v1.27.0...v1.28.0
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- instrumentation/runtime/test/go.mod | 5 +++-- instrumentation/runtime/test/go.sum | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/instrumentation/runtime/test/go.mod b/instrumentation/runtime/test/go.mod index e5e1c4971c8..916e4bcabe3 100644 --- a/instrumentation/runtime/test/go.mod +++ b/instrumentation/runtime/test/go.mod @@ -6,14 +6,15 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/contrib/instrumentation/runtime v0.53.0 go.opentelemetry.io/otel v1.28.0 - go.opentelemetry.io/otel/sdk v1.27.0 - go.opentelemetry.io/otel/sdk/metric v1.27.0 + go.opentelemetry.io/otel/sdk v1.28.0 + go.opentelemetry.io/otel/sdk/metric v1.28.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect diff --git a/instrumentation/runtime/test/go.sum b/instrumentation/runtime/test/go.sum index 50769cf3b11..53e2a04097c 100644 --- a/instrumentation/runtime/test/go.sum +++ b/instrumentation/runtime/test/go.sum @@ -7,6 +7,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= @@ -15,10 +17,10 @@ go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= -go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= -go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= -go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= +go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= From 22bae492130d5022df6deef3c27962aca5ee50bb Mon Sep 17 00:00:00 2001 From: Yingrong Zhao <22300958+VinozzZ@users.noreply.github.com> Date: Tue, 16 Jul 2024 05:41:24 -0400 Subject: [PATCH 10/16] Update CHANGELOG.md for OTEL_HTTP_CLIENT_COMPATIBILITY_MODE environment variable (#5908) Add a changelog entry for the new `OTEL_HTTP_CLIENT_COMPATIBILITY_MODE` environment variable introduced in #5331 --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 707abe4aece..c7a01b70bb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This module provides an OpenTelemetry logging bridge for `go.uber.org/zap`. (#5191) - The `go.opentelemetry.io/contrib/config` package supports configuring `with_resource_constant_labels` for the prometheus exporter. (#5890) - Add new runtime metrics to `go.opentelemetry.io/contrib/instrumentation/runtime`, which are still disabled by default. (#5870) +- Support for the `OTEL_HTTP_CLIENT_COMPATIBILITY_MODE=http/dup` environment variable in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to emit attributes for both the v1.20.0 and v1.24.0 semantic conventions. (#5401) ### Removed From 3920b31e8e37a6c59e5c47056bcae9eb04cf6257 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 19:34:25 +0200 Subject: [PATCH 11/16] fix(deps): update golang.org/x/exp digest to 1d5bc16 (#5919) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | golang.org/x/exp | require | digest | `46b0784` -> `1d5bc16` | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 09a2f1e5e98..2e322884a55 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/crosslink v0.14.0 go.opentelemetry.io/build-tools/gotmpl v0.14.0 go.opentelemetry.io/build-tools/multimod v0.14.0 - golang.org/x/exp v0.0.0-20240707233637-46b078467d37 + golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8 golang.org/x/tools v0.23.0 golang.org/x/vuln v1.1.2 ) diff --git a/tools/go.sum b/tools/go.sum index 6ec2c2b3612..8e085f70aa0 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -508,8 +508,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/exp v0.0.0-20240707233637-46b078467d37 h1:uLDX+AfeFCct3a2C7uIWBKMJIR3CJMhcgfrUAqjRK6w= -golang.org/x/exp v0.0.0-20240707233637-46b078467d37/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8 h1:Z+vTUQyBb738QmIhbJx3z4htsxDeI+rd0EHvNm8jHkg= +golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= From c12a7c5152af4fa010cf4531182f088354837ce7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 08:39:40 +0200 Subject: [PATCH 12/16] fix(deps): update module golang.org/x/vuln to v1.1.3 (#5921) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | golang.org/x/vuln | `v1.1.2` -> `v1.1.3` | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fvuln/v1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fvuln/v1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fvuln/v1.1.2/v1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fvuln/v1.1.2/v1.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 2e322884a55..03af8d6ad7c 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.14.0 golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8 golang.org/x/tools v0.23.0 - golang.org/x/vuln v1.1.2 + golang.org/x/vuln v1.1.3 ) require ( diff --git a/tools/go.sum b/tools/go.sum index 8e085f70aa0..331ef957f61 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -627,8 +627,8 @@ golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= -golang.org/x/vuln v1.1.2 h1:UkLxe+kAMcrNBpGrFbU0Mc5l7cX97P2nhy21wx5+Qbk= -golang.org/x/vuln v1.1.2/go.mod h1:2o3fRKD8Uz9AraAL3lwd/grWBv+t+SeJnPcqBUJrY24= +golang.org/x/vuln v1.1.3 h1:NPGnvPOTgnjBc9HTaUx+nj+EaUYxl5SJOWqaDYGaFYw= +golang.org/x/vuln v1.1.3/go.mod h1:7Le6Fadm5FOqE9C926BCD0g12NWyhg7cxV4BwcPFuNY= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 74c65051180a3cb610c4d7fa76ee87f6bf52464f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:53:29 +0200 Subject: [PATCH 13/16] fix(deps): update golang.org/x/exp digest to e3f2596 (#5920) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | golang.org/x/exp | require | digest | `1d5bc16` -> `e3f2596` | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-go-contrib). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 03af8d6ad7c..a37f1504e42 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/crosslink v0.14.0 go.opentelemetry.io/build-tools/gotmpl v0.14.0 go.opentelemetry.io/build-tools/multimod v0.14.0 - golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8 + golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7 golang.org/x/tools v0.23.0 golang.org/x/vuln v1.1.3 ) diff --git a/tools/go.sum b/tools/go.sum index 331ef957f61..05a184e580c 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -508,8 +508,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8 h1:Z+vTUQyBb738QmIhbJx3z4htsxDeI+rd0EHvNm8jHkg= -golang.org/x/exp v0.0.0-20240716160929-1d5bc16f04a8/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7 h1:wDLEX9a7YQoKdKNQt88rtydkqDxeGaBUTnIYc3iG/mA= +golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= From 9d149cdaa72d682d61f5ed8bf7b716f38f58b948 Mon Sep 17 00:00:00 2001 From: Khushi Jain Date: Wed, 17 Jul 2024 19:41:49 +0530 Subject: [PATCH 14/16] otelzap: Add package documentation (#5917) --- bridges/otelzap/core.go | 31 ++++++++++++++++++++++++++++++- bridges/otelzap/example_test.go | 5 +++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/bridges/otelzap/core.go b/bridges/otelzap/core.go index 8a9992c2a11..3da8f94a55c 100644 --- a/bridges/otelzap/core.go +++ b/bridges/otelzap/core.go @@ -2,7 +2,36 @@ // SPDX-License-Identifier: Apache-2.0 // Package otelzap provides a bridge between the [go.uber.org/zap] and -// OpenTelemetry logging. +// [OpenTelemetry]. + +// # Record Conversion +// +// The [zapcore.Entry] and [zapcore.Field] are converted to OpenTelemetry [log.Record] in the following +// way: +// +// - Time is set as the Timestamp. +// - Message is set as the Body using a [log.StringValue]. +// - Level is transformed and set as the Severity. The SeverityText is also +// set. +// - Fields are transformed and set as the Attributes. +// - Field value of type `context.Context` is used as context when emitting log records. +// - For named loggers, LoggerName is used to access [log.Logger] from [log.LoggerProvider] + +// +// The Level is transformed to the OpenTelemetry Severity types in the following way. +// +// - [zapcore.DebugLevel] is transformed to [log.SeverityDebug] +// - [zapcore.InfoLevel] is transformed to [log.SeverityInfo] +// - [zapcore.WarnLevel] is transformed to [log.SeverityWarn] +// - [zapcore.ErrorLevel] is transformed to [log.SeverityError] +// - [zapcore.DPanicLevel] is transformed to [log.SeverityFatal1] +// - [zapcore.PanicLevel] is transformed to [log.SeverityFatal2] +// - [zapcore.FatalLevel] is transformed to [log.SeverityFatal3] +// +// Fields are transformed based on their type into log attributes, or into a string value if there is no matching type. +// +// [OpenTelemetry]: https://opentelemetry.io/docs/concepts/signals/logs/ + package otelzap // import "go.opentelemetry.io/contrib/bridges/otelzap" import ( diff --git a/bridges/otelzap/example_test.go b/bridges/otelzap/example_test.go index 3a15ee262ce..54fa02a57ee 100644 --- a/bridges/otelzap/example_test.go +++ b/bridges/otelzap/example_test.go @@ -4,6 +4,7 @@ package otelzap_test import ( + "context" "os" "go.opentelemetry.io/contrib/bridges/otelzap" @@ -24,6 +25,10 @@ func Example() { // You can now use your logger in your code. logger.Info("something really cool") + + // You can set context for trace correlation using zap.Any or zap.Reflect + ctx := context.Background() + logger.Info("setting context", zap.Any("context", ctx)) } func Example_multiple() { From f3b7018db6306e7f52161e22d0857981deef73b2 Mon Sep 17 00:00:00 2001 From: Khushi Jain Date: Wed, 17 Jul 2024 20:14:38 +0530 Subject: [PATCH 15/16] otellogrus: Fix package documentation (#5922) --- bridges/otellogrus/hook.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bridges/otellogrus/hook.go b/bridges/otellogrus/hook.go index 19e477a6647..4d06e03dc75 100644 --- a/bridges/otellogrus/hook.go +++ b/bridges/otellogrus/hook.go @@ -19,12 +19,12 @@ // The Level is transformed by using the static offset to the OpenTelemetry // Severity types. For example: // -// - [slog.LevelDebug] is transformed to [log.SeverityDebug] -// - [slog.LevelInfo] is transformed to [log.SeverityInfo] -// - [slog.LevelWarn] is transformed to [log.SeverityWarn] -// - [slog.LevelError] is transformed to [log.SeverityError] +// - [logrus.DebugLevel] is transformed to [log.SeverityDebug] +// - [logrus.InfoLevel] is transformed to [log.SeverityTrace4] +// - [logrus.WarnLevel] is transformed to [log.SeverityTrace3] +// - [logrus.ErrorLevel] is transformed to [log.SeverityTrace2] // -// Attribute values are transformed based on their type into log attributes, or +// Field values are transformed based on their type into log attributes, or // into a string value if there is no matching type. // // [OpenTelemetry]: https://opentelemetry.io/docs/concepts/signals/logs/ From dedcf91a55a36a5a8589c56f2e43c188eb42f4f2 Mon Sep 17 00:00:00 2001 From: Akhigbe Eromosele David Date: Wed, 17 Jul 2024 16:22:58 +0100 Subject: [PATCH 16/16] zerolog: Hook implementation (#5918) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit part of #5405 Implemented the run method and wrote tests for it --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- bridges/otelzerolog/hook.go | 30 +++++++++++- bridges/otelzerolog/hook_test.go | 84 ++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/bridges/otelzerolog/hook.go b/bridges/otelzerolog/hook.go index 2928396240b..5f8327f1f01 100644 --- a/bridges/otelzerolog/hook.go +++ b/bridges/otelzerolog/hook.go @@ -100,5 +100,33 @@ func NewHook(name string, options ...Option) *Hook { // Run handles the passed record, and sends it to OpenTelemetry. func (h Hook) Run(e *zerolog.Event, level zerolog.Level, msg string) { - // TODO + r := log.Record{} + r.SetSeverity(convertLevel(level)) + r.SetBody(log.StringValue(msg)) + r.SetSeverityText(level.String()) + + // TODO: add support for attributes + // This is limited by zerolog's inability to retrieve fields. + // https://github.com/rs/zerolog/issues/493 + + h.logger.Emit(e.GetCtx(), r) +} + +func convertLevel(level zerolog.Level) log.Severity { + switch level { + case zerolog.DebugLevel: + return log.SeverityDebug + case zerolog.InfoLevel: + return log.SeverityInfo + case zerolog.WarnLevel: + return log.SeverityWarn + case zerolog.ErrorLevel: + return log.SeverityError + case zerolog.PanicLevel: + return log.SeverityFatal1 + case zerolog.FatalLevel: + return log.SeverityFatal2 + default: + return log.SeverityUndefined + } } diff --git a/bridges/otelzerolog/hook_test.go b/bridges/otelzerolog/hook_test.go index 273e9c73c59..27f23a4a192 100644 --- a/bridges/otelzerolog/hook_test.go +++ b/bridges/otelzerolog/hook_test.go @@ -3,13 +3,17 @@ package otelzerolog import ( + "os" "testing" + "github.com/rs/zerolog" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/log" "go.opentelemetry.io/otel/log/embedded" "go.opentelemetry.io/otel/log/global" + "go.opentelemetry.io/otel/log/logtest" ) type mockLoggerProvider struct { @@ -103,3 +107,83 @@ func TestNewHook(t *testing.T) { }) } } + +var ( + testMessage = "log message" + loggerName = "name" + testKey = "key" + testValue = "value" + testEntry = zerolog.InfoLevel +) + +func TestHookRun(t *testing.T) { + rec := logtest.NewRecorder() + hook := NewHook(loggerName, WithLoggerProvider(rec)) + + logger := zerolog.New(os.Stderr).Hook(hook) + + t.Run("Run", func(t *testing.T) { + // Create an event and run the hook + event := logger.Info().Str(testKey, testValue) + hook.Run(event, testEntry, testMessage) + + // Check the results + require.Len(t, rec.Result(), 1) + require.Len(t, rec.Result()[0].Records, 1) + got := rec.Result()[0].Records[0] + assert.Equal(t, testMessage, got.Body().AsString()) + assert.Equal(t, log.SeverityInfo, got.Severity()) + assert.Equal(t, zerolog.InfoLevel.String(), got.SeverityText()) + }) +} + +func TestConvertLevel(t *testing.T) { + tests := []struct { + name string + zerologLevel zerolog.Level + expected log.Severity + }{ + { + name: "DebugLevel", + zerologLevel: zerolog.DebugLevel, + expected: log.SeverityDebug, + }, + { + name: "InfoLevel", + zerologLevel: zerolog.InfoLevel, + expected: log.SeverityInfo, + }, + { + name: "WarnLevel", + zerologLevel: zerolog.WarnLevel, + expected: log.SeverityWarn, + }, + { + name: "ErrorLevel", + zerologLevel: zerolog.ErrorLevel, + expected: log.SeverityError, + }, + { + name: "PanicLevel", + zerologLevel: zerolog.PanicLevel, + expected: log.SeverityFatal1, + }, + { + name: "FatalLevel", + zerologLevel: zerolog.FatalLevel, + expected: log.SeverityFatal2, + }, + { + name: "UnknownLevel", + zerologLevel: zerolog.NoLevel, // An unknown level + expected: log.SeverityUndefined, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + actual := convertLevel(tt.zerologLevel) + assert.Equal(t, tt.expected, actual, "severity mismatch") + }) + } +}