mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
#### Description Embed `confignet.AddrConfig` in `confighttp.ServerConfig`, replacing the `Endpoint` field. This introduces the "transport" config attribute, which can be set to "unix" for binding a Unix domain socket. #### Link to tracking issue Fixes #8752 Fixes #14187 #### Testing ```bash $ ./bin/otelcorecol_linux_amd64 \ --config examples/local/otel-config.yaml \ --set receivers::otlp::protocols::http::transport=unix \ --set receivers::otlp::protocols::http::endpoint=\"@otlphttp\" ``` ```bash $ curl --abstract-unix-socket otlphttp http://testing.invalid:1234/v1/traces 405 method not allowed, supported: [POST] ``` #### Documentation Updated README.md --------- Co-authored-by: Antoine Toulme <[email protected]>
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package e2e
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"go.opentelemetry.io/collector/config/confighttp"
|
|
"go.opentelemetry.io/collector/config/confignet"
|
|
"go.opentelemetry.io/collector/confmap"
|
|
)
|
|
|
|
func TestConfmapMarshalConfigHTTP(t *testing.T) {
|
|
conf := confmap.New()
|
|
require.NoError(t, conf.Marshal(confighttp.NewDefaultClientConfig()))
|
|
assert.Equal(t, map[string]any{
|
|
"idle_conn_timeout": 90 * time.Second,
|
|
"max_idle_conns": 100,
|
|
"force_attempt_http2": true,
|
|
}, conf.ToStringMap())
|
|
|
|
conf = confmap.New()
|
|
require.NoError(t, conf.Marshal(confighttp.NewDefaultCORSConfig()))
|
|
assert.Equal(t, map[string]any{}, conf.ToStringMap())
|
|
|
|
conf = confmap.New()
|
|
require.NoError(t, conf.Marshal(confighttp.NewDefaultServerConfig()))
|
|
assert.Equal(t, map[string]any{
|
|
"cors": nil,
|
|
"idle_timeout": 60 * time.Second,
|
|
"keep_alives_enabled": true,
|
|
"read_header_timeout": 60 * time.Second,
|
|
"tls": nil,
|
|
"transport": confignet.TransportTypeTCP,
|
|
"write_timeout": 30 * time.Second,
|
|
}, conf.ToStringMap())
|
|
|
|
conf = confmap.New()
|
|
require.NoError(t, conf.Marshal(confighttp.AuthConfig{}))
|
|
assert.Equal(t, map[string]any{}, conf.ToStringMap())
|
|
}
|