Skip to content

Commit

Permalink
puppet: support splunk-otel-java v2 (#5294)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyc-splunk authored Aug 29, 2024
1 parent 4b8f0f1 commit d787495
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 21 deletions.
9 changes: 9 additions & 0 deletions deployments/puppet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Unreleased

## puppet-v0.18.0

- Breaking change: The default for the `auto_instrumentation_otlp_endpoint` option has been changed from
`http://127.0.0.1:4317` to `''` (empty), i.e. defer to the default `OTEL_EXPORTER_OTLP_ENDPOINT` value for each
activated SDK.
- Add support for the `auto_instrumentation_otlp_endpoint_protocol`, `auto_instrumentation_metrics_exporter`, and
`auto_instrumentation_logs_exporter` options to configure the `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_METRICS_EXPORTER`,
and `OTEL_LOGS_EXPORTER` environment variables, respectively.

## puppet-v0.17.0

- Use `$facts['os']['family']` instead of the legacy `$::osfamily` fact
Expand Down
37 changes: 20 additions & 17 deletions deployments/puppet/README.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion deployments/puppet/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
$auto_instrumentation_enable_profiler = false, # linux only
$auto_instrumentation_enable_profiler_memory = false, # linux only
$auto_instrumentation_enable_metrics = false, # linux only
$auto_instrumentation_otlp_endpoint = 'http://127.0.0.1:4317', # linux only
$auto_instrumentation_otlp_endpoint = '', # linux only
$auto_instrumentation_otlp_endpoint_protocol = '', # linux only
$auto_instrumentation_metrics_exporter = '', # linux only
$auto_instrumentation_logs_exporter = '', # linux only
$with_auto_instrumentation_sdks = ['java', 'nodejs', 'dotnet'], # linux only
$auto_instrumentation_npm_path = 'npm', # linux only
$collector_additional_env_vars = {}
Expand Down
2 changes: 1 addition & 1 deletion deployments/puppet/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "signalfx-splunk_otel_collector",
"version": "0.17.0",
"version": "0.18.0",
"author": "Splunk, Inc.",
"summary": "This module installs the Splunk OpenTelemetry Collector via distro packages and configures it.",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,15 @@ DefaultEnvironment="OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>"
DefaultEnvironment="SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>"
DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>"
DefaultEnvironment="SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>"
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>"
<% end -%>
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
DefaultEnvironment="OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>"
<% end -%>
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
DefaultEnvironment="OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>"
<% end -%>
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
DefaultEnvironment="OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>"
<% end -%>
11 changes: 11 additions & 0 deletions deployments/puppet/templates/dotnet.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,15 @@ OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>
SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>
SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>
SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>
<% end -%>
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>
<% end -%>
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>
<% end -%>
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>
<% end -%>
11 changes: 11 additions & 0 deletions deployments/puppet/templates/java.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>
SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>
SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>
SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>
<% end -%>
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>
<% end -%>
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>
<% end -%>
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>
<% end -%>
11 changes: 11 additions & 0 deletions deployments/puppet/templates/node.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ OTEL_SERVICE_NAME=<%= @auto_instrumentation_service_name %>
SPLUNK_PROFILER_ENABLED=<%= @auto_instrumentation_enable_profiler.to_s.downcase %>
SPLUNK_PROFILER_MEMORY_ENABLED=<%= @auto_instrumentation_enable_profiler_memory.to_s.downcase %>
SPLUNK_METRICS_ENABLED=<%= @auto_instrumentation_enable_metrics.to_s.downcase %>
<% if defined?(@auto_instrumentation_otlp_endpoint) && @auto_instrumentation_otlp_endpoint != "" -%>
OTEL_EXPORTER_OTLP_ENDPOINT=<%= @auto_instrumentation_otlp_endpoint %>
<% end -%>
<% if defined?(@auto_instrumentation_otlp_endpoint_protocol) && @auto_instrumentation_otlp_endpoint_protocol != "" -%>
OTEL_EXPORTER_OTLP_PROTOCOL=<%= @auto_instrumentation_otlp_endpoint_protocol %>
<% end -%>
<% if defined?(@auto_instrumentation_metrics_exporter) && @auto_instrumentation_metrics_exporter != "" -%>
OTEL_METRICS_EXPORTER=<%= @auto_instrumentation_metrics_exporter %>
<% end -%>
<% if defined?(@auto_instrumentation_logs_exporter) && @auto_instrumentation_logs_exporter != "" -%>
OTEL_LOGS_EXPORTER=<%= @auto_instrumentation_logs_exporter %>
<% end -%>
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ def test_puppet_with_default_instrumentation(distro, puppet_release, version, wi
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_ENABLED", "false")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_MEMORY_ENABLED", "false")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_METRICS_ENABLED", "false")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", ".*", exists=False)
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_PROTOCOL", ".*", exists=False)
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_METRICS_EXPORTER", ".*", exists=False)
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_LOGS_EXPORTER", ".*", exists=False)
if version == "latest":
verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS)
verify_dotnet_config(container, SYSTEMD_CONFIG_PATH)
Expand All @@ -309,7 +312,10 @@ def test_puppet_with_default_instrumentation(distro, puppet_release, version, wi
verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "false")
verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "false")
verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "false")
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317")
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", ".*", exists=False)
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_PROTOCOL", ".*", exists=False)
verify_config_file(container, config_path, "OTEL_METRICS_EXPORTER", ".*", exists=False)
verify_config_file(container, config_path, "OTEL_LOGS_EXPORTER", ".*", exists=False)
else:
for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, SYSTEMD_CONFIG_PATH]:
assert not container_file_exists(container, config_path)
Expand Down Expand Up @@ -342,6 +348,9 @@ class {{ splunk_otel_collector:
auto_instrumentation_enable_profiler_memory => true,
auto_instrumentation_enable_metrics => true,
auto_instrumentation_otlp_endpoint => 'http://0.0.0.0:4317',
auto_instrumentation_otlp_endpoint_protocol => 'grpc',
auto_instrumentation_metrics_exporter => 'none',
auto_instrumentation_logs_exporter => 'none',
}}
"""
)
Expand Down Expand Up @@ -396,6 +405,9 @@ def test_puppet_with_custom_instrumentation(distro, puppet_release, version, wit
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_MEMORY_ENABLED", "true")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_METRICS_ENABLED", "true")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_PROTOCOL", r"grpc")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_METRICS_EXPORTER", r"none")
verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_LOGS_EXPORTER", r"none")
if version == "latest":
verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS)
verify_dotnet_config(container, SYSTEMD_CONFIG_PATH)
Expand All @@ -415,6 +427,9 @@ def test_puppet_with_custom_instrumentation(distro, puppet_release, version, wit
verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "true")
verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "true")
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317")
verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_PROTOCOL", r"grpc")
verify_config_file(container, config_path, "OTEL_METRICS_EXPORTER", r"none")
verify_config_file(container, config_path, "OTEL_LOGS_EXPORTER", r"none")
else:
for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, SYSTEMD_CONFIG_PATH]:
assert not container_file_exists(container, config_path)
Expand Down

0 comments on commit d787495

Please sign in to comment.