Skip to content

Commit 4cb8459

Browse files
authored
Merge branch 'main' into dedup-keyvals-in-log-body
2 parents 5cddc9a + 4268202 commit 4cb8459

File tree

148 files changed

+486
-514
lines changed

Some content is hidden

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

148 files changed

+486
-514
lines changed

.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@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
35+
uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
3636
with:
3737
languages: go
3838

3939
- name: Autobuild
40-
uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
40+
uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
4141

4242
- name: Perform CodeQL Analysis
43-
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
43+
uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
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@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
61+
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
6262
with:
6363
sarif_file: results.sarif

.golangci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ linters:
1010
- depguard
1111
- errcheck
1212
- errorlint
13+
- gocritic
1314
- godot
1415
- gosec
1516
- govet
@@ -86,6 +87,20 @@ linters:
8687
deny:
8788
- pkg: go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal
8889
desc: Do not use cross-module internal packages.
90+
gocritic:
91+
disabled-checks:
92+
- appendAssign
93+
- commentedOutCode
94+
- dupArg
95+
- hugeParam
96+
- importShadow
97+
- paramTypeCombine
98+
- ptrToRefParam
99+
- preferDecodeRune
100+
- rangeValCopy
101+
- unnamedResult
102+
- whyNoLint
103+
enable-all: true
89104
godot:
90105
exclude:
91106
# Exclude links.
@@ -168,6 +183,7 @@ linters:
168183
- fmt.Printf
169184
- fmt.Println
170185
- name: unnecessary-stmt
186+
- name: use-any
171187
- name: useless-break
172188
- name: var-declaration
173189
- name: var-naming
@@ -224,10 +240,6 @@ linters:
224240
- linters:
225241
- gosec
226242
text: 'G402: TLS MinVersion too low.'
227-
paths:
228-
- third_party$
229-
- builtin$
230-
- examples$
231243
issues:
232244
max-issues-per-linter: 0
233245
max-same-issues: 0
@@ -244,7 +256,3 @@ formatters:
244256
max-len: 120
245257
exclusions:
246258
generated: lax
247-
paths:
248-
- third_party$
249-
- builtin$
250-
- examples$

.lycheeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ https://github.com/open-telemetry/opentelemetry-go/projects
66
https?:\/\/github\.com\/open-telemetry\/semantic-conventions\/archive\/refs\/tags\/[^.]+\.zip\[[^]]+]
77
file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries
88
file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual
9+
http://4.3.2.1:78/user/123

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
5353

5454
- Change `AssertEqual` in `go.opentelemetry.io/otel/log/logtest` to accept `TestingT` in order to support benchmarks and fuzz tests. (#6908)
5555
- Change `SDKProcessorLogQueueCapacity`, `SDKProcessorLogQueueSize`, `SDKProcessorSpanQueueSize`, and `SDKProcessorSpanQueueCapacity` in `go.opentelemetry.io/otel/semconv/v1.36.0/otelconv` to use a `Int64ObservableUpDownCounter`. (#7041)
56+
- Change `DefaultExemplarReservoirProviderSelector` in `go.opentelemetry.io/otel/sdk/metric` to use `runtime.GOMAXPROCS(0)` instead of `runtime.NumCPU()` for the `FixedSizeReservoirProvider` default size. (#7094)
5657

5758
### Fixes
5859

attribute/encoder.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func DefaultEncoder() Encoder {
7878
defaultEncoderOnce.Do(func() {
7979
defaultEncoderInstance = &defaultAttrEncoder{
8080
pool: sync.Pool{
81-
New: func() interface{} {
81+
New: func() any {
8282
return &bytes.Buffer{}
8383
},
8484
},
@@ -96,11 +96,11 @@ func (d *defaultAttrEncoder) Encode(iter Iterator) string {
9696
for iter.Next() {
9797
i, keyValue := iter.IndexedAttribute()
9898
if i > 0 {
99-
_, _ = buf.WriteRune(',')
99+
_ = buf.WriteByte(',')
100100
}
101101
copyAndEscape(buf, string(keyValue.Key))
102102

103-
_, _ = buf.WriteRune('=')
103+
_ = buf.WriteByte('=')
104104

105105
if keyValue.Value.Type() == STRING {
106106
copyAndEscape(buf, keyValue.Value.AsString())
@@ -122,7 +122,7 @@ func copyAndEscape(buf *bytes.Buffer, val string) {
122122
for _, ch := range val {
123123
switch ch {
124124
case '=', ',', escapeChar:
125-
_, _ = buf.WriteRune(escapeChar)
125+
_ = buf.WriteByte(escapeChar)
126126
}
127127
_, _ = buf.WriteRune(ch)
128128
}

attribute/filter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Filter func(KeyValue) bool
1515
//
1616
// If keys is empty a deny-all filter is returned.
1717
func NewAllowKeysFilter(keys ...Key) Filter {
18-
if len(keys) <= 0 {
18+
if len(keys) == 0 {
1919
return func(kv KeyValue) bool { return false }
2020
}
2121

@@ -34,7 +34,7 @@ func NewAllowKeysFilter(keys ...Key) Filter {
3434
//
3535
// If keys is empty an allow-all filter is returned.
3636
func NewDenyKeysFilter(keys ...Key) Filter {
37-
if len(keys) <= 0 {
37+
if len(keys) == 0 {
3838
return func(kv KeyValue) bool { return true }
3939
}
4040

attribute/internal/attribute.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,39 @@ import (
1212
)
1313

1414
// BoolSliceValue converts a bool slice into an array with same elements as slice.
15-
func BoolSliceValue(v []bool) interface{} {
15+
func BoolSliceValue(v []bool) any {
1616
var zero bool
1717
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
1818
reflect.Copy(cp, reflect.ValueOf(v))
1919
return cp.Interface()
2020
}
2121

2222
// Int64SliceValue converts an int64 slice into an array with same elements as slice.
23-
func Int64SliceValue(v []int64) interface{} {
23+
func Int64SliceValue(v []int64) any {
2424
var zero int64
2525
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
2626
reflect.Copy(cp, reflect.ValueOf(v))
2727
return cp.Interface()
2828
}
2929

3030
// Float64SliceValue converts a float64 slice into an array with same elements as slice.
31-
func Float64SliceValue(v []float64) interface{} {
31+
func Float64SliceValue(v []float64) any {
3232
var zero float64
3333
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
3434
reflect.Copy(cp, reflect.ValueOf(v))
3535
return cp.Interface()
3636
}
3737

3838
// StringSliceValue converts a string slice into an array with same elements as slice.
39-
func StringSliceValue(v []string) interface{} {
39+
func StringSliceValue(v []string) any {
4040
var zero string
4141
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
4242
reflect.Copy(cp, reflect.ValueOf(v))
4343
return cp.Interface()
4444
}
4545

4646
// AsBoolSlice converts a bool array into a slice into with same elements as array.
47-
func AsBoolSlice(v interface{}) []bool {
47+
func AsBoolSlice(v any) []bool {
4848
rv := reflect.ValueOf(v)
4949
if rv.Type().Kind() != reflect.Array {
5050
return nil
@@ -57,7 +57,7 @@ func AsBoolSlice(v interface{}) []bool {
5757
}
5858

5959
// AsInt64Slice converts an int64 array into a slice into with same elements as array.
60-
func AsInt64Slice(v interface{}) []int64 {
60+
func AsInt64Slice(v any) []int64 {
6161
rv := reflect.ValueOf(v)
6262
if rv.Type().Kind() != reflect.Array {
6363
return nil
@@ -70,7 +70,7 @@ func AsInt64Slice(v interface{}) []int64 {
7070
}
7171

7272
// AsFloat64Slice converts a float64 array into a slice into with same elements as array.
73-
func AsFloat64Slice(v interface{}) []float64 {
73+
func AsFloat64Slice(v any) []float64 {
7474
rv := reflect.ValueOf(v)
7575
if rv.Type().Kind() != reflect.Array {
7676
return nil
@@ -83,7 +83,7 @@ func AsFloat64Slice(v interface{}) []float64 {
8383
}
8484

8585
// AsStringSlice converts a string array into a slice into with same elements as array.
86-
func AsStringSlice(v interface{}) []string {
86+
func AsStringSlice(v any) []string {
8787
rv := reflect.ValueOf(v)
8888
if rv.Type().Kind() != reflect.Array {
8989
return nil

attribute/internal/attribute_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,50 @@ import (
88
"testing"
99
)
1010

11-
var wrapFloat64SliceValue = func(v interface{}) interface{} {
11+
var wrapFloat64SliceValue = func(v any) any {
1212
if vi, ok := v.([]float64); ok {
1313
return Float64SliceValue(vi)
1414
}
1515
return nil
1616
}
1717

18-
var wrapInt64SliceValue = func(v interface{}) interface{} {
18+
var wrapInt64SliceValue = func(v any) any {
1919
if vi, ok := v.([]int64); ok {
2020
return Int64SliceValue(vi)
2121
}
2222
return nil
2323
}
2424

25-
var wrapBoolSliceValue = func(v interface{}) interface{} {
25+
var wrapBoolSliceValue = func(v any) any {
2626
if vi, ok := v.([]bool); ok {
2727
return BoolSliceValue(vi)
2828
}
2929
return nil
3030
}
3131

32-
var wrapStringSliceValue = func(v interface{}) interface{} {
32+
var wrapStringSliceValue = func(v any) any {
3333
if vi, ok := v.([]string); ok {
3434
return StringSliceValue(vi)
3535
}
3636
return nil
3737
}
3838

3939
var (
40-
wrapAsBoolSlice = func(v interface{}) interface{} { return AsBoolSlice(v) }
41-
wrapAsInt64Slice = func(v interface{}) interface{} { return AsInt64Slice(v) }
42-
wrapAsFloat64Slice = func(v interface{}) interface{} { return AsFloat64Slice(v) }
43-
wrapAsStringSlice = func(v interface{}) interface{} { return AsStringSlice(v) }
40+
wrapAsBoolSlice = func(v any) any { return AsBoolSlice(v) }
41+
wrapAsInt64Slice = func(v any) any { return AsInt64Slice(v) }
42+
wrapAsFloat64Slice = func(v any) any { return AsFloat64Slice(v) }
43+
wrapAsStringSlice = func(v any) any { return AsStringSlice(v) }
4444
)
4545

4646
func TestSliceValue(t *testing.T) {
4747
type args struct {
48-
v interface{}
48+
v any
4949
}
5050
tests := []struct {
5151
name string
5252
args args
53-
want interface{}
54-
fn func(interface{}) interface{}
53+
want any
54+
fn func(any) any
5555
}{
5656
{
5757
name: "Float64SliceValue() two items",
@@ -136,7 +136,7 @@ func BenchmarkStringSliceValue(b *testing.B) {
136136

137137
func BenchmarkAsFloat64Slice(b *testing.B) {
138138
b.ReportAllocs()
139-
var in interface{} = [2]float64{1, 2.3}
139+
var in any = [2]float64{1, 2.3}
140140
b.ResetTimer()
141141

142142
for i := 0; i < b.N; i++ {

attribute/key_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestDefined(t *testing.T) {
4040
}
4141

4242
func TestJSONValue(t *testing.T) {
43-
var kvs interface{} = [2]attribute.KeyValue{
43+
var kvs any = [2]attribute.KeyValue{
4444
attribute.String("A", "B"),
4545
attribute.Int64("C", 1),
4646
}

0 commit comments

Comments
 (0)