|
56 | 56 | SYSTEMD_CONFIG_PATH = "/usr/lib/systemd/system.conf.d/00-splunk-otel-auto-instrumentation.conf"
|
57 | 57 | JAVA_CONFIG_PATH = "/etc/splunk/zeroconfig/java.conf"
|
58 | 58 | NODE_CONFIG_PATH = "/etc/splunk/zeroconfig/node.conf"
|
| 59 | +DOTNET_CONFIG_PATH = "/etc/splunk/zeroconfig/dotnet.conf" |
59 | 60 | NODE_PREFIX = "/usr/lib/splunk-instrumentation/splunk-otel-js"
|
60 | 61 | NODE_OPTIONS = f"-r {NODE_PREFIX}/node_modules/@splunk/otel/instrument"
|
| 62 | +DOTNET_HOME = "/usr/lib/splunk-instrumentation/splunk-otel-dotnet" |
| 63 | +DOTNET_AGENT_PATH = f"{DOTNET_HOME}/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so" |
| 64 | +DOTNET_VARS = { |
| 65 | + "CORECLR_ENABLE_PROFILING": "1", |
| 66 | + "CORECLR_PROFILER": "{918728DD-259F-4A6A-AC2B-B85E1B658318}", |
| 67 | + "CORECLR_PROFILER_PATH": DOTNET_AGENT_PATH, |
| 68 | + "DOTNET_ADDITIONAL_DEPS": f"{DOTNET_HOME}/AdditionalDeps", |
| 69 | + "DOTNET_SHARED_STORE": f"{DOTNET_HOME}/store", |
| 70 | + "DOTNET_STARTUP_HOOKS": f"{DOTNET_HOME}/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll", |
| 71 | + "OTEL_DOTNET_AUTO_HOME": DOTNET_HOME, |
| 72 | + "OTEL_DOTNET_AUTO_PLUGINS": |
| 73 | + "Splunk.OpenTelemetry.AutoInstrumentation.Plugin,Splunk.OpenTelemetry.AutoInstrumentation", |
| 74 | +} |
61 | 75 |
|
62 | 76 |
|
63 | 77 | def run_puppet_apply(container, config):
|
@@ -124,6 +138,12 @@ def node_package_installed(container):
|
124 | 138 | return rc == 0
|
125 | 139 |
|
126 | 140 |
|
| 141 | +def verify_dotnet_config(container, path, exists=True): |
| 142 | + for key, val in DOTNET_VARS.items(): |
| 143 | + val = val if exists else ".*" |
| 144 | + verify_config_file(container, path, key, val, exists=exists) |
| 145 | + |
| 146 | + |
127 | 147 | DEFAULT_CONFIG = f"""
|
128 | 148 | class {{ splunk_otel_collector:
|
129 | 149 | splunk_access_token => '{SPLUNK_ACCESS_TOKEN}',
|
@@ -256,25 +276,37 @@ def test_puppet_with_default_instrumentation(distro, puppet_release, version, wi
|
256 | 276 | if version == "latest":
|
257 | 277 | assert node_package_installed(container)
|
258 | 278 |
|
259 |
| - if version == "latest" or with_systemd == "true": |
260 |
| - config_path = SYSTEMD_CONFIG_PATH if with_systemd == "true" else JAVA_CONFIG_PATH |
261 |
| - verify_config_file(container, config_path, "JAVA_TOOL_OPTIONS", rf"-javaagent:{JAVA_AGENT_PATH}") |
262 |
| - verify_config_file(container, config_path, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
263 |
| - verify_config_file(container, config_path, "OTEL_SERVICE_NAME", ".*", exists=False) |
264 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "false") |
265 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "false") |
266 |
| - verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "false") |
267 |
| - verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317") |
268 |
| - |
269 |
| - config_path = SYSTEMD_CONFIG_PATH if with_systemd == "true" else NODE_CONFIG_PATH |
270 |
| - verify_config_file(container, config_path, "NODE_OPTIONS", NODE_OPTIONS) |
271 |
| - verify_config_file(container, config_path, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
272 |
| - verify_config_file(container, config_path, "OTEL_SERVICE_NAME", ".*", exists=False) |
273 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "false") |
274 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "false") |
275 |
| - verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "false") |
276 |
| - verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317") |
| 279 | + if with_systemd == "true": |
| 280 | + for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, INSTRUMENTATION_CONFIG_PATH]: |
| 281 | + assert not container_file_exists(container, config_path) |
| 282 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "JAVA_TOOL_OPTIONS", rf"-javaagent:{JAVA_AGENT_PATH}") |
| 283 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
| 284 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_SERVICE_NAME", ".*", exists=False) |
| 285 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_ENABLED", "false") |
| 286 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_MEMORY_ENABLED", "false") |
| 287 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_METRICS_ENABLED", "false") |
| 288 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317") |
| 289 | + if version == "latest": |
| 290 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS) |
| 291 | + verify_dotnet_config(container, SYSTEMD_CONFIG_PATH) |
| 292 | + else: |
| 293 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", ".*", exists=False) |
| 294 | + verify_dotnet_config(container, SYSTEMD_CONFIG_PATH, exists=False) |
| 295 | + elif version == "latest": |
| 296 | + assert not container_file_exists(container, SYSTEMD_CONFIG_PATH) |
| 297 | + verify_config_file(container, JAVA_CONFIG_PATH, "JAVA_TOOL_OPTIONS", rf"-javaagent:{JAVA_AGENT_PATH}") |
| 298 | + verify_config_file(container, NODE_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS) |
| 299 | + verify_dotnet_config(container, DOTNET_CONFIG_PATH) |
| 300 | + for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH]: |
| 301 | + verify_config_file(container, config_path, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
| 302 | + verify_config_file(container, config_path, "OTEL_SERVICE_NAME", ".*", exists=False) |
| 303 | + verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "false") |
| 304 | + verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "false") |
| 305 | + verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "false") |
| 306 | + verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://127.0.0.1:4317") |
277 | 307 | else:
|
| 308 | + for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, SYSTEMD_CONFIG_PATH]: |
| 309 | + assert not container_file_exists(container, config_path) |
278 | 310 | config_path = INSTRUMENTATION_CONFIG_PATH
|
279 | 311 | verify_package_version(container, "splunk-otel-auto-instrumentation", version)
|
280 | 312 | verify_config_file(container, config_path, "java_agent_jar", JAVA_AGENT_PATH)
|
@@ -346,25 +378,38 @@ def test_puppet_with_custom_instrumentation(distro, puppet_release, version, wit
|
346 | 378 | assert node_package_installed(container)
|
347 | 379 |
|
348 | 380 | resource_attributes = rf"{resource_attributes},deployment.environment=test"
|
349 |
| - if version == "latest" or with_systemd == "true": |
350 |
| - config_path = SYSTEMD_CONFIG_PATH if with_systemd == "true" else JAVA_CONFIG_PATH |
351 |
| - verify_config_file(container, config_path, "JAVA_TOOL_OPTIONS", rf"-javaagent:{JAVA_AGENT_PATH}") |
352 |
| - verify_config_file(container, config_path, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
353 |
| - verify_config_file(container, config_path, "OTEL_SERVICE_NAME", "test") |
354 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "true") |
355 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "true") |
356 |
| - verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "true") |
357 |
| - verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317") |
358 |
| - |
359 |
| - config_path = SYSTEMD_CONFIG_PATH if with_systemd == "true" else NODE_CONFIG_PATH |
360 |
| - verify_config_file(container, config_path, "NODE_OPTIONS", NODE_OPTIONS) |
361 |
| - verify_config_file(container, config_path, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
362 |
| - verify_config_file(container, config_path, "OTEL_SERVICE_NAME", "test") |
363 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "true") |
364 |
| - verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "true") |
365 |
| - verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "true") |
366 |
| - verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317") |
| 381 | + if with_systemd == "true": |
| 382 | + for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, INSTRUMENTATION_CONFIG_PATH]: |
| 383 | + assert not container_file_exists(container, config_path) |
| 384 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "JAVA_TOOL_OPTIONS", rf"-javaagent:{JAVA_AGENT_PATH}") |
| 385 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
| 386 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_SERVICE_NAME", "test") |
| 387 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_ENABLED", "true") |
| 388 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_PROFILER_MEMORY_ENABLED", "true") |
| 389 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "SPLUNK_METRICS_ENABLED", "true") |
| 390 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317") |
| 391 | + if version == "latest": |
| 392 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS) |
| 393 | + verify_dotnet_config(container, SYSTEMD_CONFIG_PATH) |
| 394 | + else: |
| 395 | + verify_config_file(container, SYSTEMD_CONFIG_PATH, "NODE_OPTIONS", ".*", exists=False) |
| 396 | + verify_dotnet_config(container, SYSTEMD_CONFIG_PATH, exists=False) |
| 397 | + elif version == "latest": |
| 398 | + for config_path in [SYSTEMD_CONFIG_PATH, INSTRUMENTATION_CONFIG_PATH]: |
| 399 | + assert not container_file_exists(container, config_path) |
| 400 | + verify_config_file(container, JAVA_CONFIG_PATH, "JAVA_TOOL_OPTIONS", rf"-javaagent:{JAVA_AGENT_PATH}") |
| 401 | + verify_config_file(container, NODE_CONFIG_PATH, "NODE_OPTIONS", NODE_OPTIONS) |
| 402 | + verify_dotnet_config(container, DOTNET_CONFIG_PATH) |
| 403 | + for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH]: |
| 404 | + verify_config_file(container, config_path, "OTEL_RESOURCE_ATTRIBUTES", resource_attributes) |
| 405 | + verify_config_file(container, config_path, "OTEL_SERVICE_NAME", "test") |
| 406 | + verify_config_file(container, config_path, "SPLUNK_PROFILER_ENABLED", "true") |
| 407 | + verify_config_file(container, config_path, "SPLUNK_PROFILER_MEMORY_ENABLED", "true") |
| 408 | + verify_config_file(container, config_path, "SPLUNK_METRICS_ENABLED", "true") |
| 409 | + verify_config_file(container, config_path, "OTEL_EXPORTER_OTLP_ENDPOINT", r"http://0.0.0.0:4317") |
367 | 410 | else:
|
| 411 | + for config_path in [JAVA_CONFIG_PATH, NODE_CONFIG_PATH, DOTNET_CONFIG_PATH, SYSTEMD_CONFIG_PATH]: |
| 412 | + assert not container_file_exists(container, config_path) |
368 | 413 | config_path = INSTRUMENTATION_CONFIG_PATH
|
369 | 414 | verify_package_version(container, "splunk-otel-auto-instrumentation", version)
|
370 | 415 | verify_config_file(container, config_path, "java_agent_jar", JAVA_AGENT_PATH)
|
|
0 commit comments