Oleksandr Redko
3264bf171b
refactor: modernize code ( #7850 )
...
Enable the
[`modernize`](https://golangci-lint.run/docs/linters/configuration/#modernize )
linter in the golangci-lint configuration and fix the reported issues by
running `golangci-lint run --enable-only modernize --fix`. The
`modernize` linter is internally the same as [gopls
modernize](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize ).
Similar to #7089 .
2026-01-30 18:15:17 +01:00
Flc゛
80cb909774
refactor: replace context.Background() with t.Context()/b.Context() in tests ( #7352 )
...
Based on the Go version we currently use, the dependency already
supports 1.24+, which allows using `t.Context()` and `b.Context()` in
unit tests and benchmarks respectively.
- Enable `context-background` and `context-todo` in
[`usetesting`](https://golangci-lint.run/docs/linters/configuration/#usetesting )
- Adjust the code to support linter detection
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
Co-authored-by: Tyler Yahn <codingalias@gmail.com >
Co-authored-by: Damien Mathieu <42@dmathieu.com >
2025-09-23 09:52:45 +02:00
Matthieu MOREL
68841fa6db
chore: enable unused-receiver rule from revive ( #7130 )
...
#### Description
Enable and fixes
[unused-receiver](https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-receiver )
rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-08-08 15:38:22 -07:00
Matthieu MOREL
6edc7a63df
[chore]: enable expected-actual rule from testifylint ( #5848 )
...
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[expected-actual](https://github.com/Antonboom/testifylint?tab=readme-ov-file#expected-actual )
rule from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-09-26 12:04:33 +02:00
ttoad
86df763d90
trace: Span in noop.Start is no longer allocated ( #5457 )
...
trace/noop/noop.Span should be instance. This will reduce memory waste.
Benchmark results
with changes:
new.txt
```
goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/trace/noop
BenchmarkNoopInstance-10 29894822 39.94 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 29675424 39.99 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 30064700 39.98 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 29962016 40.03 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 30060465 40.02 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 29916855 40.04 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 29829998 40.28 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 30084706 39.99 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 30087441 40.02 ns/op 48 B/op 1 allocs/op
BenchmarkNoopInstance-10 29864365 40.14 ns/op 48 B/op 1 allocs/op
```
without changes on `main`:
old.txt
```
goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/trace/noop
BenchmarkNoopInstance-10 14813442 67.64 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17714486 68.17 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17701257 67.66 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17805859 67.69 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17912841 67.43 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17864120 67.58 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17663130 68.41 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17740423 67.57 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17751040 67.56 ns/op 128 B/op 2 allocs/op
BenchmarkNoopInstance-10 17738064 67.91 ns/op 128 B/op 2 allocs/op
```
benchstat:
```
goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/trace/noop
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
NoopInstance-10 67.65n ± 1% 40.02n ± 0% -40.84% (p=0.000 n=10)
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
NoopInstance-10 128.00 ± 0% 48.00 ± 0% -62.50% (p=0.000 n=10)
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
NoopInstance-10 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10)
```
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2024-06-04 11:14:10 -07:00
qcheng
554282d3e4
trace: Add Span.AddLink method ( #5032 )
2024-03-28 08:35:15 +01:00
Damien Mathieu
edb788bf49
Add READMEs to every package ( #5103 )
2024-03-26 20:13:54 +01:00
Robert Pająk
7dea232a46
[chore] Simplify the license header ( #4987 )
2024-02-29 07:05:28 +01:00
Tyler Yahn
92a13d5a5e
Fix test name in trace/noop pkg ( #4944 )
2024-02-19 13:57:30 +01:00
Tyler Yahn
1e1cc901a5
Add embedded package to trace API ( #4620 )
...
* Add trace/embedded
* Update trace impl to use trace/embedded
* Add noop pkg to replace no-op impl in trace pkg
* Use trace/embedded in global impl
* Use trace/embedded in SDK impl
* Update opencensus bridge
* Update opentracing bridge
* Add changes to changelog
* Update trace/doc.go
Co-authored-by: David Ashpole <dashpole@google.com >
---------
Co-authored-by: David Ashpole <dashpole@google.com >
2023-10-19 10:16:24 -07:00