forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmd/opampsupervisor] Add OpAMP supervisor skeleton (open-telemetry#1…
…9143) This is a direct copy of the [supervisor example implementation](https://github.com/open-telemetry/opamp-go/tree/main/internal/examples/supervisor) in the opamp-go repository. I've made some minor changes that are largely centered around linting and making it a little less of an example. Any existing or new TODOs have a linked issue that gives some context. **Link to tracking Issue:** Implements open-telemetry#18461 Co-authored-by: Matej Gera <[email protected]> --------- Co-authored-by: Evan Bradley <[email protected]> Co-authored-by: Matej Gera <[email protected]>
- Loading branch information
1 parent
31bfef7
commit 52d87f8
Showing
22 changed files
with
1,982 additions
and
5 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
effective.yaml | ||
agent.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
Oops, something went wrong.