bundle.d
bundle.d
refers to the embed.FS
config directory made available by the
bundle.BundledFS
. It currently consists of all ./bundle.d/extensions/*.discovery.yaml
and
./bundle.d/receivers/*.discovery.yaml
files that are generated by the discoverybundler
cmd as used by go:generate
directives in bundle_gen.go.
To construct the latest bundle.d contents before building the collector run:
$ make bundle.d
*.discovery.yaml.tmpl
All discovery config component discovery.yaml files are generated from text/template
discovery.yaml.tmpl
files using built-in validators and property guidance helpers:
Example redis.discovery.yaml.tmpl
:
{{ receiver "redis" }}:
enabled: true
rule:
docker_observer: type == "container" and port == 6379
<...>
status:
<...>
statements:
partial:
- regexp: 'ERR AUTH.*'
first_only: true
log_record:
severity_text: info
body: >-
Please ensure your redis password is correctly specified with
`--set {{ configProperty "password" "<password>" }}` or
`{{ configPropertyEnvVar "password" "<username>" }}` environment variable.
After adding the required generate directive to bundle_gen.go
and running make bundle.d
:
//go:generate discoverybundler -r -t bundle.d/receivers/redis.discovery.yaml.tmpl
There is now a corresponding bundle.d/receiver/redis.discovery.yaml
:
#####################################################################################
# This file is generated by the Splunk Distribution of the OpenTelemetry Collector. #
#####################################################################################
redis:
enabled: true
rule:
docker_observer: type == "container" and port == 6379
<...>
status:
<...>
statements:
partial:
- regexp: 'ERR AUTH.*'
first_only: true
log_record:
severity_text: info
body: >-
Please ensure your redis password is correctly specified with
`--set splunk.discovery.receivers.redis.config.password="<password>"` or
`SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<username>"` environment variable.
When building the collector afterward, this redis receiver discovery config is now made available to discovery mode, and
it can be disabled by --set splunk.discovery.receivers.redis.enabled=false
or
SPLUNK_DISCOVERY_RECEIVERS_redis_ENABLED=false
.