mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-10-30 18:26:25 +00:00
Modules declare go 1.27.1 and the build images follow. go fix applied the modernizers; omitzero is not applied, since it changes what the JSON says. Co-authored-by: Hanzo Dev <[email protected]>
39 lines
762 B
Go
39 lines
762 B
Go
package opamp
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hanzoai/otel-collector/o11ycol"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type simpleClient struct {
|
|
baseClient
|
|
}
|
|
|
|
func NewSimpleClient(coll *o11ycol.WrappedCollector, logger *zap.Logger) *simpleClient {
|
|
return &simpleClient{
|
|
coll: coll,
|
|
err: make(chan error),
|
|
stopped: make(chan bool),
|
|
logger: logger.With(zap.String("component", "simple-client")),
|
|
}
|
|
}
|
|
|
|
func (c *simpleClient) Start(ctx context.Context) error {
|
|
c.logger.Info("Starting simple client")
|
|
err := c.coll.Run(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
go c.ensureRunning()
|
|
return nil
|
|
}
|
|
|
|
func (c *simpleClient) Stop(ctx context.Context) error {
|
|
c.logger.Info("Stopping simple client")
|
|
close(c.stopped)
|
|
c.coll.Shutdown()
|
|
return <-c.coll.ErrorChan()
|
|
}
|