1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-08-10 22:31:50 +02:00
Commit Graph

1072 Commits

Author SHA1 Message Date
Robert Pająk
69e81088ad Release 1.37.0/0.59.0/0.13.0 (#6925)
### Added

- The `go.opentelemetry.io/otel/semconv/v1.33.0` package.
The package contains semantic conventions from the `v1.33.0` version of
the OpenTelemetry Semantic Conventions.
See the [migration documentation](./semconv/v1.33.0/MIGRATION.md) for
information on how to upgrade from
`go.opentelemetry.io/otel/semconv/v1.32.0.`(#6799)
- The `go.opentelemetry.io/otel/semconv/v1.34.0` package.
The package contains semantic conventions from the `v1.34.0` version of
the OpenTelemetry Semantic Conventions. (#6812)
- Add metric's schema URL as `otel_scope_schema_url` label in
`go.opentelemetry.io/otel/exporters/prometheus`. (#5947)
- Add metric's scope attributes as `otel_scope_[attribute]` labels in
`go.opentelemetry.io/otel/exporters/prometheus`. (#5947)
- Add `EventName` to `EnabledParameters` in
`go.opentelemetry.io/otel/log`. (#6825)
- Add `EventName` to `EnabledParameters` in
`go.opentelemetry.io/otel/sdk/log`. (#6825)
- Changed handling of `go.opentelemetry.io/otel/exporters/prometheus`
metric renaming to add unit suffixes when it doesn't match one of the
pre-defined values in the unit suffix map. (#6839)

### Changed

- The semantic conventions have been upgraded from `v1.26.0` to
`v1.34.0` in `go.opentelemetry.io/otel/bridge/opentracing`. (#6827)
- The semantic conventions have been upgraded from `v1.26.0` to
`v1.34.0` in `go.opentelemetry.io/otel/exporters/zipkin`. (#6829)
- The semantic conventions have been upgraded from `v1.26.0` to
`v1.34.0` in `go.opentelemetry.io/otel/metric`. (#6832)
- The semantic conventions have been upgraded from `v1.26.0` to
`v1.34.0` in `go.opentelemetry.io/otel/sdk/resource`. (#6834)
- The semantic conventions have been upgraded from `v1.26.0` to
`v1.34.0` in `go.opentelemetry.io/otel/sdk/trace`. (#6835)
- The semantic conventions have been upgraded from `v1.26.0` to
`v1.34.0` in `go.opentelemetry.io/otel/trace`. (#6836)
- `Record.Resource` now returns `*resource.Resource` instead of
`resource.Resource` in `go.opentelemetry.io/otel/sdk/log`. (#6864)
- Retry now shows error cause for context timeout in
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`,
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`,
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`,
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`,
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`,
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6898)

### Fixed

- Stop stripping trailing slashes from configured endpoint URL in
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`.
(#6710)
- Stop stripping trailing slashes from configured endpoint URL in
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`.
(#6710)
- Stop stripping trailing slashes from configured endpoint URL in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`.
(#6710)
- Stop stripping trailing slashes from configured endpoint URL in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`.
(#6710)
- Validate exponential histogram scale range for Prometheus
compatibility in `go.opentelemetry.io/otel/exporters/prometheus`.
(#6822)
- Context cancellation during metric pipeline produce does not corrupt
data in `go.opentelemetry.io/otel/sdk/metric`. (#6914)

### Removed

- `go.opentelemetry.io/otel/exporters/prometheus` no longer exports
`otel_scope_info` metric. (#6770)
2025-06-25 08:41:12 +02:00
Damien Mathieu
351a51f1ed Use existing schema URLs in tests (#6924)
The 1.2.0 schema URL isn't avaibable (anymore?). So link checks are
failing.
This upgrades the schema URLs to 1.21.0.

See
https://cloud-native.slack.com/archives/C02UN96HZH6/p1750664367346769

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2025-06-24 09:02:21 +02:00
Alec Holmes
2da77b1195 Ensure context cancellation during metric pipeline produce does not corrupt data (#6914)
This fixes issue #6344, in which an attempted clean shutdown of the
metrics SDK using PeriodicReader's Shutdown method can produce and emit
wildly incorrect data point values that are orders of magnitude too
large.

The root of the issue is that the pipeline produce method changed in
this PR cannot safely return early, which was happening in the callback
loops that were checking for context cancellation. Early return is not
safe since callbacks and aggregations are tightly coupled in practice:
invoking callbacks without also invoking aggregations corrupts internal
data point value accounting.

The linked issue more concretely walks through the sequence of steps
that were causing this issue.

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-06-20 09:46:30 +02:00
Joe Stephenson
94ab03f569 Remove internal matchers (#6907)
Modifies the only remaining use of the internal matchers to use
`require` and closes #6541
2025-06-17 16:49:22 +02:00
Sam Xie
a4055c21bc Use the cause of the context error in OTLP retry (#6898)
Part of #6588

For a demo code like this

```go
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
	"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
	sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

func main() {
	ctx := context.Background()

	exp, err := newExporter(ctx)
	if err != nil {
		log.Fatalf("failed to initialize trace exporter: %v", err)
	}

	tp, err := newTracerProvider(exp)
	if err != nil {
		log.Fatalf("failed to initialize trace provider: %v", err)
	}

	defer func() { _ = tp.Shutdown(ctx) }()

	otel.SetTracerProvider(tp)
	generateSpan()

	select {}
}

func generateSpan() {
	log.Println("Generating a dummy span")
	_, span := otel.Tracer("").Start(context.Background(), "dummy")
	defer span.End()
}

func newTracerProvider(exp sdktrace.SpanExporter) (*sdktrace.TracerProvider, error) {
	return sdktrace.NewTracerProvider(
		sdktrace.WithBatcher(exp),
	), nil
}

func newExporter(ctx context.Context) (*otlptrace.Exporter, error) {
	traceExporter, err := otlptrace.New(
		ctx,
		otlptracegrpc.NewClient(
			otlptracegrpc.WithEndpoint("127.0.0.1:4317"),
			otlptracegrpc.WithInsecure(),
			otlptracegrpc.WithRetry(otlptracegrpc.RetryConfig{
				Enabled:         true,
				InitialInterval: 1 * time.Second,
				MaxInterval:     30 * time.Second,
				MaxElapsedTime:  time.Minute,
			}),
		),
	)
	if err != nil {
		return nil, fmt.Errorf("failed to create trace exporter: %w", err)
	}

	return traceExporter, nil
}
```

the error result from

```
traces export: context deadline exceeded: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:4317: connect: connection refused"
```

become

```
traces export: exporter export timeout: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:4317: connect: connection refused"
```
2025-06-12 19:02:35 +02:00
Robert Pająk
a99f9b56ce sdk/log: Record.Resource to return *resource.Resource (#6864)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6863

From https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Resource:

> Resource is an immutable object
> [...]
> Resources should be passed and stored as pointers
(`*resource.Resource`)

In all other places the exported API uses `*resource.Resource` and not
`resource.Resource`.
2025-06-04 07:05:17 +02:00
Joe Stephenson
dc210e99a4 sdk/trace: Remove internaltest package (#6846)
Closes #6540
Closes #6535
2025-05-30 09:00:23 +02:00
Tyler Yahn
33eb582188 Upgrade semconv to 1.34.0 in sdk/trace (#6835) 2025-05-28 11:10:10 -07:00
Tyler Yahn
cc26aaad49 Upgrade semconv to 1.34.0 in sdk/resource (#6834) 2025-05-28 11:03:39 -07:00
Tyler Yahn
17741cbd58 Upgrade semconv to 1.34.0 in sdk/metric (#6833) 2025-05-28 10:56:53 -07:00
renovate[bot]
261ed77ee2 fix(deps): update module github.com/go-logr/logr to v1.4.3 (#6842) 2025-05-28 18:02:07 +02:00
Robert Pająk
65b8067f18 log,sdk/log: add EventName to EnabledParameters (#6825)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6771
2025-05-28 07:16:24 +02:00
Tyler Yahn
0fc383a3ac Release log/v0.12.2 (#6806)
Resolve #6803 

- Retract `v0.12.0` release of
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` module
that contains invalid dependencies. (#6804)
- Retract `v0.12.0` release of
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` module
that contains invalid dependencies. (#6804)
- Retract `v0.12.0` release of
`go.opentelemetry.io/otel/exporters/stdout/stdoutlog` module that
contains invalid dependencies. (#6804)

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-05-22 09:30:55 +02:00
Damien Mathieu
355c8ccc26 Release experimental logs 0.12.1 (#6802)
# Overview

### Fixes

- Use the proper dependency version of
`go.opentelemetry.io/otel/sdk/log/logtest` in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#6800)
- Use the proper dependency version of
`go.opentelemetry.io/otel/sdk/log/logtest` in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6800)
- Use the proper dependency version of
`go.opentelemetry.io/otel/sdk/log/logtest` in
`go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#6800)
2025-05-21 15:25:38 +02:00
Damien Mathieu
a85ae98dce Release v1.36.0/v0.58.0/v0.12.0 (#6793)
# Overview

Closes https://github.com/open-telemetry/opentelemetry-go/issues/6786

### Added

- Add exponential histogram support in
`go.opentelemetry.io/otel/exporters/prometheus`. (#6421)
- The `go.opentelemetry.io/otel/semconv/v1.31.0` package.
The package contains semantic conventions from the `v1.31.0` version of
the OpenTelemetry Semantic Conventions.
See the [migration documentation](./semconv/v1.31.0/MIGRATION.md) for
information on how to upgrade from
`go.opentelemetry.io/otel/semconv/v1.30.0`. (#6479)
- Add `Recording`, `Scope`, and `Record` types in
`go.opentelemetry.io/otel/log/logtest`. (#6507)
- Add `WithHTTPClient` option to configure the `http.Client` used by
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`.
(#6751)
- Add `WithHTTPClient` option to configure the `http.Client` used by
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`.
(#6752)
- Add `WithHTTPClient` option to configure the `http.Client` used by
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6688)
- Add `ValuesGetter` in `go.opentelemetry.io/otel/propagation`, a
`TextMapCarrier` that supports retrieving multiple values for a single
key. (#5973)
- Add `Values` method to `HeaderCarrier` to implement the new
`ValuesGetter` interface in `go.opentelemetry.io/otel/propagation`.
(#5973)
- Update `Baggage` in `go.opentelemetry.io/otel/propagation` to retrieve
multiple values for a key when the carrier implements `ValuesGetter`.
(#5973)
- Add `AssertEqual` function in `go.opentelemetry.io/otel/log/logtest`.
(#6662)
- The `go.opentelemetry.io/otel/semconv/v1.32.0` package.
The package contains semantic conventions from the `v1.32.0` version of
the OpenTelemetry Semantic Conventions.
See the [migration documentation](./semconv/v1.32.0/MIGRATION.md) for
information on how to upgrade from
`go.opentelemetry.io/otel/semconv/v1.31.0`(#6782)
- Add `Transform` option in `go.opentelemetry.io/otel/log/logtest`.
(#6794)
- Add `Desc` option in `go.opentelemetry.io/otel/log/logtest`. (#6796)

### Removed

- Drop support for [Go 1.22]. (#6381, #6418)
- Remove `Resource` field from `EnabledParameters` in
`go.opentelemetry.io/otel/sdk/log`. (#6494)
- Remove `RecordFactory` type from
`go.opentelemetry.io/otel/log/logtest`. (#6492)
- Remove `ScopeRecords`, `EmittedRecord`, and `RecordFactory` types from
`go.opentelemetry.io/otel/log/logtest`. (#6507)
- Remove `AssertRecordEqual` function in
`go.opentelemetry.io/otel/log/logtest`, use `AssertEqual` instead.
(#6662)

### Changed

- ⚠️ Update `github.com/prometheus/client_golang` to `v1.21.1`, which
changes the `NameValidationScheme` to `UTF8Validation`.
This allows metrics names to keep original delimiters (e.g. `.`), rather
than replacing with underscores.
This can be reverted by setting
`github.com/prometheus/common/model.NameValidationScheme` to
`LegacyValidation` in `github.com/prometheus/common/model`. (#6433)
- Initialize map with `len(keys)` in `NewAllowKeysFilter` and
`NewDenyKeysFilter` to avoid unnecessary allocations in
`go.opentelemetry.io/otel/attribute`. (#6455)
- `go.opentelemetry.io/otel/log/logtest` is now a separate Go module.
(#6465)
- `go.opentelemetry.io/otel/sdk/log/logtest` is now a separate Go
module. (#6466)
- `Recorder` in `go.opentelemetry.io/otel/log/logtest` no longer
separately stores records emitted by loggers with the same
instrumentation scope. (#6507)
- Improve performance of `BatchProcessor` in
`go.opentelemetry.io/otel/sdk/log` by not exporting when exporter cannot
accept more. (#6569, #6641)

### Deprecated

- Deprecate support for `model.LegacyValidation` for
`go.opentelemetry.io/otel/exporters/prometheus`. (#6449)

### Fixes

- Stop percent encoding header environment variables in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` and
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6392)
- Ensure the `noopSpan.tracerProvider` method is not inlined in
`go.opentelemetry.io/otel/trace` so the `go.opentelemetry.io/auto`
instrumentation can instrument non-recording spans. (#6456)
- Use a `sync.Pool` instead of allocating `metricdata.ResourceMetrics`
in `go.opentelemetry.io/otel/exporters/prometheus`. (#6472)

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2025-05-21 09:35:39 +02:00
Sean Liao
a571c52b0a all: replace math/rand with math/rand/v2 (#6732)
Update to new stdlib apis.

The new Float64 is uniform, which resolves a long comment.


https://cs.opensource.google/go/go/+/refs/tags/go1.24.2:src/math/rand/v2/rand.go;l=209

> // There are exactly 1<<53 float64s in [0,1). Use Intn(1<<53) /
(1<<53).
	return float64(r.Uint64()<<11>>11) / (1 << 53)

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/trace
cpu: 12th Gen Intel(R) Core(TM) i7-1260P
                                 │   old.txt    │               new.txt                │
                                 │    sec/op    │    sec/op     vs base                │
TraceStart/with_a_simple_span-16   387.1n ±  5%   306.8n ± 15%  -20.73% (p=0.000 n=10)
TraceStart/with_several_links-16   542.2n ±  5%   501.0n ±  2%   -7.61% (p=0.000 n=10)
TraceStart/with_attributes-16      521.4n ± 14%   571.6n ±  6%   +9.64% (p=0.009 n=10)
geomean                            478.3n         444.6n         -7.05%

                                 │  old.txt   │               new.txt               │
                                 │    B/op    │    B/op     vs base                 │
TraceStart/with_a_simple_span-16   528.0 ± 0%   528.0 ± 0%       ~ (p=1.000 n=10) ¹
TraceStart/with_several_links-16   704.0 ± 0%   704.0 ± 0%       ~ (p=1.000 n=10) ¹
TraceStart/with_attributes-16      784.0 ± 0%   784.0 ± 0%       ~ (p=1.000 n=10) ¹
geomean                            663.0        663.0       +0.00%
¹ all samples are equal

                                 │  old.txt   │               new.txt               │
                                 │ allocs/op  │ allocs/op   vs base                 │
TraceStart/with_a_simple_span-16   2.000 ± 0%   2.000 ± 0%       ~ (p=1.000 n=10) ¹
TraceStart/with_several_links-16   3.000 ± 0%   3.000 ± 0%       ~ (p=1.000 n=10) ¹
TraceStart/with_attributes-16      4.000 ± 0%   4.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                            2.884        2.884       +0.00%
¹ all samples are equal
```

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-05-15 09:21:49 +02:00
renovate[bot]
caf4740a7d fix(deps): update golang.org/x (#6746)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence | Type |
Update |
|---|---|---|---|---|---|---|---|
| golang.org/x/crypto | `v0.37.0` -> `v0.38.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fcrypto/v0.38.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fcrypto/v0.38.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fcrypto/v0.37.0/v0.38.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fcrypto/v0.37.0/v0.38.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/net | `v0.39.0` -> `v0.40.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fnet/v0.40.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fnet/v0.40.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fnet/v0.39.0/v0.40.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fnet/v0.39.0/v0.40.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sync | `v0.13.0` -> `v0.14.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsync/v0.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsync/v0.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsync/v0.13.0/v0.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsync/v0.13.0/v0.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sys | `v0.32.0` -> `v0.33.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.32.0/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.32.0/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sys | `v0.32.0` -> `v0.33.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.32.0/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.32.0/v0.33.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| require | minor |
| golang.org/x/telemetry | `06ef541` -> `f36df2b` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftelemetry/v0.0.0-20250505181339-f36df2b527df?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftelemetry/v0.0.0-20250505181339-f36df2b527df?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftelemetry/v0.0.0-20250417124945-06ef541f3fa3/v0.0.0-20250505181339-f36df2b527df?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftelemetry/v0.0.0-20250417124945-06ef541f3fa3/v0.0.0-20250505181339-f36df2b527df?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | digest |
| golang.org/x/text | `v0.24.0` -> `v0.25.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftext/v0.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftext/v0.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftext/v0.24.0/v0.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftext/v0.24.0/v0.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### 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 is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNjQuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI2NC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-05 15:51:46 -07:00
Sean Liao
1d8824889c all: match go conventions for generated code (#6731)
Go documents the following regex pattern
for identifying generated code:
^// Code generated .* DO NOT EDIT\.$

This convention is used go APIs and tooling.
References:
https://pkg.go.dev/go/ast#IsGenerated
https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source

Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-05-05 09:41:12 +02:00
Stoo Johnston
6849a0ae29 Remove harness from internaltest and add doc template (#6599)
Remove harness.go from internaltest and create doc.go for package
documentation.

Fixes #6522

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-05-01 08:29:14 -07:00
Yevhenii Solomchenko
84d02c0f39 Do not discourage direct usage of Logs API (#6675)
Fixes #6572

## What

- Update documentation in `log/doc.go`.
- Fix naming of the Logs API in several documentation files `(Logs
Bridge API -> Logs API)`.

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-04-22 11:00:19 +02:00
Robert Pająk
a6e302fa86 sdk/log: remove unnecessary b.q.Len() call (#6641)
Addresses
https://github.com/open-telemetry/opentelemetry-go/pull/6569#discussion_r2037896972
2025-04-11 10:48:01 +02:00
Zhengke Zhou
a486ca5722 sdk/trace: Move testing harness to trace (#6589)
Closes: #6543

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-04-10 08:59:11 -07:00
Igor
a5abd88e1d Optimize Logs SDK BatchProcessor (#6569)
Towards: https://github.com/open-telemetry/opentelemetry-go/issues/6382

This PR optimizes Logs SDK BatchProcessor.

## Why? <!-- was i so blind -->

Batch processor does not check if buffer exporter is full, instead it
clones records to buffer, then tries to push them to buffer exporter,
and then buffer exporter will return false from EnqueueExport if it is
full.

It does not cause any performance issues when using NOOP exporter,
because it "exports" instantly. -> Buffer exporter input channel will
almost never be full.

But actual implementations of exporters are not going to act that way,
they need some time for export operation. And so buffer exporter will
get full fairly frequently. Each export attempt to buffer exporter costs
us copying entire queue inside of batch processor.

In order to catch this or similar performance bottleneck in the future,
new benchmark (`BatchSimulateExport`) was added which will use exporter
that will simulate non-instant export by sleeping for 5ms.

## Benchmarks

```sh
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: AMD Ryzen 9 7900X 12-Core Processor
                                 │   base.txt   │               new.txt               │
                                 │    sec/op    │   sec/op     vs base                │
Processor/Simple-24                 340.9n ± 2%   343.5n ± 5%        ~ (p=0.971 n=10)
Processor/Batch-24                  667.6n ± 2%   666.3n ± 4%        ~ (p=0.896 n=10)
Processor/BatchSimulateExport-24   4441.5n ± 5%   526.4n ± 4%  -88.15% (p=0.000 n=10)
Processor/SetTimestampSimple-24     360.0n ± 4%   351.0n ± 1%        ~ (p=0.247 n=10)
Processor/SetTimestampBatch-24      669.8n ± 3%   647.0n ± 5%        ~ (p=0.052 n=10)
Processor/AddAttributesSimple-24    383.9n ± 1%   386.6n ± 5%        ~ (p=0.138 n=10)
Processor/AddAttributesBatch-24     759.9n ± 6%   734.5n ± 5%        ~ (p=0.481 n=10)
Processor/SetAttributesSimple-24    369.9n ± 2%   372.4n ± 3%        ~ (p=0.643 n=10)
Processor/SetAttributesBatch-24     684.2n ± 4%   674.0n ± 8%        ~ (p=0.529 n=10)
geomean                             639.9n        499.9n       -21.88%

                                 │   base.txt   │                new.txt                 │
                                 │     B/op     │     B/op      vs base                  │
Processor/Simple-24                  450.0 ± 0%     450.0 ± 0%        ~ (p=1.000 n=10) ¹
Processor/Batch-24                 1.153Ki ± 2%   1.125Ki ± 1%   -2.41% (p=0.001 n=10)
Processor/BatchSimulateExport-24     649.0 ± 1%     473.0 ± 0%  -27.12% (p=0.000 n=10)
Processor/SetTimestampSimple-24      450.0 ± 0%     450.0 ± 0%        ~ (p=1.000 n=10) ¹
Processor/SetTimestampBatch-24     1.145Ki ± 2%   1.122Ki ± 2%   -2.01% (p=0.003 n=10)
Processor/AddAttributesSimple-24     450.0 ± 0%     450.0 ± 0%        ~ (p=1.000 n=10) ¹
Processor/AddAttributesBatch-24    1.169Ki ± 2%   1.148Ki ± 1%   -1.80% (p=0.000 n=10)
Processor/SetAttributesSimple-24     450.0 ± 0%     450.0 ± 0%        ~ (p=1.000 n=10) ¹
Processor/SetAttributesBatch-24    1.141Ki ± 2%   1.128Ki ± 2%   -1.11% (p=0.030 n=10)
geomean                              719.3          688.7        -4.24%
¹ all samples are equal

                                 │  base.txt  │               new.txt               │
                                 │ allocs/op  │ allocs/op   vs base                 │
Processor/Simple-24                1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/Batch-24                 1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/BatchSimulateExport-24   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/SetTimestampSimple-24    1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/SetTimestampBatch-24     1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/AddAttributesSimple-24   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/AddAttributesBatch-24    1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/SetAttributesSimple-24   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/SetAttributesBatch-24    1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                            1.000        1.000       +0.00%
¹ all samples are equal
```

## Benchmarks from issue (external)

```sh
goos: linux
goarch: amd64
pkg: github.com/pellared/spanevents-vs-logs
cpu: AMD Ryzen 9 7900X 12-Core Processor
           │ spanevents.txt │              logs.base.txt              │             logs.new.txt             │
           │     sec/op     │    sec/op      vs base                  │   sec/op     vs base                 │
/OTLP-24        41.40µ ± 3%   2935.15µ ± 9%  +6989.05% (p=0.000 n=10)   84.19µ ± 4%  +103.34% (p=0.000 n=10)
/STDOUT-24      39.55µ ± 4%    623.45µ ± 1%  +1476.21% (p=0.000 n=10)   89.51µ ± 3%  +126.29% (p=0.000 n=10)
/NOOP-24       13.179µ ± 2%     4.950µ ± 1%    -62.44% (p=0.000 n=10)   4.932µ ± 1%   -62.58% (p=0.000 n=10)
geomean         27.84µ          208.4µ        +648.68%                  33.37µ        +19.86%

           │ spanevents.txt │             logs.base.txt              │             logs.new.txt             │
           │      B/op      │     B/op       vs base                 │     B/op      vs base                │
/OTLP-24       98.90Ki ± 8%   210.44Ki ± 0%  +112.79% (p=0.000 n=10)   52.01Ki ± 0%  -47.41% (p=0.000 n=10)
/STDOUT-24     91.01Ki ± 0%   286.62Ki ± 0%  +214.93% (p=0.000 n=10)   81.67Ki ± 1%  -10.27% (p=0.000 n=10)
/NOOP-24       29840.0 ± 0%      240.0 ± 0%   -99.20% (p=0.000 n=10)     240.0 ± 0%  -99.20% (p=0.000 n=10)
geomean        64.01Ki         24.18Ki        -62.23%                  9.985Ki       -84.40%

           │ spanevents.txt │            logs.base.txt             │            logs.new.txt            │
           │   allocs/op    │  allocs/op   vs base                 │ allocs/op   vs base                │
/OTLP-24        699.0 ± 20%   2174.5 ± 1%  +211.09% (p=0.000 n=10)   249.5 ± 1%  -64.31% (p=0.000 n=10)
/STDOUT-24      646.5 ±  1%   4912.5 ± 0%  +659.86% (p=0.000 n=10)   872.5 ± 2%  +34.96% (p=0.000 n=10)
/NOOP-24      303.000 ±  0%    3.000 ± 0%   -99.01% (p=0.000 n=10)   3.000 ± 0%  -99.01% (p=0.000 n=10)
geomean         515.4          317.6        -38.37%                  86.76       -83.17%
```

```sh
goos: linux
goarch: amd64
pkg: github.com/pellared/spanevents-vs-logs
cpu: AMD Ryzen 9 7900X 12-Core Processor
           │ logs.base.txt │            logs.new.txt             │
           │    sec/op     │   sec/op     vs base                │
/OTLP-24     2935.15µ ± 9%   84.19µ ± 4%  -97.13% (p=0.000 n=10)
/STDOUT-24    623.45µ ± 1%   89.51µ ± 3%  -85.64% (p=0.000 n=10)
/NOOP-24       4.950µ ± 1%   4.932µ ± 1%        ~ (p=0.342 n=10)
geomean        208.4µ        33.37µ       -83.99%

           │ logs.base.txt │              logs.new.txt              │
           │     B/op      │     B/op      vs base                  │
/OTLP-24     210.44Ki ± 0%   52.01Ki ± 0%  -75.28% (p=0.000 n=10)
/STDOUT-24   286.62Ki ± 0%   81.67Ki ± 1%  -71.51% (p=0.000 n=10)
/NOOP-24        240.0 ± 0%     240.0 ± 0%        ~ (p=1.000 n=10) ¹
geomean       24.18Ki        9.985Ki       -58.70%
¹ all samples are equal

           │ logs.base.txt │             logs.new.txt             │
           │   allocs/op   │ allocs/op   vs base                  │
/OTLP-24       2174.5 ± 1%   249.5 ± 1%  -88.53% (p=0.000 n=10)
/STDOUT-24     4912.5 ± 0%   872.5 ± 2%  -82.24% (p=0.000 n=10)
/NOOP-24        3.000 ± 0%   3.000 ± 0%        ~ (p=1.000 n=10) ¹
geomean         317.6        86.76       -72.69%
¹ all samples are equal
```

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-04-09 14:36:25 +02:00
renovate[bot]
a58d9a5667 fix(deps): update golang.org/x (#6615)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence | Type |
Update |
|---|---|---|---|---|---|---|---|
| golang.org/x/sync | `v0.12.0` -> `v0.13.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsync/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsync/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsync/v0.12.0/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsync/v0.12.0/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sys | `v0.31.0` -> `v0.32.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.31.0/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.31.0/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sys | `v0.31.0` -> `v0.32.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.31.0/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.31.0/v0.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| require | minor |
| golang.org/x/telemetry | `97abc5d` -> `f593ada` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftelemetry/v0.0.0-20250406004356-f593adaf3fc1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftelemetry/v0.0.0-20250406004356-f593adaf3fc1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftelemetry/v0.0.0-20250403141947-97abc5d70e47/v0.0.0-20250406004356-f593adaf3fc1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftelemetry/v0.0.0-20250403141947-97abc5d70e47/v0.0.0-20250406004356-f593adaf3fc1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | digest |
| golang.org/x/text | `v0.23.0` -> `v0.24.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftext/v0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftext/v0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftext/v0.23.0/v0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftext/v0.23.0/v0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### 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 is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMjcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjIyNy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-05 23:59:33 -07:00
Tyler Yahn
7512a2be2e Add the golines golangci-lint formatter (#6513)
Ensure consistent line wrapping (<= 120 characters) within the project.
2025-03-30 03:46:44 -07:00
ian
9d555cd4a6 Replace env var functionality from internaltest in sdk/resource and sdk/log (#6557)
Fix #6537
Fix #6539 

Replace all uses of the environment variable functionality from the
`sdk/internal/internaltest` package in `sdk/resource` and `sdk/log`.
2025-03-28 13:58:33 +01:00
Zhengke Zhou
03fa67d907 chore(sdk): Replace all uses of the internaltest package in metric (#6551)
Fix: #6536

Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-03-28 09:51:07 +01:00
Zhengke Zhou
63f3cfe1b5 sdk/trace: Manage trace environment variables in testing package (#6552)
Fix: #6542

Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-03-28 09:45:34 +01:00
ian
f18af3b6c3 internaltest: remove alignment.go from internaltest (#6550)
Fix #6519

---------

Co-authored-by: Sam Xie <sam@samxie.me>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-03-28 09:23:26 +01:00
Tyler Yahn
1852b39d6c Refactor fail method in matchers (#6517)
Accept a format and parameters just like `fmt.Sprintf` given almost all
calls to `e.fail` follow this format.
2025-03-27 14:20:20 -07:00
renovate[bot]
590bcee71b fix(deps): update module github.com/golangci/golangci-lint to v2 (#6499)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/golangci/golangci-lint](https://redirect.github.com/golangci/golangci-lint)
| `v1.64.8` -> `v2.0.2` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgolangci%2fgolangci-lint/v2.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgolangci%2fgolangci-lint/v2.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgolangci%2fgolangci-lint/v1.64.8/v2.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgolangci%2fgolangci-lint/v1.64.8/v2.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>golangci/golangci-lint
(github.com/golangci/golangci-lint)</summary>

###
[`v2.0.2`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v202)

[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v2.0.1...v2.0.2)

1.  Misc.
    -   Fixes flags parsing for formatters
    -   Fixes the filepath used by the exclusion `source` option
2.  Documentation
    -   Adds a section about flags migration
    -   Cleaning pages with v1 options

###
[`v2.0.1`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v201)

[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v2.0.0...v2.0.1)

1.  Linters/formatters bug fixes
    -   `golines`: fix settings during linter load
2.  Misc.
    -   Validates the `version` field before the configuration
    -   `forbidigo`: fix migration

###
[`v2.0.0`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v200)

[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v1.64.8...v2.0.0)

1.  Enhancements
- 🌟 New `golangci-lint fmt` command with dedicated formatter
configuration
(https://golangci-lint.run/welcome/quick-start/#formatting)
- ♻️ New `golangci-lint migrate` command to help migration from v1 to v2
(cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#command-migrate))
- ⚠️ New default values (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/))
- ⚠️ No exclusions by default (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#issuesexclude-use-default))
- ⚠️ New default sort order (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#outputsort-order))
- 🌟 New option `run.relative-path-mode` (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#runrelative-path-mode))
- 🌟 New linters configuration (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#linters))
- 🌟 New output format configuration (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#output))
- 🌟 New `--fast-only` flag (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#lintersfast))
- 🌟 New option `linters.exclusions.warn-unused` to log a warning if an
exclusion rule is unused.
2.  New linters/formatters
    -   Add `golines` formatter https://github.com/segmentio/golines
3.  Linters new features
- ⚠️ Merge `staticcheck`, `stylecheck`, `gosimple` into one linter
(`staticcheck`) (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#lintersenablestylecheckgosimplestaticcheck))
    -   `go-critic`: from 0.12.0 to 0.13.0
- `gomodguard`: from 1.3.5 to 1.4.1 (block explicit indirect
dependencies)
    -   `nilnil`: from 1.0.1 to 1.1.0 (new option: `only-two`)
- `perfsprint`: from 0.8.2 to 0.9.1 (checker name in the diagnostic
message)
    -   `staticcheck`: new `quickfix` set of rules
- `testifylint`: from 1.5.2 to 1.6.0 (new options: `equal-values`,
`suite-method-signature`, `require-string-msg`)
- `wsl`: from 4.5.0 to 4.6.0 (new option: `allow-cuddle-used-in-block`)
4.  Linters bug fixes
    -   `bidichk`: from 0.3.2 to 0.3.3
    -   `errchkjson`: from 0.4.0 to 0.4.1
    -   `errname`: from 1.0.0 to 1.1.0
    -   `funlen`: fix `ignore-comments` option
    -   `gci`: from 0.13.5 to 0.13.6
    -   `gosmopolitan`: from 1.2.2 to 1.3.0
    -   `inamedparam`: from 0.1.3 to 0.2.0
    -   `intrange`: from 0.3.0 to 0.3.1
    -   `protogetter`: from 0.3.9 to 0.3.12
- `unparam`: from
[`8a5130c`](https://redirect.github.com/golangci/golangci-lint/commit/8a5130ca722f)
to
[`0df0534`](https://redirect.github.com/golangci/golangci-lint/commit/0df0534333a4)
5.  Misc.
- 🧹 Configuration options renaming (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/))
- 🧹 Remove options (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/))
- 🧹 Remove flags (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/))
- 🧹 Remove alternative names (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#alternative-linter-names))
- 🧹 Remove or replace deprecated elements (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/))
    -   Adds an option to display some commands as JSON:
        -   `golangci-lint config path --json`
        -   `golangci-lint help linters --json`
        -   `golangci-lint help formatters --json`
        -   `golangci-lint linters --json`
        -   `golangci-lint formatters --json`
        -   `golangci-lint version --json`
6.  Documentation
- [Migration guide](https://golangci-lint.run/product/migration-guide/)

</details>

---

### 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 is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2025-03-26 10:46:44 -07:00
Robert Pająk
84ff4da7ab sdk/log: remove EnabledParameters.Resource (#6494)
Per
https://github.com/open-telemetry/opentelemetry-specification/pull/4439#discussion_r1980165954
2025-03-25 06:44:14 +01:00
Robert Pająk
f39f16c6ca sdk/log/logtest: new module (#6466)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6378
2025-03-20 17:47:49 +01:00
renovate[bot]
05de07bcf5 chore(deps): update module github.com/antonboom/testifylint to v1.6.0 (#6440)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/Antonboom/testifylint](https://redirect.github.com/Antonboom/testifylint)
| `v1.5.2` -> `v1.6.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fAntonboom%2ftestifylint/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fAntonboom%2ftestifylint/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fAntonboom%2ftestifylint/v1.5.2/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fAntonboom%2ftestifylint/v1.5.2/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>Antonboom/testifylint
(github.com/Antonboom/testifylint)</summary>

###
[`v1.6.0`](https://redirect.github.com/Antonboom/testifylint/releases/tag/v1.6.0):
– new `equal-values` and `suite-method-signature`

[Compare
Source](https://redirect.github.com/Antonboom/testifylint/compare/v1.5.2...v1.6.0)

#### What's Changed

##### New checkers

- new checker `equal-values` by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/223](https://redirect.github.com/Antonboom/testifylint/pull/223)
- new checker `suite-method-signature` by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/228](https://redirect.github.com/Antonboom/testifylint/pull/228)

##### New features

- `len`: support len-len and value-len cases by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/204](https://redirect.github.com/Antonboom/testifylint/pull/204)
- `error-is-as`: support NotErrorAs by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/219](https://redirect.github.com/Antonboom/testifylint/pull/219)
- `useless-assert`: add NotElementsMatch and NotErrorAs by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/220](https://redirect.github.com/Antonboom/testifylint/pull/220)
- `formatter`: support non-string-message checks by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/221](https://redirect.github.com/Antonboom/testifylint/pull/221)
- `formatter`: warn on empty message by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/225](https://redirect.github.com/Antonboom/testifylint/pull/225)
- `empty`: support empty strings, Zero for strings and len + bubbled
useless-assert cases by
[@&#8203;ccoVeille](https://redirect.github.com/ccoVeille) in
[https://github.com/Antonboom/testifylint/pull/129](https://redirect.github.com/Antonboom/testifylint/pull/129)

##### New fixes

- `negative-positive`: remove untyping, ignore Negative for len
comparisons by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/226](https://redirect.github.com/Antonboom/testifylint/pull/226)
- fixes: support `assert.CollectT` by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/233](https://redirect.github.com/Antonboom/testifylint/pull/233)

##### Bump deps

- Upgrade testdata to v1.10.0 of testify by
[@&#8203;Antonboom](https://redirect.github.com/Antonboom) in
[https://github.com/Antonboom/testifylint/pull/218](https://redirect.github.com/Antonboom/testifylint/pull/218)
- Go 1.24 by [@&#8203;Antonboom](https://redirect.github.com/Antonboom)
in
[https://github.com/Antonboom/testifylint/pull/234](https://redirect.github.com/Antonboom/testifylint/pull/234)
- build(deps): bump golang.org/x/tools from 0.26.0 to 0.27.0 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/Antonboom/testifylint/pull/206](https://redirect.github.com/Antonboom/testifylint/pull/206)
- build(deps): bump rlespinasse/github-slug-action from 4.4.1 to 5.0.0
by [@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/Antonboom/testifylint/pull/207](https://redirect.github.com/Antonboom/testifylint/pull/207)
- build(deps): bump golang.org/x/tools from 0.27.0 to 0.29.0 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/Antonboom/testifylint/pull/214](https://redirect.github.com/Antonboom/testifylint/pull/214)

**Full Changelog**:
https://github.com/Antonboom/testifylint/compare/v1.5.2...v1.6.0

</details>

---

### 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 is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDAuMiIsInVwZGF0ZWRJblZlciI6IjM5LjIwMC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2025-03-13 14:31:12 -07:00
renovate[bot]
a91805406e fix(deps): update golang.org/x (#6413)
This PR contains the following updates:

| Package | Type | Update | Change | Age | Adoption | Passing |
Confidence |
|---|---|---|---|---|---|---|---|
| golang.org/x/exp | require | digest | `dead583` -> `054e65f` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fexp/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fexp/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fexp/v0.0.0-20250228200357-dead58393ab7/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fexp/v0.0.0-20250228200357-dead58393ab7/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/exp/typeparams | indirect | digest | `dead583` ->
`054e65f` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fexp%2ftypeparams/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fexp%2ftypeparams/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fexp%2ftypeparams/v0.0.0-20250228200357-dead58393ab7/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fexp%2ftypeparams/v0.0.0-20250228200357-dead58393ab7/v0.0.0-20250305212735-054e65f0b394?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/net | indirect | minor | `v0.35.0` -> `v0.37.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fnet/v0.37.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fnet/v0.37.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fnet/v0.35.0/v0.37.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fnet/v0.35.0/v0.37.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/sys | indirect | minor | `v0.30.0` -> `v0.31.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.30.0/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.30.0/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/sys | require | minor | `v0.30.0` -> `v0.31.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.30.0/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.30.0/v0.31.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/telemetry | indirect | digest | `d588202` -> `2a181ea` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftelemetry/v0.0.0-20250305155315-2a181eac97a3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftelemetry/v0.0.0-20250305155315-2a181eac97a3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftelemetry/v0.0.0-20250221144447-d58820209c11/v0.0.0-20250305155315-2a181eac97a3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftelemetry/v0.0.0-20250221144447-d58820209c11/v0.0.0-20250305155315-2a181eac97a3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/text | indirect | minor | `v0.22.0` -> `v0.23.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftext/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftext/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftext/v0.22.0/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftext/v0.22.0/v0.23.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 is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODUuNCIsInVwZGF0ZWRJblZlciI6IjM5LjE4NS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-06 09:15:22 +01:00
Sam Xie
09ff8b107a Drop support for Go 1.22 (#6381) 2025-03-05 22:23:10 -08:00
Sam Xie
5ba5e7a449 Release v1.35.0/v0.57.0/v0.11.0 (#6407)
## Overview

This release is the last to support [Go 1.22].
The next release will require at least [Go 1.23].

### Added

- Add `ValueFromAttribute` and `KeyValueFromAttribute` in
`go.opentelemetry.io/otel/log`. (#6180)
- Add `EventName` and `SetEventName` to `Record` in
`go.opentelemetry.io/otel/log`. (#6187)
- Add `EventName` to `RecordFactory` in
`go.opentelemetry.io/otel/log/logtest`. (#6187)
- `AssertRecordEqual` in `go.opentelemetry.io/otel/log/logtest` checks
`Record.EventName`. (#6187)
- Add `EventName` and `SetEventName` to `Record` in
`go.opentelemetry.io/otel/sdk/log`. (#6193)
- Add `EventName` to `RecordFactory` in
`go.opentelemetry.io/otel/sdk/log/logtest`. (#6193)
- Emit `Record.EventName` field in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#6211)
- Emit `Record.EventName` field in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6211)
- Emit `Record.EventName` field in
`go.opentelemetry.io/otel/exporters/stdout/stdoutlog` (#6210)
- The `go.opentelemetry.io/otel/semconv/v1.28.0` package.
The package contains semantic conventions from the `v1.28.0` version of
the OpenTelemetry Semantic Conventions.
See the [migration documentation](./semconv/v1.28.0/MIGRATION.md) for
information on how to upgrade from
`go.opentelemetry.io/otel/semconv/v1.27.0`(#6236)
- The `go.opentelemetry.io/otel/semconv/v1.30.0` package.
The package contains semantic conventions from the `v1.30.0` version of
the OpenTelemetry Semantic Conventions.
See the [migration documentation](./semconv/v1.30.0/MIGRATION.md) for
information on how to upgrade from
`go.opentelemetry.io/otel/semconv/v1.28.0`(#6240)
- Document the pitfalls of using `Resource` as a comparable type.
`Resource.Equal` and `Resource.Equivalent` should be used instead.
(#6272)
- Support [Go 1.24]. (#6304)
- Add `FilterProcessor` and `EnabledParameters` in
`go.opentelemetry.io/otel/sdk/log`.
It replaces
`go.opentelemetry.io/otel/sdk/log/internal/x.FilterProcessor`.
Compared to previous version it additionally gives the possibility to
filter by resource and instrumentation scope. (#6317)

### Changed

- Update `github.com/prometheus/common` to v0.62.0., which changes the
`NameValidationScheme` to `NoEscaping`. This allows metrics names to
keep original delimiters (e.g. `.`), rather than replacing with
underscores. This is controlled by the `Content-Type` header, or can be
reverted by setting `NameValidationScheme` to `LegacyValidation` in
`github.com/prometheus/common/model`. (#6198)

### Fixes

- Eliminate goroutine leak for the processor returned by
`NewSimpleSpanProcessor` when `Shutdown` is called and the passed `ctx`
is canceled and `SpanExporter.Shutdown` has not returned. (#6368)
- Eliminate goroutine leak for the processor returned by
`NewBatchSpanProcessor` when `ForceFlush` is called and the passed `ctx`
is canceled and `SpanExporter.Export` has not returned. (#6369)

[Go 1.23]: https://go.dev/doc/go1.23
[Go 1.22]: https://go.dev/doc/go1.22

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-03-05 10:33:59 -08:00
David Ashpole
e2aee3aff8 Move trace sdk tests from trace_test into trace package (#6400)
I would like to be able to use a private option in
https://github.com/open-telemetry/opentelemetry-go/pull/6393 in tests,
and decided to split this refactoring out into its own PR.

This moves the batch span processor benchmarks into benchmark_test.go,
and replaces one instance of the tracetest.NewInMemoryExporter with a
different test exporter implementation. It then moves most unit tests
from `trace_test` to the main `trace` package.
2025-03-04 21:29:11 -05:00
Robert Pająk
9be18c14cb sdk/trace: Fix gorountine leak in batchSpanProcessor.ForceFlush (#6369)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6360

Per
https://github.com/open-telemetry/opentelemetry-go/issues/6360#issuecomment-2678080742:

> So I'd fix this issue with the first proposed solution, and open an
issue to change the behavior in a separate PR.

```
$ go test -run=TestBatchSpanProcessorForceFlushTimeout -count=1000
PASS
ok      go.opentelemetry.io/otel/sdk/trace      1.701s
$ go test -run=TestBatchSpanProcessorForceFlushTimeout -count=1000 -race
PASS
ok      go.opentelemetry.io/otel/sdk/trace      4.056s
```

@peterbourgon, thank you for your contribution 🏅
2025-02-27 11:28:31 +01:00
Robert Pająk
44d50457d9 sdk/trace: Fix goroutine leak in simpleSpanProcessor.Shutdown (#6368)
Side-effect when working towards
https://github.com/open-telemetry/opentelemetry-go/issues/6360

- Fix goroutine leaks from tests in places where batch processor was not
shut down
- Fix goroutine leak in simpleSpanProcessor.Shutdown
2025-02-26 23:32:15 +01:00
renovate[bot]
cbb4e2499e fix(deps): update module github.com/google/go-cmp to v0.7.0 (#6359)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/google/go-cmp](https://redirect.github.com/google/go-cmp)
| `v0.6.0` -> `v0.7.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgoogle%2fgo-cmp/v0.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgoogle%2fgo-cmp/v0.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgoogle%2fgo-cmp/v0.6.0/v0.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgoogle%2fgo-cmp/v0.6.0/v0.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>google/go-cmp (github.com/google/go-cmp)</summary>

###
[`v0.7.0`](https://redirect.github.com/google/go-cmp/releases/tag/v0.7.0)

[Compare
Source](https://redirect.github.com/google/go-cmp/compare/v0.6.0...v0.7.0)

New API:

- ([#&#8203;367](https://redirect.github.com/google/go-cmp/issues/367))
Support compare functions with SortSlices and SortMaps

Panic messaging:

- ([#&#8203;370](https://redirect.github.com/google/go-cmp/issues/370))
Detect proto.Message types when failing to export a field

</details>

---

### 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 is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNzYuMiIsInVwZGF0ZWRJblZlciI6IjM5LjE3Ni4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2025-02-23 08:21:15 -08:00
Robert Pająk
1ee7c79b73 sdk/log: Add FilterProcessor and EnabledParameters (#6317)
Per
https://github.com/open-telemetry/opentelemetry-go/pull/6271#issuecomment-2657554647

> We agreed that we can move `FilterProcessor` directly to `sdk/log` as
Logs SDK does not look to be stabilized soon.

- Add the possibility to filter based on the resource and scope which is
available for the SDK. The scope information is the most important as it
gives the possibility to e.g. filter out logs emitted for a given
logger. Thus e.g.
https://github.com/open-telemetry/opentelemetry-specification/issues/4364
is not necessary. See
https://github.com/open-telemetry/opentelemetry-specification/pull/4290#discussion_r1927546170
for more context.
- It is going be an example for
https://github.com/open-telemetry/opentelemetry-specification/issues/4363

There is a little overhead (IMO totally acceptable) because of data
transformation. Most importantly, there is no new heap allocation.

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
                 │   old.txt   │                 new.txt                  │
                 │   sec/op    │     sec/op      vs base                  │
LoggerEnabled-20   4.589n ± 1%   319.750n ± 16%  +6867.75% (p=0.000 n=10)

                 │   old.txt    │             new.txt             │
                 │     B/op     │     B/op       vs base          │
LoggerEnabled-20   0.000Ki ± 0%   1.093Ki ± 13%  ? (p=0.000 n=10)

                 │  old.txt   │            new.txt             │
                 │ allocs/op  │ allocs/op   vs base            │
LoggerEnabled-20   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal
```

`Logger.Enabled` is still more efficient than `Logger.Emit` (benchmarks
from https://github.com/open-telemetry/opentelemetry-go/pull/6315).

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkLoggerEmit/5_attributes-20               559934              2391 ns/op           39088 B/op          1 allocs/op
BenchmarkLoggerEmit/10_attributes-20             1000000              5910 ns/op           49483 B/op          5 allocs/op
BenchmarkLoggerEnabled-20                        1605697               968.7 ns/op          1272 B/op          0 allocs/op
PASS
ok      go.opentelemetry.io/otel/sdk/log        10.789s
```

Prior art:
- https://github.com/open-telemetry/opentelemetry-go/pull/6271
- https://github.com/open-telemetry/opentelemetry-go/pull/6286

I also created for tracking purposes:
- https://github.com/open-telemetry/opentelemetry-go/issues/6328
2025-02-18 22:35:14 +01:00
Robert Pająk
55ff06fbdd sdk/log: Change BenchmarkLoggerNewRecord to BenchmarkLoggerEmit (#6315)
I find having benchmark for `Emit` more useful than just for
`newRecord`.
It can be used to showcase the performance benefit of using `Enabled`
even for a record with 10 attributes.

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkLoggerEmit/5_attributes-20               511827              2609 ns/op           41947 B/op          1 allocs/op
BenchmarkLoggerEmit/10_attributes-20             1000000              3520 ns/op           46905 B/op          5 allocs/op
BenchmarkLoggerEnabled-20                       263691399                4.549 ns/op           0 B/op          0 allocs/op
```

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-02-14 09:40:02 +01:00
Damien Mathieu
f62232fa1b Replace tenv with usetesting (#6313)
The `tenv` linter is deprecated in favor of `usetesting`.
2025-02-13 11:18:37 +01:00
Tyler Yahn
3c1286a9ea Document and check resource comparability (#6272)
Ensure backwards compatibility by adding a compile-time check that the
Resource remains comparable.

Document the shortcomings of direct comparison of a Resource.

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2025-02-12 08:35:25 -08:00
renovate[bot]
afbe5458b0 fix(deps): update module github.com/golangci/golangci-lint to v1.64.2 (#6301) 2025-02-12 12:23:12 +01:00
Sam Xie
d46bfb04fe Fix comment of the RecordOnly sampling decision (#6257)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-02-06 10:06:15 -08:00
renovate[bot]
6b3868ec4b fix(deps): update golang.org/x (#6249)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence | Type |
Update |
|---|---|---|---|---|---|---|---|
| golang.org/x/mod | `v0.22.0` -> `v0.23.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fmod/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fmod/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fmod/v0.22.0/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fmod/v0.22.0/v0.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sync | `v0.10.0` -> `v0.11.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsync/v0.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsync/v0.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsync/v0.10.0/v0.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsync/v0.10.0/v0.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sys | `v0.29.0` -> `v0.30.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.29.0/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.29.0/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | minor |
| golang.org/x/sys | `v0.29.0` -> `v0.30.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fsys/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fsys/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fsys/v0.29.0/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fsys/v0.29.0/v0.30.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| require | minor |
| golang.org/x/telemetry | `04cd7ba` -> `60cba7f` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftelemetry/v0.0.0-20250204155029-60cba7f74efa?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2ftelemetry/v0.0.0-20250204155029-60cba7f74efa?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2ftelemetry/v0.0.0-20250117155846-04cd7bae618c/v0.0.0-20250204155029-60cba7f74efa?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftelemetry/v0.0.0-20250117155846-04cd7bae618c/v0.0.0-20250204155029-60cba7f74efa?slim=true)](https://docs.renovatebot.com/merge-confidence/)
| indirect | digest |

---

### 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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNDUuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE0NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 17:13:41 +01:00
Robert Pająk
078a4a844f sdk/log: Assign fltrProcessors on provider creation instead of lazy (#6239)
I think it is better to calculate fltrProcessors upfront instead of
doing it in a lazy manner. Reasons:

- No locks/synchronization in the hot-path. Even though the performance
overhead is not big (in practice it will be usually unnoticeable, in my
benchmark execution it is less than a nanosecond) I think it is good to
minimize locking on the hot path.
- Simpler code (subjective, but at least less code by 9 lines)

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
                 │   old.txt   │               new.txt               │
                 │   sec/op    │   sec/op     vs base                │
LoggerEnabled-20   6.010n ± 1%   5.364n ± 1%  -10.73% (p=0.000 n=10)

                 │  old.txt   │            new.txt             │
                 │    B/op    │    B/op     vs base            │
LoggerEnabled-20   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

                 │  old.txt   │            new.txt             │
                 │ allocs/op  │ allocs/op   vs base            │
LoggerEnabled-20   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal
```
2025-02-04 14:38:10 +01:00
Robert Pająk
62e4225a42 sdk/log: Add EventName (#6193)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6183
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6184

Towards https://github.com/open-telemetry/opentelemetry-go/issues/6181

Prior-art: https://github.com/open-telemetry/opentelemetry-go/pull/6018
2025-01-22 17:46:47 +01:00