consul

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeStr is type of detector.
	TypeStr = "consul"
)

Variables

This section is empty.

Functions

func NewDetector

NewDetector creates a new system metadata detector

Types

type Config

type Config struct {
	config.ProcessorSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct

	// Address is the address of the Consul server
	Address string `mapstructure:"address"`

	// Datacenter to use. If not provided, the default agent datacenter is used.
	Datacenter string `mapstructure:"datacenter"`

	// Token is used to provide a per-request ACL token
	// which overrides the agent's default (empty) token.
	// Token or Tokenfile are only required if [Consul's ACL
	// System](https://www.consul.io/docs/security/acl/acl-system) is enabled.
	Token string `mapstructure:"token"`

	// TokenFile is a file containing the current token to use for this client.
	// If provided it is read once at startup and never again.
	// Token or Tokenfile are only required if [Consul's ACL
	// System](https://www.consul.io/docs/security/acl/acl-system) is enabled.
	TokenFile string `mapstructure:"token_file"`

	// Namespace is the name of the namespace to send along for the request
	// when no other Namespace is present in the QueryOptions
	Namespace string `mapstructure:"namespace"`

	// Allowlist of [Consul
	// Metadata](https://www.consul.io/docs/agent/options#node_meta) keys to use as
	// resource attributes.
	MetaLabels map[string]interface{} `mapstructure:"meta"`
}

The struct requires no user-specified fields by default as consul agent's default configuration will be provided to the API client. See `consul.go#NewDetector` for more information.

type Detector

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

Detector is a system metadata detector

func (*Detector) Detect

func (d *Detector) Detect(ctx context.Context) (resource pcommon.Resource, schemaURL string, err error)

Detect detects system metadata and returns a resource with the available ones

Jump to

Keyboard shortcuts

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