Skip to content

Commit 39879c5

Browse files
authored
Merge branch 'main' into remote-eol-ubuntu
2 parents 924231b + 4c4fda7 commit 39879c5

File tree

14 files changed

+306
-37
lines changed

14 files changed

+306
-37
lines changed

.github/workflows/splunk-ta-otel.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
distribute-ta:
9797
name: "distribute-ta" # what gets run to package in gitlab
9898
runs-on: ubuntu-24.04
99-
needs: [setup-environment, check_changes]
99+
needs: [setup-environment, check_changes, test-discovery]
100100
if: needs.check_changes.outputs.ta_packaging_change == 'true' || needs.check_changes.outputs.ta_workflow_change == 'true'
101101
steps:
102102
- name: Check out the codebase.
@@ -106,3 +106,27 @@ jobs:
106106
run: |
107107
set -o pipefail
108108
PLATFORM="all" make -e distribute-ta
109+
110+
test-discovery:
111+
name: test-discovery
112+
runs-on: ubuntu-24.04
113+
needs: [setup-environment, test]
114+
strategy:
115+
matrix:
116+
PLATFORM: ["all"]
117+
steps:
118+
- name: Check out the codebase.
119+
uses: actions/checkout@v4
120+
121+
- name: Set up Go
122+
uses: actions/setup-go@v5
123+
with:
124+
go-version: ${{ env.GO_VERSION }}
125+
cache-dependency-path: '**/go.sum'
126+
127+
- name: Build & Package TA
128+
run: |
129+
set -o pipefail
130+
make -e bundle.d otelcol generate-technical-addon copy-local-build-to-ta package-ta
131+
make -e discovery-test-ta
132+

cmd/otelcol/config/collector/fargate_config.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# This collector config file is designed for use within an ECS task.
22
# The collector should run in a sidecar container within an ECS task.
3-
config_sources:
4-
env:
5-
defaults:
6-
METRICS_TO_EXCLUDE: []
7-
83
extensions:
94
health_check:
105
endpoint: 0.0.0.0:13133
@@ -73,14 +68,6 @@ processors:
7368
resourcedetection:
7469
detectors: [ecs]
7570
override: false
76-
# Enables the filter processor with example settings
77-
# Full configuration here: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/filterprocessor
78-
# NOTE: These settings need to be change when using this processor
79-
filter/1:
80-
metrics:
81-
exclude:
82-
match_type: regexp
83-
metric_names: ${env:METRICS_TO_EXCLUDE}
8471
# Optional: The following processor can be used to add a default "deployment.environment" attribute to the logs and
8572
# traces when it's not populated by instrumentation libraries.
8673
# If enabled, make sure to enable this processor in the pipeline below.

cmd/otelcol/fips/config/fargate_config.yaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# This collector config file is designed for use within an ECS task.
22
# The collector should run in a sidecar container within an ECS task.
3-
config_sources:
4-
env:
5-
defaults:
6-
METRICS_TO_EXCLUDE: []
7-
83
extensions:
94
health_check:
105
endpoint: 0.0.0.0:13133
@@ -70,14 +65,7 @@ processors:
7065
resourcedetection:
7166
detectors: [ecs]
7267
override: false
73-
# Enables the filter processor with example settings
74-
# Full configuration here: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/filterprocessor
75-
# NOTE: These settings need to be change when using this processor
76-
filter/1:
77-
metrics:
78-
exclude:
79-
match_type: regexp
80-
metric_names: ${env:METRICS_TO_EXCLUDE}
68+
8169
# Optional: The following processor can be used to add a default "deployment.environment" attribute to the logs and
8270
# traces when it's not populated by instrumentation libraries.
8371
# If enabled, make sure to enable this processor in the pipeline below.

deployments/fargate/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ In summary, the default Collector container definition does the following:
5353
- Sets the realm using environment variable `SPLUNK_REALM`.
5454
- Sets the default configuration file path using environment variable `SPLUNK_CONFIG`.
5555

56-
Assign a stringified array of metrics you want excluded to environment variable
57-
`METRICS_TO_EXCLUDE`. You can set the memory limit for the memory limiter processor using
56+
You can set the memory limit for the memory limiter processor using
5857
environment variable `SPLUNK_MEMORY_LIMIT_MIB`. The default memory limit is 512 MiB. For
5958
more information about the memory limiter processor, see
6059
[here](https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/memorylimiterprocessor/README.md)

packaging/technical-addon/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ smoketest-ta:
108108
PLATFORM="$(PLATFORM)" \
109109
$(SOURCE_DIR)/packaging-scripts/cicd-tests/smoketests/smoketest.sh
110110

111+
.PHONY: discovery-test-ta
112+
discovery-test-ta:
113+
SOURCE_DIR="$(SOURCE_DIR)" \
114+
BUILD_DIR="$(BUILD_DIR)" \
115+
ARCH="$(ARCH)" \
116+
PLATFORM="$(PLATFORM)" \
117+
$(SOURCE_DIR)/packaging-scripts/cicd-tests/discovery/discovery-docker-test.sh
118+
119+
111120
.PHONY: update-ta-deps
112121
update-ta-deps:
113122
SOURCE_DIR="$(SOURCE_DIR)" \

packaging/technical-addon/Splunk_TA_otel/README/inputs.conf.spec

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ splunk_config = <value>
2525
* Value to use for the `SPLUNK_CONFIG` environment variable (default `$SPLUNK_OTEL_TA_HOME/config/ta_agent_config.yaml`)
2626

2727
splunk_config_dir = <value>
28-
* Value to use for the `SPLUNK_CONFIG_DIR` environment variable (default `$SPLUNK_OTEL_TA_HOME/config/`)
28+
* Value to use for the `SPLUNK_CONFIG_DIR` environment variable (default `$SPLUNK_OTEL_TA_HOME/config/`). Same as `--configd` parameter as defined in https://github.com/signalfx/splunk-otel-collector/blob/v0.114.0/internal/confmapprovider/discovery/README.md?plain=1#L47
2929

3030
splunk_debug_config_server = <value>
3131
* Value to use for the `SPLUNK_DEBUG_CONFIG_SERVER` environment variable
@@ -50,3 +50,12 @@ splunk_ingest_url = <value>
5050

5151
splunk_realm = <value>
5252
* Splunk Observability realm to use for the `SPLUNK_REALM` environment variable (ex us0)
53+
54+
discovery = <value>
55+
* Boolean, if `true` will enable `--discovery`
56+
57+
discovery_properties = <value>
58+
* String, same as `--discovery-properties` parameter. See [properties reference](https://github.com/signalfx/splunk-otel-collector/blob/v0.114.0/internal/confmapprovider/discovery/README.md?plain=1#L175)
59+
60+
configd = <value>
61+
* Boolean, if `true` will enable `--configd`

packaging/technical-addon/Splunk_TA_otel/linux_x86_64/bin/Splunk_TA_otel.sh

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22

3-
43
# script args related vars
54
splunk_TA_otel_num_args="$#"
65
splunk_TA_otel_args=("$@")
@@ -17,8 +16,16 @@ if [ -z "$SPLUNK_HOME" ]; then
1716
SPLUNK_HOME="$(realpath "$SPLUNK_OTEL_TA_HOME/../../../")"
1817
fi
1918

19+
SPLUNK_OTEL_FLAGS=""
20+
#SPLUNK_OTEL_TA_DEBUG="DEBUG"
2021

2122
# Begin autogenerated code
23+
configd_name="configd"
24+
configd_value=""
25+
discovery_name="discovery"
26+
discovery_value=""
27+
discovery_properties_name="discovery_properties"
28+
discovery_properties_value=""
2229
gomemlimit_name="gomemlimit"
2330
gomemlimit_value=""
2431
splunk_api_url_name="splunk_api_url"
@@ -112,6 +119,27 @@ splunk_TA_otel_read_configs() {
112119
splunk_TA_otel_log_msg "DEBUG" "line: $line"
113120

114121
# Begin autogenerated code
122+
has_configd="$(echo "$line" | grep "$configd_name")"
123+
if [ "$has_configd" ] ; then
124+
splunk_TA_otel_log_msg "DEBUG" "reading $configd_name from line $has_configd"
125+
configd_value="$(echo "$has_configd" | grep -Eo ">(.*?)<" | sed 's/^>\(.*\)<$/\1/')"
126+
splunk_TA_otel_log_msg "DEBUG" "Set $configd_name to $configd_value"
127+
fi
128+
129+
has_discovery="$(echo "$line" | grep "$discovery_name")"
130+
if [ "$has_discovery" ] ; then
131+
splunk_TA_otel_log_msg "DEBUG" "reading $discovery_name from line $has_discovery"
132+
discovery_value="$(echo "$has_discovery" | grep -Eo ">(.*?)<" | sed 's/^>\(.*\)<$/\1/')"
133+
splunk_TA_otel_log_msg "DEBUG" "Set $discovery_name to $discovery_value"
134+
fi
135+
136+
has_discovery_properties="$(echo "$line" | grep "$discovery_properties_name")"
137+
if [ "$has_discovery_properties" ] ; then
138+
splunk_TA_otel_log_msg "DEBUG" "reading $discovery_properties_name from line $has_discovery_properties"
139+
discovery_properties_value="$(echo "$has_discovery_properties" | grep -Eo ">(.*?)<" | sed 's/^>\(.*\)<$/\1/')"
140+
splunk_TA_otel_log_msg "DEBUG" "Set $discovery_properties_name to $discovery_properties_value"
141+
fi
142+
115143
has_gomemlimit="$(echo "$line" | grep "$gomemlimit_name")"
116144
if [ "$has_gomemlimit" ] ; then
117145
splunk_TA_otel_log_msg "DEBUG" "reading $gomemlimit_name from line $has_gomemlimit"
@@ -274,6 +302,8 @@ splunk_TA_otel_run_agent() {
274302
splunk_collectd_dir_value="$(Splunk_TA_otel_expand_config_param "$splunk_collectd_dir_value")"
275303
splunk_otel_log_file_value="$(Splunk_TA_otel_expand_config_param "$splunk_otel_log_file_value")"
276304
splunk_access_token_file_value="$(Splunk_TA_otel_expand_config_param "$splunk_access_token_file_value")"
305+
discovery_properties_value="$(Splunk_TA_otel_expand_config_param "$discovery_properties_value")"
306+
splunk_config_dir_value="$(Splunk_TA_otel_expand_config_param "$splunk_config_dir_value")"
277307

278308
get_access_token
279309
if [[ $? == 1 ]] ; then
@@ -307,11 +337,13 @@ splunk_TA_otel_run_agent() {
307337
fi
308338
if [ "$splunk_config_value" ] ; then
309339
export SPLUNK_CONFIG="$splunk_config_value"
340+
SPLUNK_OTEL_FLAGS="$SPLUNK_OTEL_FLAGS --config=$splunk_config_value"
310341
else
311342
splunk_TA_otel_log_msg "DEBUG" "NOT SET: $splunk_config_name"
312343
fi
313344
if [ "$splunk_config_dir_value" ] ; then
314345
export SPLUNK_CONFIG_DIR="$splunk_config_dir_value"
346+
SPLUNK_OTEL_FLAGS="$SPLUNK_OTEL_FLAGS --config-dir=$splunk_config_dir_value"
315347
else
316348
splunk_TA_otel_log_msg "DEBUG" "NOT SET: $splunk_config_dir_name"
317349
fi
@@ -370,6 +402,21 @@ splunk_TA_otel_run_agent() {
370402
else
371403
splunk_TA_otel_log_msg "DEBUG" "NOT SET: $splunk_realm_name"
372404
fi
405+
if [ "$configd_value" ] ; then
406+
SPLUNK_OTEL_FLAGS="$SPLUNK_OTEL_FLAGS --configd"
407+
else
408+
splunk_TA_otel_log_msg "INFO" "BOOLEAN PARAM NOT SET: $configd_name"
409+
fi
410+
if [ "$discovery_value" ] ; then
411+
SPLUNK_OTEL_FLAGS="$SPLUNK_OTEL_FLAGS --discovery"
412+
else
413+
splunk_TA_otel_log_msg "INFO" "BOOLEAN PARAM NOT SET: $discovery_name"
414+
fi
415+
if [ "$discovery_properties_value" ] ; then
416+
SPLUNK_OTEL_FLAGS="$SPLUNK_OTEL_FLAGS --discovery-properties=$discovery_properties_value"
417+
else
418+
splunk_TA_otel_log_msg "INFO" "STRING PARAM NOT SET: $discovery_properties_name"
419+
fi
373420
if [ "$splunk_access_token_file_value" ] ; then
374421
export SPLUNK_ACCESS_TOKEN_FILE="$splunk_access_token_file_value"
375422
else
@@ -410,7 +457,7 @@ splunk_TA_otel_run_agent() {
410457
LD_PRELOAD="$LD_PRELOAD" \
411458
LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
412459
SPLUNK_OTEL_TA_PLATFORM_HOME="$SPLUNK_OTEL_TA_PLATFORM_HOME" \
413-
"$otel_path" > "$splunk_otel_log_file_value" 2>&1 &
460+
"$otel_path" "$SPLUNK_OTEL_FLAGS" > "$splunk_otel_log_file_value" 2>&1 &
414461
splunk_TA_otel_pid="$!"
415462
is_splunk_TA_otel_agent_running "$splunk_TA_otel_pid"
416463
if [[ $? == 1 ]] ; then

packaging/technical-addon/Splunk_TA_otel/windows_x86_64/bin/Splunk_TA_otel.cmd

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ set "splunk_otel_common_ps_name=Splunk_TA_otel_utils.ps1"
77
set "SPLUNK_OTEL_TA_HOME="
88
set "SPLUNK_OTEL_TA_PLATFORM_HOME="
99

10-
10+
set "SPLUNK_OTEL_FLAGS="
1111
:: BEGIN AUTOGENERATED CODE
12+
set "configd_name=configd"
13+
set "configd_value="
14+
set "discovery_name=discovery"
15+
set "discovery_value="
16+
set "discovery_properties_name=discovery_properties"
17+
set "discovery_properties_value="
1218
set "gomemlimit_name=gomemlimit"
1319
set "gomemlimit_value="
1420
set "splunk_api_url_name=splunk_api_url"
@@ -109,11 +115,13 @@ if "%splunk_bundle_dir_value%" == "" (
109115
if "%splunk_config_value%" == "" (
110116
call :splunk_TA_otel_log_msg "DEBUG" "Param %splunk_config_name% not set"
111117
) else (
118+
set "SPLUNK_OTEL_FLAGS=%SPLUNK_OTEL_FLAGS% --config=%splunk_config_value%"
112119
set "SPLUNK_CONFIG=%splunk_config_value%"
113120
)
114121
if "%splunk_config_dir_value%" == "" (
115122
call :splunk_TA_otel_log_msg "DEBUG" "Param %splunk_config_dir_name% not set"
116123
) else (
124+
set "SPLUNK_OTEL_FLAGS=%SPLUNK_OTEL_FLAGS% --config-dir=%splunk_config_dir_value%"
117125
set "SPLUNK_CONFIG_DIR=%splunk_config_dir_value%"
118126
)
119127
if "%splunk_collectd_dir_value%" == "" (
@@ -176,13 +184,28 @@ if "%splunk_access_token_file_value%" == "" (
176184
) else (
177185
set "SPLUNK_ACCESS_TOKEN_FILE=%splunk_access_token_file_value%"
178186
)
187+
if "%configd_value%" == "true" (
188+
set "SPLUNK_OTEL_FLAGS=%SPLUNK_OTEL_FLAGS% --configd"
189+
) else (
190+
call :splunk_TA_otel_log_msg "DEBUG" "Optional flag %configd_name% not set"
191+
)
192+
if "%discovery_value%" == "true" (
193+
set "SPLUNK_OTEL_FLAGS=%SPLUNK_OTEL_FLAGS% --discovery"
194+
) else (
195+
call :splunk_TA_otel_log_msg "DEBUG" "Optional flag %discovery_name% not set"
196+
)
197+
if "%discovery_properties_value%" != "" (
198+
set "SPLUNK_OTEL_FLAGS=%SPLUNK_OTEL_FLAGS% --discovery-properties=%discovery_properties_value%"
199+
) else (
200+
call :splunk_TA_otel_log_msg "DEBUG" "Optional flag %discovery_properties_name% not set"
201+
)
179202
:: END AUTOGENERATED CODE
180203

181204
:: Extract agent bundle
182205
call :extract_bundle
183206

184207
set "command_line=%splunk_TA_otel_app_directory%%splunk_otel_process_name%"
185-
start /B "" "%command_line%" > "%splunk_otel_log_file_value%" 2>&1
208+
start /B "" "%command_line%" "%SPLUNK_OTEL_FLAGS%" > "%splunk_otel_log_file_value%" 2>&1
186209
set "splunk_otel_common_ps=%splunk_TA_otel_app_directory%%splunk_otel_common_ps_name%"
187210
start /B "" /I /WAIT powershell "& '%splunk_otel_common_ps%' '%splunk_otel_process_name%' '%splunk_TA_otel_log_file%'"
188211

@@ -212,7 +235,12 @@ exit /B 0
212235
:splunk_TA_otel_read_configs
213236
echo "INFO grabbing config from stdin..."
214237

215-
for /F "tokens=1,2 delims==" %%I in ('powershell -noninteractive -noprofile -command "$input | Select-String -Pattern '.*?(%gomemlimit_name%|%splunk_api_url_name%|%splunk_bundle_dir_name%|%splunk_config_name%|%splunk_config_dir_name%|%splunk_collectd_dir_name%|%splunk_debug_config_server_name%|%splunk_config_yaml_name%|%splunk_gateway_url_name%|%splunk_hec_url_name%|%splunk_listen_interface_name%|%splunk_memory_limit_mib_name%|%splunk_memory_total_mib_name%|%splunk_otel_log_file_name%|%splunk_ingest_url_name%|%splunk_realm_name%|%splunk_access_token_file_name%|session_key).*?>(.*?)<' | ForEach-Object { $_.Matches.Groups[1].Value + '=' + $_.Matches.Groups[2].Value }"') do (
238+
239+
240+
for /F "tokens=1,2 delims==" %%I in ('powershell -noninteractive -noprofile -command "$input | Select-String -Pattern '.*?(%configd_name%|%discovery_name%|%discovery_properties_name%|%gomemlimit_name%|%splunk_access_token_file_name%|%splunk_api_url_name%|%splunk_ballast_size_mib_name%|%splunk_bundle_dir_name%|%splunk_collectd_dir_name%|%splunk_config_name%|%splunk_config_dir_name%|%splunk_config_yaml_name%|%splunk_debug_config_server_name%|%splunk_gateway_url_name%|%splunk_hec_url_name%|%splunk_ingest_url_name%|%splunk_listen_interface_name%|%splunk_memory_limit_mib_name%|%splunk_memory_total_mib_name%|%splunk_otel_log_file_name%|%splunk_realm_name%).*?>(.*?)<' | ForEach-Object { $_.Matches.Groups[1].Value + '=' + $_.Matches.Groups[2].Value }"') do (
241+
if "%%I"=="%configd_name%" set "configd_value=%%J"
242+
if "%%I"=="%discovery_name%" set "discovery_value=%%J"
243+
if "%%I"=="%discovery_properties_name%" set "discovery_properties_value=%%J"
216244
if "%%I"=="%gomemlimit_name%" set "gomemlimit_value=%%J"
217245
if "%%I"=="%splunk_api_url_name%" set "splunk_api_url_value=%%J"
218246
if "%%I"=="%splunk_bundle_dir_name%" set "splunk_bundle_dir_value=%%J"
@@ -339,6 +367,16 @@ for /f "delims=" %%i in ('powershell -noninteractive -noprofile -command "'%splu
339367
set "splunk_otel_log_file_value=%%i"
340368
)
341369

370+
:: expand params in discovery_properties_value
371+
for /f "delims=" %%i in ('powershell -noninteractive -noprofile -command "'%discovery_properties_value%' -replace '\$SPLUNK_OTEL_TA_PLATFORM_HOME', '%SPLUNK_OTEL_TA_PLATFORM_HOME%'"') do (
372+
set "discovery_properties_value=%%i"
373+
)
374+
for /f "delims=" %%i in ('powershell -noninteractive -noprofile -command "'%discovery_properties_value%' -replace '\$SPLUNK_OTEL_TA_HOME', '%SPLUNK_OTEL_TA_HOME%'"') do (
375+
set "discovery_properties_value=%%i"
376+
)
377+
for /f "delims=" %%i in ('powershell -noninteractive -noprofile -command "'%discovery_properties_value%' -replace '\$SPLUNK_HOME', '%SPLUNK_HOME%'"') do (
378+
set "discovery_properties_value=%%i"
379+
)
342380
:: END AUTOGENERATED CODE
343381

344382
:get_access_token

0 commit comments

Comments
 (0)