consul

package
v0.103.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: Apache-2.0 Imports: 11 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 {

	// 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 configopaque.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]any `mapstructure:"meta"`

	// ResourceAttributes configuration for Consul detector
	ResourceAttributes metadata.ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

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.

func CreateDefaultConfig

func CreateDefaultConfig() Config

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

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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