Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmd/opampsupervisor] Add OpAMP supervisor skeleton #19143

Merged
merged 17 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

cmd/configschema/ @open-telemetry/collector-contrib-approvers @mx-psi @dmitryax @pmcollins
cmd/mdatagen/ @open-telemetry/collector-contrib-approvers @dmitryax
cmd/opampsupervisor/ @open-telemetry/collector-contrib-approvers @evan-bradley @atoulme @tigrannajaryan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are any of these teams appropriate code owners? https://github.com/orgs/open-telemetry/teams?query=opamp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I would call out opamp-go-approvers as the best candidate since the Supervisor will be a reference implementation of a client using the OpAMP Go client, but realistically the two are distinct.

@open-telemetry/opamp-go-approvers would you like to be code owners for this?

cmd/otelcontribcol/ @open-telemetry/collector-contrib-approvers
cmd/oteltestbedcol/ @open-telemetry/collector-contrib-approvers
cmd/telemetrygen/ @open-telemetry/collector-contrib-approvers @mx-psi @codeboten
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ body:
# Start Collector components list
- cmd/configschema
- cmd/mdatagen
- cmd/opampsupervisor
- cmd/otelcontribcol
- cmd/oteltestbedcol
- cmd/telemetrygen
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ body:
# Start Collector components list
- cmd/configschema
- cmd/mdatagen
- cmd/opampsupervisor
- cmd/otelcontribcol
- cmd/oteltestbedcol
- cmd/telemetrygen
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ body:
# Start Collector components list
- cmd/configschema
- cmd/mdatagen
- cmd/opampsupervisor
- cmd/otelcontribcol
- cmd/oteltestbedcol
- cmd/telemetrygen
Expand Down
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ updates:
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/cmd/opampsupervisor"
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/cmd/otelcontribcol"
schedule:
Expand Down Expand Up @@ -1097,8 +1102,3 @@ updates:
schedule:
interval: "weekly"
day: "wednesday"
- package-ecosystem: "gomod"
directory: "/receiver/tcplogreceiver"
schedule:
interval: "weekly"
day: "wednesday"
2 changes: 2 additions & 0 deletions cmd/opampsupervisor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
effective.yaml
agent.log
1 change: 1 addition & 0 deletions cmd/opampsupervisor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
24 changes: 24 additions & 0 deletions cmd/opampsupervisor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# OpAMP Supervisor for the OpenTelemetry Collector

This is an implementation of an OpAMP Supervisor that runs a Collector instance using configuration provided from an OpAMP server. This implementation
is following a design specified [here](./specification/README.md).
The design is still undergoing changes, and as such this implementation may change as well.

## Experimenting with the supervisor

The supervisor is currently undergoing heavy development and is not ready for any serious use. However, if you would like to test it, you can follow the steps below:

1. Download the [opamp-go](https://github.com/open-telemetry/opamp-go) repository, and run the OpAMP example server in the `internal/examples/server` directory.
2. From the Collector contrib repository root, build the Collector:

```shell
make otelcontribcol
```

3. Run the supervisor, substituting `<OS>` for your platform:

```shell
go run . --config testdata/supervisor_<OS>.yaml
```

4. The supervisor should connect to the OpAMP server and start a Collector instance.
27 changes: 27 additions & 0 deletions cmd/opampsupervisor/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/opampsupervisor

go 1.19

require (
github.com/cenkalti/backoff/v4 v4.2.0
github.com/knadh/koanf v1.5.0
github.com/oklog/ulid/v2 v2.1.0
github.com/open-telemetry/opamp-go v0.6.0
go.uber.org/zap v1.24.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.8.2 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
414 changes: 414 additions & 0 deletions cmd/opampsupervisor/go.sum

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions cmd/opampsupervisor/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package main

import (
"flag"
"os"
"os/signal"

"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/cmd/opampsupervisor/supervisor"
)

func main() {
configFlag := flag.String("config", "", "Path to a supervisor configuration file")
flag.Parse()

logger, _ := zap.NewDevelopment()

supervisor, err := supervisor.NewSupervisor(logger, *configFlag)
if err != nil {
logger.Error(err.Error())
os.Exit(-1)
return
}

interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
<-interrupt
supervisor.Shutdown()
}
Loading