agent

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package agent manages the consul-telemetry-collector process, loads the configuration, and sets up and manages the lifecycle of the opentelemetry-otel.

Index

Constants

View Source
const (
	// HCPClientID is the environment variable for the hcp client id.
	HCPClientID = "HCP_CLIENT_ID"

	// HCPClientIDOpt is the cli opt for the hcp client id.
	HCPClientIDOpt = "hcp-client-id"

	// HCPClientSecret is the environment variable for the hcp client secret.
	HCPClientSecret = "HCP_CLIENT_SECRET"

	// HCPClientSecretOpt is the cli opt for the hcp client secret.
	HCPClientSecretOpt = "hcp-client-secret"

	// HCPResourceID is the environment variable for the hcp resource id.
	HCPResourceID = "HCP_RESOURCE_ID"
	// HCPResourceIDOpt is the cli opt for the hcp resource id.
	HCPResourceIDOpt = "hcp-resource-id"

	// COOtelHTTPEndpoint is the environment variable for  OpenTelemetry HTTP Endpoints where metrics are forwarded.
	COOtelHTTPEndpoint = "CO_OTEL_HTTP_ENDPOINT"

	// COOtelHTTPEndpointOpt is the cli opt for the OpenTelemetry HTTP Endpoints where metrics are forwarded.
	COOtelHTTPEndpointOpt = "http-collector-endpoint"

	// COOConfigPath is the environment variable for path to the config.
	COOConfigPath = "COO_CONFIG_PATH"

	// COOConfigPathOpt is the cli opt for path to the config.
	COOConfigPathOpt = "config-file-path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloud

type Cloud struct {
	ClientID     string `hcl:"client_id,optional"`
	ClientSecret string `hcl:"client_secret,optional"`
	ResourceID   string `hcl:"resource_id,optional"`
}

Cloud is the HCP Cloud configuration.

func (*Cloud) IsEnabled

func (c *Cloud) IsEnabled() bool

IsEnabled checks if the Cloud config is enabled. It returns false if the ClientID, ClientSecret and ResourceID are all empty.

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command is the interface for running the collector.

func NewAgentCmd

func NewAgentCmd(ui cli.Ui) (*Command, error)

NewAgentCmd returns a new Agent command. It's mean to be only be called once to load configuration.

func (*Command) Help

func (c *Command) Help() string

Help provides specifications on how to run the collector.

func (*Command) Run

func (c *Command) Run(args []string) int

Run takes in args and runs the collector agent as an OTEL collector.

func (*Command) Synopsis

func (c *Command) Synopsis() string

Synopsis gives details on how the collector runs.

type Config

type Config struct {
	Cloud                 *Cloud `hcl:"cloud,block"`
	HTTPCollectorEndpoint string `hcl:"http_collector_endpoint,optional"`
	ConfigFile            string
	ExporterConfig        *ExporterConfig `hcl:"exporter_config,block"`
}

Config is the global collector configuration.

type ExporterConfig added in v0.1.0

type ExporterConfig struct {
	Type     string            `hcl:"type,label"`
	Headers  map[string]string `hcl:"headers,optional"`
	Endpoint string            `hcl:"endpoint"`
	Timeout  string            `hcl:"timeout,optional"`
}

ExporterConfig holds configuration options to export metrics to a desired custom endpoint.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service runs a otel.Collector with a configured otel pipeline.

func NewService

func NewService(cfg *Config) (*Service, error)

NewService returns a new Service based off the past in configuration.

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Run will initialize and Start the consul-telemetry-collector Service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL