Skip to content

Commit d787495

Browse files
puppet: support splunk-otel-java v2 (#5294)
1 parent 4b8f0f1 commit d787495

File tree

9 files changed

+95
-21
lines changed

9 files changed

+95
-21
lines changed

deployments/puppet/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Unreleased
44

5+
## puppet-v0.18.0
6+
7+
- Breaking change: The default for the `auto_instrumentation_otlp_endpoint` option has been changed from
8+
`http://127.0.0.1:4317` to `''` (empty), i.e. defer to the default `OTEL_EXPORTER_OTLP_ENDPOINT` value for each
9+
activated SDK.
10+
- Add support for the `auto_instrumentation_otlp_endpoint_protocol`, `auto_instrumentation_metrics_exporter`, and
11+
`auto_instrumentation_logs_exporter` options to configure the `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_METRICS_EXPORTER`,
12+
and `OTEL_LOGS_EXPORTER` environment variables, respectively.
13+
514
## puppet-v0.17.0
615

716
- Use `$facts['os']['family']` instead of the legacy `$::osfamily` fact

deployments/puppet/README.md

Lines changed: 20 additions & 17 deletions
Large diffs are not rendered by default.

deployments/puppet/manifests/init.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
$auto_instrumentation_enable_profiler = false, # linux only
4747
$auto_instrumentation_enable_profiler_memory = false, # linux only
4848
$auto_instrumentation_enable_metrics = false, # linux only
49-
$auto_instrumentation_otlp_endpoint = 'http://127.0.0.1:4317', # linux only
49+
$auto_instrumentation_otlp_endpoint = '', # linux only
50+
$auto_instrumentation_otlp_endpoint_protocol = '', # linux only
51+
$auto_instrumentation_metrics_exporter = '', # linux only
52+
$auto_instrumentation_logs_exporter = '', # linux only
5053
$with_auto_instrumentation_sdks = ['java', 'nodejs', 'dotnet'], # linux only
5154
$auto_instrumentation_npm_path = 'npm', # linux only
5255
$collector_additional_env_vars = {}

deployments/puppet/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "signalfx-splunk_otel_collector",
3-
"version": "0.17.0",
3+
"version": "0.18.0",
44
"author": "Splunk, Inc.",
55
"summary": "This module installs the Splunk OpenTelemetry Collector via distro packages and configures it.",
66
"license": "Apache-2.0",

deployments/puppet/templates/00-splunk-otel-auto-instrumentation.conf.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,15 @@ DefaultEnvironment="OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>"
2626
DefaultEnvironment="SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>"
2727
DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>"
2828
DefaultEnvironment="SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>"
29+
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
2930
DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>"
31+
<% end -%>
32+
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
33+
DefaultEnvironment="OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>"
34+
<% end -%>
35+
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
36+
DefaultEnvironment="OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>"
37+
<% end -%>
38+
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
39+
DefaultEnvironment="OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>"
40+
<% end -%>

deployments/puppet/templates/dotnet.conf.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,15 @@ OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>
1717
SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>
1818
SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>
1919
SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>
20+
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
2021
OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>
22+
<% end -%>
23+
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
24+
OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>
25+
<% end -%>
26+
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
27+
OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>
28+
<% end -%>
29+
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
30+
OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>
31+
<% end -%>

deployments/puppet/templates/java.conf.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,15 @@ OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>
1010
SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>
1111
SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>
1212
SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>
13+
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
1314
OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>
15+
<% end -%>
16+
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
17+
OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>
18+
<% end -%>
19+
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
20+
OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>
21+
<% end -%>
22+
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
23+
OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>
24+
<% end -%>

deployments/puppet/templates/node.conf.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,15 @@ OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>
1010
SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>
1111
SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>
1212
SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>
13+
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
1314
OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>
15+
<% end -%>
16+
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
17+
OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>
18+
<% end -%>
19+
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
20+
OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>
21+
<% end -%>
22+
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
23+
OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>
24+
<% end -%>

internal/buildscripts/packaging/tests/deployments/puppet/puppet_test.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ def test_puppet_with_default_instrumentation(distro, puppet_release, version, wi
291291
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_ENABLED", "false")
292292
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_MEMORY_ENABLED", "false")
293293
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_METRICS_ENABLED", "false")
294-
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317")
294+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", ".*", exists=False)
295+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_PROTOCOL", ".*", exists=False)
296+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_METRICS_EXPORTER", ".*", exists=False)
297+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_LOGS_EXPORTER", ".*", exists=False)
295298
if version == "latest":
296299
verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS)
297300
verify_dotnet_config(container, SYSTEMD_CONFIG_PATH)
@@ -309,7 +312,10 @@ def test_puppet_with_default_instrumentation(distro, puppet_release, version, wi
309312
verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "false")
310313
verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "false")
311314
verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "false")
312-
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317")
315+
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", ".*", exists=False)
316+
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_PROTOCOL", ".*", exists=False)
317+
verify_config_file(container, config_path, "OTEL_METRICS_EXPORTER", ".*", exists=False)
318+
verify_config_file(container, config_path, "OTEL_LOGS_EXPORTER", ".*", exists=False)
313319
else:
314320
for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, SYSTEMD_CONFIG_PATH]:
315321
assert not container_file_exists(container, config_path)
@@ -342,6 +348,9 @@ class {{ splunk_otel_collector:
342348
auto_instrumentation_enable_profiler_memory => true,
343349
auto_instrumentation_enable_metrics => true,
344350
auto_instrumentation_otlp_endpoint => 'http://0.0.0.0:4317',
351+
auto_instrumentation_otlp_endpoint_protocol => 'grpc',
352+
auto_instrumentation_metrics_exporter => 'none',
353+
auto_instrumentation_logs_exporter => 'none',
345354
}}
346355
"""
347356
)
@@ -396,6 +405,9 @@ def test_puppet_with_custom_instrumentation(distro, puppet_release, version, wit
396405
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_MEMORY_ENABLED", "true")
397406
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_METRICS_ENABLED", "true")
398407
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317")
408+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_PROTOCOL", r"grpc")
409+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_METRICS_EXPORTER", r"none")
410+
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_LOGS_EXPORTER", r"none")
399411
if version == "latest":
400412
verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS)
401413
verify_dotnet_config(container, SYSTEMD_CONFIG_PATH)
@@ -415,6 +427,9 @@ def test_puppet_with_custom_instrumentation(distro, puppet_release, version, wit
415427
verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "true")
416428
verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "true")
417429
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317")
430+
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_PROTOCOL", r"grpc")
431+
verify_config_file(container, config_path, "OTEL_METRICS_EXPORTER", r"none")
432+
verify_config_file(container, config_path, "OTEL_LOGS_EXPORTER", r"none")
418433
else:
419434
for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, SYSTEMD_CONFIG_PATH]:
420435
assert not container_file_exists(container, config_path)

0 commit comments

Comments
 (0)