Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MovieStoreGuy authored Apr 9, 2024
2 parents 8ae914b + fe59abb commit 8efcba4
Show file tree
Hide file tree
Showing 70 changed files with 2,230 additions and 324 deletions.
27 changes: 27 additions & 0 deletions .chloggen/add_podman_metadata.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: breaking

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Adds metrics and resources metadata and sets seconds precision for cpu metrics"

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

# (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-accepts-conn.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: Handle OpAMP connection settings.

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

# (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: []
10 changes: 5 additions & 5 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ require (
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ReneKroon/ttlcache/v2 v2.11.0 // indirect
github.com/SAP/go-hdb v1.8.11 // indirect
github.com/SAP/go-hdb v1.8.12 // indirect
github.com/SermoDigital/jose v0.9.2-0.20180104203859-803625baeddc // indirect
github.com/Showmax/go-fqdn v1.0.0 // indirect
github.com/aerospike/aerospike-client-go/v6 v6.13.0 // indirect
Expand Down Expand Up @@ -562,7 +562,7 @@ require (
github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/common v0.52.2 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/prometheus/prometheus v0.51.2-0.20240405174432-b4a973753c6e // indirect
Expand Down Expand Up @@ -682,13 +682,13 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
Expand Down
19 changes: 10 additions & 9 deletions cmd/configschema/go.sum

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

51 changes: 48 additions & 3 deletions cmd/opampsupervisor/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func newOpAMPServer(t *testing.T, connectingCallback onConnectingFuncFactory, ca
s := server.New(testLogger{t: t})
onConnectedFunc := callbacks.OnConnectedFunc
callbacks.OnConnectedFunc = func(ctx context.Context, conn types.Connection) {
agentConn.Store(conn)
isAgentConnected.Store(true)
connectedChan <- true
if onConnectedFunc != nil {
onConnectedFunc(ctx, conn)
}
agentConn.Store(conn)
isAgentConnected.Store(true)
connectedChan <- true
}
onConnectionCloseFunc := callbacks.OnConnectionCloseFunc
callbacks.OnConnectionCloseFunc = func(conn types.Connection) {
Expand Down Expand Up @@ -473,3 +473,48 @@ func waitForSupervisorConnection(connection chan bool, connected bool) {
}
}
}

func TestSupervisorOpAMPConnectionSettings(t *testing.T) {
var connectedToNewServer atomic.Bool
initialServer := newOpAMPServer(
t,
defaultConnectingHandler,
server.ConnectionCallbacksStruct{})

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

waitForSupervisorConnection(initialServer.supervisorConnected, true)

newServer := newOpAMPServer(
t,
defaultConnectingHandler,
server.ConnectionCallbacksStruct{
OnConnectedFunc: func(_ context.Context, _ types.Connection) {
connectedToNewServer.Store(true)
},
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
return &protobufs.ServerToAgent{}
},
})

initialServer.sendToSupervisor(&protobufs.ServerToAgent{
ConnectionSettings: &protobufs.ConnectionSettingsOffers{
Opamp: &protobufs.OpAMPConnectionSettings{
DestinationEndpoint: "ws://" + newServer.addr + "/v1/opamp",
Headers: &protobufs.Headers{
Headers: []*protobufs.Header{
{
Key: "x-foo",
Value: "bar",
},
},
},
},
},
})

require.Eventually(t, func() bool {
return connectedToNewServer.Load() == true
}, 10*time.Second, 500*time.Millisecond, "Collector did not connect to new OpAMP server")
}
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/oklog/ulid/v2 v2.1.0
github.com/open-telemetry/opamp-go v0.14.0
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/config/configopaque v1.4.1-0.20240404121116-4f1a8936d26b
go.opentelemetry.io/collector/config/configtls v0.97.1-0.20240404121116-4f1a8936d26b
go.opentelemetry.io/collector/semconv v0.97.1-0.20240404121116-4f1a8936d26b
go.uber.org/goleak v1.3.0
Expand All @@ -27,7 +28,6 @@ require (
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
go.opentelemetry.io/collector/config/configopaque v1.4.1-0.20240404121116-4f1a8936d26b // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
Expand Down
14 changes: 9 additions & 5 deletions cmd/opampsupervisor/supervisor/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package config

import (
"net/http"

"go.opentelemetry.io/collector/config/configtls"
)

Expand All @@ -16,15 +18,17 @@ type Supervisor struct {

// Capabilities is the set of capabilities that the Supervisor supports.
type Capabilities struct {
AcceptsRemoteConfig *bool `mapstructure:"accepts_remote_config"`
ReportsEffectiveConfig *bool `mapstructure:"reports_effective_config"`
ReportsOwnMetrics *bool `mapstructure:"reports_own_metrics"`
ReportsHealth *bool `mapstructure:"reports_health"`
ReportsRemoteConfig *bool `mapstructure:"reports_remote_config"`
AcceptsRemoteConfig *bool `mapstructure:"accepts_remote_config"`
AcceptsOpAMPConnectionSettings *bool `mapstructure:"accepts_opamp_connection_settings"`
ReportsEffectiveConfig *bool `mapstructure:"reports_effective_config"`
ReportsOwnMetrics *bool `mapstructure:"reports_own_metrics"`
ReportsHealth *bool `mapstructure:"reports_health"`
ReportsRemoteConfig *bool `mapstructure:"reports_remote_config"`
}

type OpAMPServer struct {
Endpoint string
Headers http.Header
TLSSetting configtls.ClientConfig `mapstructure:"tls,omitempty"`
}

Expand Down
Loading

0 comments on commit 8efcba4

Please sign in to comment.