Skip to content

Commit

Permalink
Merge branch 'main' into otlpexporter
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Sep 12, 2024
2 parents b6e723e + 2166b11 commit ac925ba
Show file tree
Hide file tree
Showing 152 changed files with 904 additions and 1,177 deletions.
20 changes: 20 additions & 0 deletions .chloggen/6767-exporterhelper-rename-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'deprecation'

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: exporterhelper

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Deprecate TimeoutSettings/QueueSettings in favor of TimeoutConfig/QueueConfig."

# One or more tracking issues or pull requests related to the change
issues: [6767]

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/codeboten_fix-bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: service

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Ensure process telemetry is registered when internal telemetry is configured with readers instead of an address.

# One or more tracking issues or pull requests related to the change
issues: [11093]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,9 @@ linters-settings:
testifylint:
# TODO: enable all rules
disable:
- compares
- error-is-as
- expected-actual
- float-compare
- formatter
- go-require
- negative-positive
- require-error
enable-all: true

Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SEMCONVGEN := $(TOOLS_BIN_DIR)/semconvgen
SEMCONVKIT := $(TOOLS_BIN_DIR)/semconvkit
TESTIFYLINT := $(TOOLS_BIN_DIR)/testifylint

TESTIFYLINT_OPT?= --enable-all --disable=compares,error-is-as,expected-actual,float-compare,formatter,go-require,negative-positive,require-error
TESTIFYLINT_OPT?= --enable-all --disable=float-compare,formatter,go-require,require-error

.PHONY: install-tools
install-tools: $(TOOLS_BIN_NAMES)
Expand Down
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestFromContext(t *testing.T) {
}
for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
assert.Equal(t, FromContext(tC.input), tC.expected)
assert.Equal(t, tC.expected, FromContext(tC.input))
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/builder/internal/builder/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package builder

import (
"errors"
"os"
"strings"
"testing"
Expand Down Expand Up @@ -143,7 +142,7 @@ func TestMissingModule(t *testing.T) {
}

for _, test := range configurations {
assert.True(t, errors.Is(test.cfg.Validate(), test.err))
assert.ErrorIs(t, test.cfg.Validate(), test.err)
}
}

Expand Down
6 changes: 0 additions & 6 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,8 @@ replace go.opentelemetry.io/collector/receiver => ../../receiver

replace go.opentelemetry.io/collector/semconv => ../../semconv

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector => ../..

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

retract (
Expand All @@ -98,6 +94,4 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus

replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion cmd/mdatagen/templates/metrics_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestMetricsBuilder(t *testing.T) {
assert.Equal(t, "{{ $metric.Description }}", ms.At(i).Description())
assert.Equal(t, "{{ $metric.Unit }}", ms.At(i).Unit())
{{- if $metric.Data.HasMonotonic }}
assert.Equal(t, {{ $metric.Data.Monotonic }}, ms.At(i).{{ $metric.Data.Type }}().IsMonotonic())
assert.{{- if $metric.Data.Monotonic }}True{{ else }}False{{ end }}(t, ms.At(i).{{ $metric.Data.Type }}().IsMonotonic())
{{- end }}
{{- if $metric.Data.HasAggregated }}
assert.Equal(t, pmetric.AggregationTemporality{{ $metric.Data.AggregationTemporality }}, ms.At(i).{{ $metric.Data.Type }}().AggregationTemporality())
Expand All @@ -178,7 +178,11 @@ func TestMetricsBuilder(t *testing.T) {
{{- range $i, $attr := $metric.Attributes }}
attrVal, ok {{ if eq $i 0 }}:{{ end }}= dp.Attributes().Get("{{ (attributeInfo $attr).Name }}")
assert.True(t, ok)
{{- if eq (attributeInfo $attr).Type.String "Bool"}}
assert.{{- if (attributeInfo $attr).TestValue }}True{{ else }}False{{- end }}(t, attrVal.{{ (attributeInfo $attr).Type }}()
{{- else }}
assert.EqualValues(t, {{ (attributeInfo $attr).TestValue }}, attrVal.{{ (attributeInfo $attr).Type }}()
{{- end }}
{{- if or (eq (attributeInfo $attr).Type.String "Slice") (eq (attributeInfo $attr).Type.String "Map")}}.AsRaw(){{ end }})
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module go.opentelemetry.io/collector/cmd/otelcorecol

go 1.22.0

toolchain go1.22.7
toolchain go1.23.1

require (
go.opentelemetry.io/collector/component v0.109.0
Expand Down
2 changes: 1 addition & 1 deletion component/componenttest/nop_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ func TestNewNopTelemetrySettings(t *testing.T) {
nts.MeterProvider.Meter("test")
})
assert.Equal(t, configtelemetry.LevelNone, nts.MetricsLevel)
assert.Equal(t, nts.Resource.Attributes().Len(), 0)
assert.Equal(t, 0, nts.Resource.Attributes().Len())
}
8 changes: 4 additions & 4 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/auth/authtest"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/internal/localhostgate"
"go.opentelemetry.io/collector/internal/globalgates"
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
)

Expand Down Expand Up @@ -494,11 +494,11 @@ func TestUseSecure(t *testing.T) {
}

func TestGRPCServerWarning(t *testing.T) {
prev := localhostgate.UseLocalHostAsDefaultHostfeatureGate.IsEnabled()
require.NoError(t, featuregate.GlobalRegistry().Set(localhostgate.UseLocalHostAsDefaultHostID, false))
prev := globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled()
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, false))
defer func() {
// Restore previous value.
require.NoError(t, featuregate.GlobalRegistry().Set(localhostgate.UseLocalHostAsDefaultHostID, prev))
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, prev))
}()

tests := []struct {
Expand Down
12 changes: 2 additions & 10 deletions config/configgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.22.0
require (
github.com/mostynb/go-grpc-compression v1.2.3
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector v0.109.0
go.opentelemetry.io/collector/client v1.15.0
go.opentelemetry.io/collector/component v0.109.0
go.opentelemetry.io/collector/config/configauth v0.109.0
Expand All @@ -17,6 +16,7 @@ require (
go.opentelemetry.io/collector/config/internal v0.109.0
go.opentelemetry.io/collector/extension/auth v0.109.0
go.opentelemetry.io/collector/featuregate v1.15.0
go.opentelemetry.io/collector/internal/globalgates v0.109.0
go.opentelemetry.io/collector/pdata v1.15.0
go.opentelemetry.io/collector/pdata/testdata v0.109.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0
Expand Down Expand Up @@ -63,8 +63,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace go.opentelemetry.io/collector => ../../

replace go.opentelemetry.io/collector/client => ../../client

replace go.opentelemetry.io/collector/config/configauth => ../configauth
Expand All @@ -85,8 +83,6 @@ replace go.opentelemetry.io/collector/extension => ../../extension

replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/confmap => ../../confmap

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/pdata => ../../pdata
Expand All @@ -99,8 +95,4 @@ replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates
4 changes: 2 additions & 2 deletions config/configgrpc/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/auth/authtest"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/internal/localhostgate"
"go.opentelemetry.io/collector/internal/globalgates"
)

type customRoundTripper struct {
Expand Down Expand Up @@ -520,11 +520,11 @@ func TestHTTPServerSettingsError(t *testing.T) {
}

func TestHTTPServerWarning(t *testing.T) {
prev := localhostgate.UseLocalHostAsDefaultHostfeatureGate.IsEnabled()
require.NoError(t, featuregate.GlobalRegistry().Set(localhostgate.UseLocalHostAsDefaultHostID, false))
prev := globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled()
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, false))
defer func() {
// Restore previous value.
require.NoError(t, featuregate.GlobalRegistry().Set(localhostgate.UseLocalHostAsDefaultHostID, prev))
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, prev))
}()

tests := []struct {
Expand Down Expand Up @@ -1249,8 +1249,8 @@ func TestFailedServerAuth(t *testing.T) {
srv.Handler.ServeHTTP(response, httptest.NewRequest("GET", "/", nil))

// verify
assert.Equal(t, response.Result().StatusCode, http.StatusUnauthorized)
assert.Equal(t, response.Result().Status, fmt.Sprintf("%v %s", http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized)))
assert.Equal(t, http.StatusUnauthorized, response.Result().StatusCode)
assert.Equal(t, fmt.Sprintf("%v %s", http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized)), response.Result().Status)
}

func TestServerWithErrorHandler(t *testing.T) {
Expand All @@ -1259,7 +1259,7 @@ func TestServerWithErrorHandler(t *testing.T) {
Endpoint: "localhost:0",
}
eh := func(w http.ResponseWriter, _ *http.Request, _ string, statusCode int) {
assert.Equal(t, statusCode, http.StatusBadRequest)
assert.Equal(t, http.StatusBadRequest, statusCode)
// custom error handler changes returned status code
http.Error(w, "invalid request", http.StatusInternalServerError)
}
Expand All @@ -1281,7 +1281,7 @@ func TestServerWithErrorHandler(t *testing.T) {

srv.Handler.ServeHTTP(response, req)
// verify
assert.Equal(t, response.Result().StatusCode, http.StatusInternalServerError)
assert.Equal(t, http.StatusInternalServerError, response.Result().StatusCode)
}

func TestServerWithDecoder(t *testing.T) {
Expand Down Expand Up @@ -1309,7 +1309,7 @@ func TestServerWithDecoder(t *testing.T) {

srv.Handler.ServeHTTP(response, req)
// verify
assert.Equal(t, response.Result().StatusCode, http.StatusOK)
assert.Equal(t, http.StatusOK, response.Result().StatusCode)

}

Expand Down Expand Up @@ -1356,7 +1356,7 @@ func TestServerWithDecompression(t *testing.T) {

// verifications is done mostly within the test, but this is only a sanity check
// that we got into the test handler
assert.Equal(t, resp.StatusCode, http.StatusBadRequest)
assert.Equal(t, http.StatusBadRequest, resp.StatusCode)
}

func TestDefaultMaxRequestBodySize(t *testing.T) {
Expand Down
12 changes: 2 additions & 10 deletions config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/klauspost/compress v1.17.9
github.com/rs/cors v1.11.1
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector v0.109.0
go.opentelemetry.io/collector/client v1.15.0
go.opentelemetry.io/collector/component v0.109.0
go.opentelemetry.io/collector/config/configauth v0.109.0
Expand All @@ -18,6 +17,7 @@ require (
go.opentelemetry.io/collector/config/internal v0.109.0
go.opentelemetry.io/collector/extension/auth v0.109.0
go.opentelemetry.io/collector/featuregate v1.15.0
go.opentelemetry.io/collector/internal/globalgates v0.109.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0
go.opentelemetry.io/otel v1.30.0
go.opentelemetry.io/otel/metric v1.30.0
Expand Down Expand Up @@ -58,8 +58,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace go.opentelemetry.io/collector => ../../

replace go.opentelemetry.io/collector/config/configauth => ../configauth

replace go.opentelemetry.io/collector/config/configcompression => ../configcompression
Expand All @@ -76,8 +74,6 @@ replace go.opentelemetry.io/collector/extension => ../../extension

replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/confmap => ../../confmap

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/pdata => ../../pdata
Expand All @@ -92,8 +88,4 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates
Loading

0 comments on commit ac925ba

Please sign in to comment.