Skip to content

Commit 7c49f9b

Browse files
committed
merge main to cur
2 parents ea73c6b + fdf7bec commit 7c49f9b

File tree

65 files changed

+974
-511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+974
-511
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
with:
125125
pattern: coverage-artifacts-${{ env.DEFAULT_GO_VERSION }}
126126
- name: Upload coverage report
127-
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
127+
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
128128
with:
129129
fail_ci_if_error: true
130130
files: ./coverage.txt

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232

3333
# Initializes the CodeQL tools for scanning.
3434
- name: Initialize CodeQL
35-
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
35+
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3
3636
with:
3737
languages: go
3838

3939
- name: Autobuild
40-
uses: github/codeql-action/autobuild@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
40+
uses: github/codeql-action/autobuild@45775bd8235c68ba998cffa5171334d58593da47 # v3
4141

4242
- name: Perform CodeQL Analysis
43-
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
43+
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3
4444

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ jobs:
5858
# Upload the results to GitHub's code scanning dashboard (optional).
5959
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
6060
- name: "Upload to code-scanning"
61-
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
61+
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3
6262
with:
6363
sarif_file: results.sarif

CHANGELOG.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
88

99
## [Unreleased]
1010

11-
> [!WARNING]
12-
> This is the last version to support `model.LegacyValidation` for
13-
> `go.opentelemetry.io/otel/exporters/prometheus`.
14-
> The next version (v0.59.0) will only support the default `model.UTF8Validation`.
15-
>
16-
> See also [Change default validation scheme to UTF8Validation](https://github.com/prometheus/common/pull/724)
17-
> in the prometheus repository.
18-
1911
### Added
2012

2113
- Add exponential histogram support in `go.opentelemetry.io/otel/exporters/prometheus`. (#6421)
2214
- The `go.opentelemetry.io/otel/semconv/v1.31.0` package.
2315
The package contains semantic conventions from the `v1.31.0` version of the OpenTelemetry Semantic Conventions.
2416
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)
17+
- Add `Recording`, `Scope`, and `Record` types in `go.opentelemetry.io/otel/log/logtest`. (#6507)
2518

2619
### Removed
2720

2821
- Drop support for [Go 1.22]. (#6381, #6418)
2922
- Remove `Resource` field from `EnabledParameters` in `go.opentelemetry.io/otel/sdk/log`. (#6494)
3023
- Remove `RecordFactory` type from `go.opentelemetry.io/otel/log/logtest`. (#6492)
24+
- Remove `ScopeRecords`, `EmittedRecord`, and `RecordFactory` types from `go.opentelemetry.io/otel/log/logtest`. (#6507)
3125

3226
### Changed
3327

@@ -37,6 +31,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3731
- Initialize map with `len(keys)` in `NewAllowKeysFilter` and `NewDenyKeysFilter` to avoid unnecessary allocations in `go.opentelemetry.io/otel/attribute`. (#6455)
3832
- `go.opentelemetry.io/otel/log/logtest` is now a separate Go module. (#6465)
3933
- `go.opentelemetry.io/otel/sdk/log/logtest` is now a separate Go module. (#6466)
34+
- `Recorder` in `go.opentelemetry.io/otel/log/logtest` no longer separately stores records emitted by loggers with the same instrumentation scope. (#6507)
35+
- Improve performance of `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` by not exporting when exporter cannot accept more. (#6569, #6641)
4036

4137
### Deprecated
4238

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink
4343
SEMCONVKIT = $(TOOLS)/semconvkit
4444
$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit
4545

46+
VERIFYREADMES = $(TOOLS)/verifyreadmes
47+
$(TOOLS)/verifyreadmes: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/verifyreadmes
48+
4649
GOLANGCI_LINT = $(TOOLS)/golangci-lint
4750
$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/v2/cmd/golangci-lint
4851

@@ -68,7 +71,7 @@ GOVULNCHECK = $(TOOLS)/govulncheck
6871
$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck
6972

7073
.PHONY: tools
71-
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE)
74+
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(SEMCONVGEN) $(VERIFYREADMES) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE)
7275

7376
# Virtualized python tools via docker
7477

@@ -322,5 +325,5 @@ lint-markdown:
322325
docker run --rm -u $(DOCKER_USER) -v "$(CURDIR):$(WORKDIR)" $(MARKDOWNIMAGE) -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md
323326

324327
.PHONY: verify-readmes
325-
verify-readmes:
326-
./verify_readmes.sh
328+
verify-readmes: $(VERIFYREADMES)
329+
$(VERIFYREADMES)

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Importantly, bump any package versions referenced to be the latest one you just
132132
Once a release is made, ensure all issues that were fixed and PRs that were merged as part of this release are added to the corresponding milestone.
133133
This helps track what changes were included in each release.
134134
135-
- To find issues that haven't been included in a milestone, use this [GitHub search query](https://github.com/open-telemetry/opentelemetry-go/issues?q=is%3Aissue%20no%3Amilestone%20is%3Aclosed%20sort%3Aupdated-desc).
135+
- To find issues that haven't been included in a milestone, use this [GitHub search query](https://github.com/open-telemetry/opentelemetry-go/issues?q=is%3Aissue%20no%3Amilestone%20is%3Aclosed%20sort%3Aupdated-desc%20reason%3Acompleted%20-label%3AStale%20linked%3Apr)
136136
- To find merged PRs that haven't been included in a milestone, use this [GitHub search query](https://github.com/open-telemetry/opentelemetry-go/pulls?q=is%3Apr+no%3Amilestone+is%3Amerged).
137137
138138
Once all related issues and PRs have been added to the milestone, close the milestone.

attribute/rawhelpers.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package attribute // import "go.opentelemetry.io/otel/attribute"
5+
6+
import (
7+
"math"
8+
)
9+
10+
func boolToRaw(b bool) uint64 { // nolint:revive // b is not a control flag.
11+
if b {
12+
return 1
13+
}
14+
return 0
15+
}
16+
17+
func rawToBool(r uint64) bool {
18+
return r != 0
19+
}
20+
21+
func int64ToRaw(i int64) uint64 {
22+
// Assumes original was a valid int64 (overflow not checked).
23+
return uint64(i) // nolint: gosec
24+
}
25+
26+
func rawToInt64(r uint64) int64 {
27+
// Assumes original was a valid int64 (overflow not checked).
28+
return int64(r) // nolint: gosec
29+
}
30+
31+
func float64ToRaw(f float64) uint64 {
32+
return math.Float64bits(f)
33+
}
34+
35+
func rawToFloat64(r uint64) float64 {
36+
return math.Float64frombits(r)
37+
}

attribute/value.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"strconv"
1111

1212
attribute "go.opentelemetry.io/otel/attribute/internal"
13-
"go.opentelemetry.io/otel/internal"
1413
)
1514

1615
//go:generate stringer -type=Type
@@ -51,7 +50,7 @@ const (
5150
func BoolValue(v bool) Value {
5251
return Value{
5352
vtype: BOOL,
54-
numeric: internal.BoolToRaw(v),
53+
numeric: boolToRaw(v),
5554
}
5655
}
5756

@@ -82,7 +81,7 @@ func IntSliceValue(v []int) Value {
8281
func Int64Value(v int64) Value {
8382
return Value{
8483
vtype: INT64,
85-
numeric: internal.Int64ToRaw(v),
84+
numeric: int64ToRaw(v),
8685
}
8786
}
8887

@@ -95,7 +94,7 @@ func Int64SliceValue(v []int64) Value {
9594
func Float64Value(v float64) Value {
9695
return Value{
9796
vtype: FLOAT64,
98-
numeric: internal.Float64ToRaw(v),
97+
numeric: float64ToRaw(v),
9998
}
10099
}
101100

@@ -125,7 +124,7 @@ func (v Value) Type() Type {
125124
// AsBool returns the bool value. Make sure that the Value's type is
126125
// BOOL.
127126
func (v Value) AsBool() bool {
128-
return internal.RawToBool(v.numeric)
127+
return rawToBool(v.numeric)
129128
}
130129

131130
// AsBoolSlice returns the []bool value. Make sure that the Value's type is
@@ -144,7 +143,7 @@ func (v Value) asBoolSlice() []bool {
144143
// AsInt64 returns the int64 value. Make sure that the Value's type is
145144
// INT64.
146145
func (v Value) AsInt64() int64 {
147-
return internal.RawToInt64(v.numeric)
146+
return rawToInt64(v.numeric)
148147
}
149148

150149
// AsInt64Slice returns the []int64 value. Make sure that the Value's type is
@@ -163,7 +162,7 @@ func (v Value) asInt64Slice() []int64 {
163162
// AsFloat64 returns the float64 value. Make sure that the Value's
164163
// type is FLOAT64.
165164
func (v Value) AsFloat64() float64 {
166-
return internal.RawToFloat64(v.numeric)
165+
return rawToFloat64(v.numeric)
167166
}
168167

169168
// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is

bridge/opencensus/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/pmezard/go-difflib v1.0.0 // indirect
2121
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
2222
go.opentelemetry.io/otel/metric v1.35.0 // indirect
23-
golang.org/x/sys v0.31.0 // indirect
23+
golang.org/x/sys v0.32.0 // indirect
2424
gopkg.in/yaml.v3 v3.0.1 // indirect
2525
)
2626

bridge/opencensus/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
8383
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
8484
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
8585
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
86-
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
87-
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
86+
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
87+
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
8888
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
8989
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
9090
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

bridge/opencensus/test/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
1919
go.opentelemetry.io/otel/metric v1.35.0 // indirect
2020
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
21-
golang.org/x/sys v0.31.0 // indirect
21+
golang.org/x/sys v0.32.0 // indirect
2222
)
2323

2424
replace go.opentelemetry.io/otel => ../../..

bridge/opencensus/test/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
7777
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
7878
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7979
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
80-
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
81-
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
80+
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
81+
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
8282
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
8383
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
8484
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

bridge/opencensus/trace_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import (
1010
"github.com/stretchr/testify/assert"
1111
"github.com/stretchr/testify/require"
1212

13+
octrace "go.opencensus.io/trace"
14+
1315
"go.opentelemetry.io/otel/sdk/trace"
1416
"go.opentelemetry.io/otel/sdk/trace/tracetest"
17+
oteltrace "go.opentelemetry.io/otel/trace"
1518
)
1619

1720
func TestNewTraceBridge(t *testing.T) {
@@ -26,3 +29,18 @@ func TestNewTraceBridge(t *testing.T) {
2629
assert.Equal(t, scopeName, gotSpan.InstrumentationScope.Name)
2730
assert.Equal(t, gotSpan.InstrumentationScope.Version, Version())
2831
}
32+
33+
func TestOCSpanContextToOTel(t *testing.T) {
34+
input := octrace.SpanContext{
35+
TraceID: [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
36+
SpanID: [8]byte{1, 2, 3, 4, 5, 6, 7, 8},
37+
TraceOptions: octrace.TraceOptions(1),
38+
}
39+
want := oteltrace.NewSpanContext(oteltrace.SpanContextConfig{
40+
TraceID: oteltrace.TraceID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
41+
SpanID: oteltrace.SpanID{1, 2, 3, 4, 5, 6, 7, 8},
42+
TraceFlags: oteltrace.TraceFlags(1),
43+
})
44+
got := OCSpanContextToOTel(input)
45+
assert.Equal(t, want, got)
46+
}

bridge/opentracing/bridge_test.go

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"go.opentelemetry.io/otel"
2222
"go.opentelemetry.io/otel/attribute"
2323
"go.opentelemetry.io/otel/bridge/opentracing/internal"
24-
"go.opentelemetry.io/otel/codes"
2524
"go.opentelemetry.io/otel/propagation"
2625
"go.opentelemetry.io/otel/trace"
2726
)
@@ -473,54 +472,53 @@ func TestBridgeSpan_SetTag(t *testing.T) {
473472

474473
testCases := []struct {
475474
name string
476-
key string
477-
value interface{}
478-
expected attribute.KeyValue
475+
tagKey string
476+
tagValue any
477+
expected any
479478
}{
480-
// span kind is ignored
481479
{
482-
name: "span kind",
483-
key: string(ext.SpanKind),
484-
value: "span kind",
480+
name: "basic string key / value",
481+
tagKey: "key",
482+
tagValue: "value",
483+
expected: attribute.String("key", "value"),
485484
},
486485
{
487-
name: "error tag false",
488-
key: string(ext.Error),
489-
value: false,
486+
name: "tag SpanKind no attribute",
487+
tagKey: "span.kind",
488+
tagValue: "value",
489+
expected: nil,
490490
},
491491
{
492-
name: "error tag true",
493-
key: string(ext.Error),
494-
value: true,
495-
expected: internal.StatusCodeKey.Int(int(codes.Error)),
492+
name: "Error with bool value and set status code 1",
493+
tagKey: "error",
494+
tagValue: true,
495+
expected: attribute.Int64("status.code", 1),
496496
},
497497
{
498-
name: "default tag",
499-
key: "string.key",
500-
value: "string.value",
501-
expected: attribute.String("string.key", "string.value"),
498+
name: "Error with bool but we don't set status code",
499+
tagKey: "error",
500+
tagValue: false,
501+
expected: nil,
502+
},
503+
{
504+
name: "Error with non-bool type but we don't set status code",
505+
tagKey: "error",
506+
tagValue: "false",
507+
expected: nil,
502508
},
503509
}
504510

505511
for _, tc := range testCases {
506512
t.Run(tc.name, func(t *testing.T) {
507513
span := b.StartSpan("test")
508-
span.SetTag(tc.key, tc.value)
509-
mockSpan := span.(*bridgeSpan).otelSpan.(*internal.MockSpan)
510514

511-
if tc.key == string(ext.SpanKind) {
512-
assert.Empty(t, mockSpan.Attributes)
513-
return
514-
}
515-
516-
if tc.key == string(ext.Error) {
517-
if v, ok := tc.value.(bool); !v && ok {
518-
assert.Empty(t, mockSpan.Attributes)
519-
return
520-
}
515+
span.SetTag(tc.tagKey, tc.tagValue)
516+
mockSpan := span.(*bridgeSpan).otelSpan.(*internal.MockSpan)
517+
if tc.expected != nil {
518+
assert.Contains(t, mockSpan.Attributes, tc.expected)
519+
} else {
520+
assert.Nil(t, mockSpan.Attributes)
521521
}
522-
523-
assert.Contains(t, mockSpan.Attributes, tc.expected)
524522
})
525523
}
526524
}

bridge/opentracing/test/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ require (
2727
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
2828
go.opentelemetry.io/otel/metric v1.35.0 // indirect
2929
go.opentelemetry.io/otel/trace v1.35.0 // indirect
30-
golang.org/x/net v0.38.0 // indirect
31-
golang.org/x/sys v0.31.0 // indirect
32-
golang.org/x/text v0.23.0 // indirect
33-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250404141209-ee84b53bf3d0 // indirect
30+
golang.org/x/net v0.39.0 // indirect
31+
golang.org/x/sys v0.32.0 // indirect
32+
golang.org/x/text v0.24.0 // indirect
33+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e // indirect
3434
google.golang.org/protobuf v1.36.6 // indirect
3535
gopkg.in/yaml.v3 v3.0.1 // indirect
3636
)

0 commit comments

Comments
 (0)