Skip to content

Commit

Permalink
Merge branch 'main' into receiver/cloudfoundryreceiver
Browse files Browse the repository at this point in the history
  • Loading branch information
jriguera authored Jun 13, 2024
2 parents b6334c7 + 6c15654 commit 361f3af
Show file tree
Hide file tree
Showing 560 changed files with 12,202 additions and 11,514 deletions.
27 changes: 27 additions & 0 deletions .chloggen/codeboten_mdatagen-statsd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: update statsd receiver to use mdatagen

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33524]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
33 changes: 33 additions & 0 deletions .chloggen/codeboten_rm-deprecate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: remove deprecated code

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33519]

# (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: |
This change removes:
- adapter.LogEmitter, use helper.LogEmitter instead
- adapter.NewLogEmitter, use helper.NewLogEmitter instead
- fileconsumer.Manager's SugaredLogger struct member
- pipeline.DirectedPipeline's SugaredLogger struct member
- testutil.Logger, use zaptest.NewLogger instead
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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]
30 changes: 30 additions & 0 deletions .chloggen/elasticsearchexporter-confighttp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add support for confighttp options, notably "auth".

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33367]

# (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: |
Add support for confighttp and related configuration settings, such as "auth".
This change also means that the Elasticsearch URL may be specified as "endpoint",
like the otlphttp exporter.
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: [user]
27 changes: 27 additions & 0 deletions .chloggen/stanley.liu_logs-agent-use-http.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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. filelogreceiver)
component: exporter/datadog

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Prevents collector shut down when Datadog logs pipeline fails to validate API key

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33195]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
27 changes: 27 additions & 0 deletions .chloggen/supervisor-effective-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

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

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: cmd/opampsupervisor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Receive and report effective config to the OpAMP server

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30622]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
6 changes: 2 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ jobs:
fail-fast: false
matrix:
k8s-version:
- "v1.26.0"
- "v1.25.3"
- "v1.24.7"
- "v1.23.13"
- "v1.30.0"
- "v1.23.17"
component:
- receiver/k8sclusterreceiver
- processor/k8sattributesprocessor
Expand Down
4 changes: 2 additions & 2 deletions cmd/githubgen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.21.0

require (
github.com/google/go-github/v62 v62.0.0
go.opentelemetry.io/collector/confmap v0.102.2-0.20240606174409-6888f8f7a45f
go.opentelemetry.io/collector/confmap/provider/fileprovider v0.102.2-0.20240606174409-6888f8f7a45f
go.opentelemetry.io/collector/confmap v0.102.2-0.20240611143128-7dfb57b9ad1c
go.opentelemetry.io/collector/confmap/provider/fileprovider v0.102.2-0.20240611143128-7dfb57b9ad1c
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/githubgen/go.sum

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

92 changes: 85 additions & 7 deletions cmd/opampsupervisor/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (tl testLogger) Errorf(_ context.Context, format string, args ...any) {
}

func defaultConnectingHandler(connectionCallbacks server.ConnectionCallbacksStruct) func(request *http.Request) types.ConnectionResponse {
return func(request *http.Request) types.ConnectionResponse {
return func(_ *http.Request) types.ConnectionResponse {
return types.ConnectionResponse{
Accept: true,
ConnectionCallbacks: connectionCallbacks,
Expand Down Expand Up @@ -125,7 +125,8 @@ func newOpAMPServer(t *testing.T, connectingCallback onConnectingFuncFactory, ca
require.Fail(t, "Agent connection has not been established")
}

agentConn.Load().(types.Connection).Send(context.Background(), msg)
err = agentConn.Load().(types.Connection).Send(context.Background(), msg)
require.NoError(t, err)
}
t.Cleanup(func() {
shutdown()
Expand Down Expand Up @@ -217,8 +218,9 @@ func TestSupervisorStartsCollectorWithRemoteConfig(t *testing.T) {
cfg, ok := agentConfig.Load().(string)
if ok {
// The effective config may be structurally different compared to what was sent,
// so just check that it includes some strings we know to be unique to the remote config.
return strings.Contains(cfg, inputFile.Name()) && strings.Contains(cfg, outputFile.Name())
// and will also have some data redacted,
// so just check that it includes the filelog receiver
return strings.Contains(cfg, "filelog")
}

return false
Expand Down Expand Up @@ -340,9 +342,9 @@ func TestSupervisorConfiguresCapabilities(t *testing.T) {
waitForSupervisorConnection(server.supervisorConnected, true)

require.Eventually(t, func() bool {
cap := capabilities.Load()
caps := capabilities.Load()

return cap == uint64(protobufs.AgentCapabilities_AgentCapabilities_ReportsStatus)
return caps == uint64(protobufs.AgentCapabilities_AgentCapabilities_ReportsStatus)
}, 5*time.Second, 250*time.Millisecond)
}

Expand Down Expand Up @@ -418,6 +420,82 @@ func TestSupervisorBootstrapsCollector(t *testing.T) {
}, 5*time.Second, 250*time.Millisecond)
}

func TestSupervisorReportsEffectiveConfig(t *testing.T) {
var agentConfig atomic.Value
server := newOpAMPServer(
t,
defaultConnectingHandler,
server.ConnectionCallbacksStruct{
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
if message.EffectiveConfig != nil {
config := message.EffectiveConfig.ConfigMap.ConfigMap[""]
if config != nil {
agentConfig.Store(string(config.Body))
}
}

return &protobufs.ServerToAgent{}
},
})

s := newSupervisor(t, "basic", map[string]string{"url": server.addr})
defer s.Shutdown()

waitForSupervisorConnection(server.supervisorConnected, true)

// Create input and output files so we can "communicate" with a Collector binary.
// The testing package will automatically clean these up after each test.
tempDir := t.TempDir()
testKeyFile, err := os.CreateTemp(tempDir, "confKey")
require.NoError(t, err)
n, err := testKeyFile.Write([]byte(testKeyFile.Name()))
require.NoError(t, err)
require.NotZero(t, n)

colCfgTpl, err := os.ReadFile(path.Join("testdata", "collector", "split_config.yaml"))
require.NoError(t, err)

templ, err := template.New("").Parse(string(colCfgTpl))
require.NoError(t, err)

var cfg bytes.Buffer
err = templ.Execute(
&cfg,
map[string]string{
"TestKeyFile": testKeyFile.Name(),
},
)
require.NoError(t, err)

h := sha256.New()
if _, err := io.Copy(h, bytes.NewBuffer(cfg.Bytes())); err != nil {
t.Fatal(err)
}

server.sendToSupervisor(&protobufs.ServerToAgent{
RemoteConfig: &protobufs.AgentRemoteConfig{
Config: &protobufs.AgentConfigMap{
ConfigMap: map[string]*protobufs.AgentConfigFile{
"": {Body: cfg.Bytes()},
},
},
ConfigHash: h.Sum(nil),
},
})

require.Eventually(t, func() bool {
cfg, ok := agentConfig.Load().(string)
if ok {
// The effective config may be structurally different compared to what was sent,
// and currently has most values redacted,
// so just check that it includes some strings we know to be unique to the remote config.
return strings.Contains(cfg, "test_key:")
}

return false
}, 5*time.Second, 500*time.Millisecond, "Collector never reported effective config")
}

func TestSupervisorAgentDescriptionConfigApplies(t *testing.T) {
// Load the Supervisor config so we can get the location of
// the Collector that will be run.
Expand Down Expand Up @@ -673,7 +751,7 @@ func TestSupervisorOpAMPConnectionSettings(t *testing.T) {
OnConnectedFunc: func(_ context.Context, _ types.Connection) {
connectedToNewServer.Store(true)
},
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
OnMessageFunc: func(_ context.Context, _ types.Connection, _ *protobufs.AgentToServer) *protobufs.ServerToAgent {
return &protobufs.ServerToAgent{}
},
})
Expand Down
5 changes: 4 additions & 1 deletion cmd/opampsupervisor/examples/supervisor_darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server:
tls:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
insecure_skip_verify: true
# For more TLS settings see config/configtls.ClientConfig

capabilities:
Expand All @@ -15,3 +15,6 @@ capabilities:

agent:
executable: ../../bin/otelcontribcol_darwin_amd64

storage:
directory: .
5 changes: 4 additions & 1 deletion cmd/opampsupervisor/examples/supervisor_linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server:
tls:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
insecure_skip_verify: true
# For more TLS settings see config/configtls.ClientConfig

capabilities:
Expand All @@ -15,3 +15,6 @@ capabilities:

agent:
executable: ../../bin/otelcontribcol_linux_amd64

storage:
directory: .
5 changes: 4 additions & 1 deletion cmd/opampsupervisor/examples/supervisor_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server:
tls:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
insecure_skip_verify: true
# For more TLS settings see config/configtls.ClientConfig

capabilities:
Expand All @@ -15,3 +15,6 @@ capabilities:

agent:
executable: ../../bin/otelcontribcol_windows_amd64.exe

storage:
directory: .
8 changes: 4 additions & 4 deletions cmd/opampsupervisor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ go 1.21.0
require (
github.com/cenkalti/backoff/v4 v4.3.0
github.com/google/uuid v1.6.0
github.com/knadh/koanf/maps v0.1.1
github.com/knadh/koanf/parsers/yaml v0.1.0
github.com/knadh/koanf/providers/file v0.1.0
github.com/knadh/koanf/providers/rawbytes v0.1.0
github.com/knadh/koanf/v2 v2.1.1
github.com/open-telemetry/opamp-go v0.15.0
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/config/configopaque v1.9.1-0.20240606174409-6888f8f7a45f
go.opentelemetry.io/collector/config/configtls v0.102.2-0.20240606174409-6888f8f7a45f
go.opentelemetry.io/collector/semconv v0.102.2-0.20240606174409-6888f8f7a45f
go.opentelemetry.io/collector/config/configopaque v1.9.1-0.20240611143128-7dfb57b9ad1c
go.opentelemetry.io/collector/config/configtls v0.102.2-0.20240611143128-7dfb57b9ad1c
go.opentelemetry.io/collector/semconv v0.102.2-0.20240611143128-7dfb57b9ad1c
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
google.golang.org/protobuf v1.34.2
Expand All @@ -26,7 +27,6 @@ require (
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
Expand Down
Loading

0 comments on commit 361f3af

Please sign in to comment.