Skip to content

Commit 2cbee82

Browse files
authored
adopt technical addon, as is (#5389)
1 parent 43f9512 commit 2cbee82

38 files changed

+2508
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Used for building
2+
SOURCE_DIR?=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3+
BUILD_DIR?=./build
4+
OTEL_COLLECTOR_VERSION?=0.104.0
5+
SPLUNK_OTELCOL_DOWNLOAD_BASE?=https://github.com/signalfx/splunk-otel-collector/releases/download
6+
PLATFORM?=linux
7+
ARCH?=amd64
8+
9+
# Used for testing & validation
10+
ORCA_CLOUD?=kubernetes
11+
UF_VERSION?=8.2.7
12+
SPLUNK_PLATFORM?=x64_centos_7
13+
SPLUNK_ARCH?=x86_64
14+
15+
# Used for releases
16+
SPLUNK_OTEL_VERSION?=
17+
TA_VERSION?=
18+
19+
20+
.PHONY: generate-technical-addon
21+
generate-technical-addon: env-guard-all
22+
BUILD_DIR="$(BUILD_DIR)" \
23+
SOURCE_DIR="$(SOURCE_DIR)" \
24+
$(SOURCE_DIR)/packaging-scripts/make-buildspace.sh
25+
26+
.PHONY: env-guard-all
27+
env-guard-all:
28+
SOURCE_DIR="$(SOURCE_DIR)" \
29+
BUILD_DIR="$(BUILD_DIR)" \
30+
$(SOURCE_DIR)/packaging-scripts/env/all.sh
31+
32+
.PHONY: env-guard-ta
33+
env-guard-ta: env-guard-all
34+
PLATFORM="$(PLATFORM)" \
35+
ARCH="$(ARCH)" \
36+
OTEL_COLLECTOR_VERSION="$(OTEL_COLLECTOR_VERSION)" \
37+
$(SOURCE_DIR)/packaging-scripts/env/ta.sh
38+
39+
40+
.PHONY: env-guard-verify
41+
env-guard-verify: env-guard-ta
42+
ORCA_CLOUD="$(ORCA_CLOUD)" \
43+
UF_VERSION="$(UF_VERSION)" \
44+
$(SOURCE_DIR)/packaging-scripts/env/verify.sh
45+
46+
.PHONY: download
47+
download: env-guard-ta
48+
BUILD_DIR="$(BUILD_DIR)" \
49+
SOURCE_DIR="$(SOURCE_DIR)" \
50+
OTEL_COLLECTOR_VERSION="$(OTEL_COLLECTOR_VERSION)" \
51+
SPLUNK_OTELCOL_DOWNLOAD_BASE="$(SPLUNK_OTELCOL_DOWNLOAD_BASE)" \
52+
PLATFORM="$(PLATFORM)" \
53+
ARCH="$(ARCH)" \
54+
$(SOURCE_DIR)/packaging-scripts/download-release.sh
55+
56+
57+
.PHONY: package
58+
package: env-guard-ta
59+
BUILD_DIR="$(BUILD_DIR)" \
60+
SOURCE_DIR="$(SOURCE_DIR)" \
61+
ARCH="$(ARCH)" \
62+
PLATFORM="$(PLATFORM)" \
63+
OTEL_COLLECTOR_VERSION="$(OTEL_COLLECTOR_VERSION)" \
64+
$(SOURCE_DIR)/packaging-scripts/package-ta.sh
65+
66+
.PHONY: distribute-ta
67+
distribute-ta: generate-technical-addon download package
68+
69+
.PHONY: verify
70+
verify: env-guard-verify
71+
SOURCE_DIR="$(SOURCE_DIR)" \
72+
BUILD_DIR="$(BUILD_DIR)" \
73+
ARCH="$(ARCH)" \
74+
PLATFORM="$(PLATFORM)" \
75+
OTEL_COLLECTOR_VERSION="$(OTEL_COLLECTOR_VERSION)" \
76+
ORCA_CLOUD="$(ORCA_CLOUD)" \
77+
UF_VERSION="$(UF_VERSION)" \
78+
SPLUNK_PLATFORM="$(SPLUNK_PLATFORM)" \
79+
OLLY_ACCESS_TOKEN="$(OLLY_ACCESS_TOKEN)" \
80+
$(SOURCE_DIR)/packaging-scripts/deploy-and-verify.sh
81+
82+
.PHONY: update-deps
83+
update-deps:
84+
SOURCE_DIR="$(SOURCE_DIR)" \
85+
SPLUNK_OTEL_VERSION="$(SPLUNK_OTEL_VERSION)" \
86+
./packaging-scripts/update-otel-version.sh
87+
TA_VERSION="$(TA_VERSION)" \
88+
$(SOURCE_DIR)/packaging-scripts/update-ta-version.sh
89+
90+
.PHONY: release
91+
release:
92+
SOURCE_DIR="$(SOURCE_DIR)" \
93+
$(SOURCE_DIR)/packaging-scripts/release-ta-version.sh
94+
95+
.PHONY: update-and-release
96+
update-and-release: update-deps release
97+
98+
.PHONY: clean
99+
clean:
100+
rm -rf build
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Need Help?
2+
See `#otel-ta-community` for help.
3+
4+
# Developing this TA
5+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md)
6+
7+
# Configuration
8+
## environment variables
9+
In addition to the typical collector environment variables, we additionally provide
10+
11+
- `$SPLUNK_HOME` ex `/opt/splunk`
12+
- `$SPLUNK_OTEL_TA_HOME` ex `/opt/splunk/etc/apps/Splunk_TA_Otel`
13+
- `$SPLUNK_OTEL_TA_PLATFORM_HOME` ex `/opt/splunk/etc/apps/Splunk_TA_Otel/linux_x86_64`
14+
15+
These are useful for setting things in `inputs.conf` such as
16+
- `splunk_bundle_dir=$SPLUNK_OTEL_TA_PLATFORM_HOME/bin/agent-bundle`
17+
- `splunk_collectd_dir=$SPLUNK_OTEL_TA_PLATFORM_HOME/bin/agent-bundle/run/collectd`
18+
19+
There is a debug environment variable for the TA scripts, which will log verbose
20+
messages if set to anything other than the empty string.
21+
- `SPLUNK_OTEL_TA_DEBUG`
22+
23+
## parameters
24+
See `Splunk_TA_Otel/README/inputs.conf.spec` or `Splunk_TA_Otel/default/inputs.conf` for configuration values.
25+
26+
Of note is that we need to read the `access_token` from a file into an environment variable during TA initialization.
27+
By default, this access_token is expected to live in `$SPLUNK_OTEL_TA_HOME/local/access_token`
28+
29+
30+
# Installation
31+
32+
## Reducing the size of the TA
33+
Customers may want to remove unnecessary configuration if they're only using one
34+
operating system (ex windows, linux).
35+
36+
This can be accomplished by removing either `Splunk_TA_Otel/linux_x86_64` or
37+
`Splunk_TA_Otel/windows_x86_64`, respectively.
38+
39+
## Maintaining configuration between upgrades
40+
As with all TAs, any changes made to `configs` will be overwritten.
41+
Customers should copy any relevant custom configuration from `configs/` or `defaults/`
42+
to `local/`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Making a new release of the TA
2+
3+
## Update versions for splunk otel collector && TA
4+
1. run `make update-deps`
5+
2. Verify `git diff main -- Makefile Splunk_TA_otel/default/app.conf` shows expected changes
6+
7+
8+
## Cut Release
9+
- run `make update-and-release` to automatically upgrade to the latest splunk otel collector release and bump the minor release.
10+
- For more control, you can directly specify the environment variables `SPLUNK_OTEL_VERSION` and `TA_VERSION`
11+
- Example: `SPLUNK_OTEL_VERSION=0.0.0 TA_VERSION=0.0.1 make -e update-and-release` (replacing the version values as desired)
12+
- upload `out/distribution/Splunk_TA_otel.tgz` artifact from `build-all-platforms` job of release branch to splunkbase
13+
14+
If you have issues with pushing the branch due to duplicate refs or anything, `git tag -d TAG_NAME` can be useful
15+
16+
## Market release
17+
1. Inform docs team of release (or DIY)
18+
2. Include link to our [latest release notes](https://github.com/signalfx/splunk-otel-collector/releases/)
19+
3. Optionally include link to [latest upstream release notes](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases)
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Splunk Add-on for OpenTelemetry Collector
2+
3+
This technical add-on for Splunk Universal Forwarder helps in deploying the OpenTelemetry Collector alongside Universal Forwarder.
4+
5+
Splunk Add-on for OpenTelemetry Collector is supported on Linux and Windows on `amd64` (`x86_64`)
6+
7+
## Contents
8+
9+
The package contains the following folders and files -
10+
11+
------------|
12+
|------windows_x86_64
13+
14+
------------|
15+
|------linux_x86_64
16+
17+
------------|
18+
|------README
19+
20+
------------|
21+
|------default
22+
23+
------------|
24+
|------configs
25+
26+
------------|
27+
|------README.md
28+
29+
30+
The Windows and Linux folders contain platform specific binaries. The default folder contains the `app.conf` and `inputs.conf` files. The configs folder contains sample configuration files for collecting host metrics and traces using the OpenTelemetry Collector.
31+
32+
## Install the add-on
33+
34+
The installation process for the Splunk Add-on for OpenTelemetry Collector differs depending on the deployment method.
35+
36+
### Splunk Deployment Server
37+
38+
Follow these steps to install the add-on using Splunk Deployment Server:
39+
40+
1. Extract the `Splunk_TA_otel.tgz` file to the `$SPLUNK_HOME/etc/deployment-apps` folder.
41+
2. Edit the configuration files.
42+
3. Follow the instructions for deploying apps. See https://docs.splunk.com/Documentation/Splunk/8.1.2/Updating/Updateconfigurations.
43+
4. Make sure to activate the restart of Universal Forwarder after deployment.
44+
45+
### Splunk Universal Forwarder
46+
47+
To install the add-on directly on Universal Forwarder, follow these steps:
48+
49+
1. Log in to Universal Forwarder.
50+
2. Copy the tar file on the server.
51+
3. Extract the package to the `$SPLUNK_HOME/etc/apps` folder:
52+
53+
```
54+
tar -zxf Splunk_TA_otel.tgz
55+
```
56+
57+
## Configure the add-on
58+
59+
Before using the add-on, create a `local` folder and write the contents of your Splunk Observability Cloud access token to this file.
60+
**WE STRONGLY RECOMMEND** that you restrict read and write to this token to the minimal possible permissions.
61+
Alternatively, you can set the `SPLUNK_ACCESS_TOKEN` environment variable to avoid needing to write this.
62+
63+
```sh
64+
cd /opt/splunkforwarder/etc/apps/Splunk_TA_otel/
65+
mkdir local
66+
cp -R config local
67+
touch local/access_token
68+
# make the contents of the access_token file your o11y access token.
69+
```
70+
71+
After all the steps are completed, restart Splunk Universal Forwarder by running `$SPLUNK_HOME/bin/splunk.exe restart`
72+
73+
## Configure the OpenTelemetry Collector
74+
75+
To configure the OpenTelemetry Collector within the add-on, follow these steps:
76+
77+
1. Create a new configuration file in YAML format for the Collector. For more information, see [Configure the Collector](https://docs.splunk.com/Observability/gdi/opentelemetry/configure-the-collector.html) in the Splunk Observability Cloud documentation.
78+
2. Edit the inputs.conf file inside default to point to the new configuration file.
79+
3. Restart Splunk Universal Forwarder.
80+
81+
Various settings in the `inputs.conf.spec` are "pass through" [environment variables](https://github.com/signalfx/splunk-otel-collector/blob/main/internal/settings/settings.go#L37-L64) to the default splunk distribution of the opentelemetry collector's agent configuration. We do not currently pass through things related to `gateway` nor for the splunk hec related settings. That said, the binary vended in the TA is identical to upstream
82+
83+
Note that we additionally configure the following environment variables in the hopes of making configuration easier.
84+
- `$SPLUNK_OTEL_TA_HOME` References the location of the TA, ex `/opt/splunk/etc/apps/Splunk_TA_Otel`
85+
- `$SPLUNK_OTEL_TA_PLATFORM_HOME` references the location of the platform-specific configuration for the TA, ex `/opt/splunk/etc/apps/Splunk_TA_Otel/linux_x86_64`. By default the `splunk_bundle_dir` and `splunk_collectd_dir` options in `inputs.conf` references this environment variable.
86+
87+
Finally, setting `$SPLUNK_OTEL_TA_DEBUG` to anything other than an empty string will provide detailed logging messages during TA start up.
88+
89+
90+
## Check operational status
91+
92+
Both the add-on and the OpenTelemetry Collector generate log files to indicate operational status.
93+
94+
You can find the log files in the `$SPLUNK_HOME/var/log/splunk/` folder.
95+
96+
- The Splunk add-on log file is `Splunk_TA_otel.log`.
97+
- By default, the OpenTelemetry Collector log file is `otel.log` (although you can override this path to whatever you please).
98+
99+
## Explore metrics and traces
100+
101+
You can browse the metrics and traces collected by the add-on in in Splunk Observability Cloud. See the [Splunk Observability Cloud documentation for more information](https://docs.splunk.com/Observability).
102+
103+
If you're using the default configuration, you can search [metrics finder](https://docs.splunk.com/observability/en/metrics-and-metadata/metrics-finder-metadata-catalog.html#metrics-finder-and-metadata-catalog) for [`splunk.distribution:otel-ta`](https://app.signalfx.com/#/metrics?sources%5B%5D=splunk.distribution:otel-ta).
104+
105+
*note*: if you're using your own configuration, *please* continue to include the telemetry in the configuration.
106+
107+
108+
Under `processors`
109+
```
110+
resource/telemetry:
111+
attributes:
112+
- action: insert
113+
key: splunk.distribution
114+
value: otel-ta
115+
```
116+
117+
Under `receivers`
118+
```
119+
# This section is used to collect the OpenTelemetry Collector metrics
120+
# Even if just a Splunk APM customer, these metrics are included
121+
prometheus/internal:
122+
config:
123+
scrape_configs:
124+
- job_name: 'otel-collector'
125+
scrape_interval: 10s
126+
static_configs:
127+
- targets: ["${env:SPLUNK_LISTEN_INTERFACE}:8888"]
128+
metric_relabel_configs:
129+
- source_labels: [ __name__ ]
130+
regex: '.*grpc_io.*'
131+
action: drop
132+
```
133+
134+
Under `pipelines`, assuming you're using a `signalfx` exporter (only `otlp` is supported for our internal telemetry metrics)
135+
```
136+
metrics/telemetry:
137+
receivers: [prometheus/internal]
138+
processors: [memory_limiter, batch, resourcedetection, resource/telemetry]
139+
exporters: [signalfx]
140+
```
141+
142+
# Binary File Declaration
143+
`linux_x86_64/bin/otelcol_linux_amd64`
144+
`windows_x86_64/bin/otelcol_windows_amd64.exe`
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[Splunk_TA_otel://<name>]
2+
3+
splunk_access_token_file = <value>
4+
* File whose contents store the credentials to be set in `SPLUNK_ACCESS_TOKEN` (used to auth with Splunk Observability Cloud, default `$SPLUNK_OTEL_TA_HOME/local/access_token`).
5+
6+
splunk_otel_log_file = <value>
7+
* Log file for otel collector
8+
9+
10+
# Below are all "pass through" configuration options that will enable environment variables supported in
11+
# https://github.com/signalfx/splunk-otel-collector/blob/main/internal/settings/settings.go#L37-L64
12+
gomemlimit = <value>
13+
* Value to use for the `GOMEMLIMIT` environment variable
14+
15+
splunk_api_url = <value>
16+
* Value to use for the `SPLUNK_API_URL` environment variable
17+
18+
splunk_bundle_dir = <value>
19+
* Value to use for the `SPLUNK_BUNDLE_DIR` environment variable (used in smart agent config, default `$SPLUNK_OTEL_TA_PLATFORM_HOME/bin/agent-bundle`). NOTE: Once extracted, please do not move the folder structure, as some "first-run" patching occurs that depends on the directory it was run in. Instead, allow the TA to re-extract to the new location if changed.
20+
21+
splunk_collectd_dir = <value>
22+
* Value to use for the `SPLUNK_COLLECTD_DIR` environment variable (used in smart agent config, default `$SPLUNK_OTEL_TA_HOME/bin/agent-bundle/run/collectd`)
23+
24+
splunk_config = <value>
25+
* Value to use for the `SPLUNK_CONFIG` environment variable (default `$SPLUNK_OTEL_TA_HOME/config/ta_agent_config.yaml`)
26+
27+
splunk_config_dir = <value>
28+
* Value to use for the `SPLUNK_CONFIG_DIR` environment variable (default `$SPLUNK_OTEL_TA_HOME/config/`)
29+
30+
splunk_debug_config_server = <value>
31+
* Value to use for the `SPLUNK_DEBUG_CONFIG_SERVER` environment variable
32+
33+
splunk_config_yaml = <value>
34+
* Value to use for the `SPLUNK_CONFIG_YAML` environment variable
35+
36+
splunk_listen_interface = <value>
37+
* Value to use for the `SPLUNK_LISTEN_INTERFACE` environment variable
38+
39+
splunk_gateway_url = <value>
40+
* Value to use for the `SPLUNK_GATEWAY_URL` environment variable
41+
42+
splunk_memory_limit_mib = <value>
43+
* Value to use for the `SPLUNK_MEMORY_LIMIT_MIB` environment variable
44+
45+
splunk_memory_total_mib = <value>
46+
* Value to use for the `SPLUNK_MEMORY_TOTAL_MIB` environment variable
47+
48+
splunk_trace_url = <value>
49+
* Endpoint for `SPLUNK_TRACE_URL`
50+
51+
splunk_ingest_url = <value>
52+
* Endpoint for `SPLUNK_API_URL`
53+
54+
splunk_realm = <value>
55+
* Splunk Observability realm to use for the `SPLUNK_REALM` environment variable (ex us0)

0 commit comments

Comments
 (0)