Skip to content

Commit 15fd2df

Browse files
srv-gh-o11y-gdijeffreyc-splunkbreedx-splkjinja2
authored
Update splunk-otel-javaagent to latest (#5029)
* Update splunk-otel-javaagent to latest * libsplunk: support OTEL_EXPORTER_OTLP_PROTOCOL and OTEL_EXPORTER_OTLP_PROTOCOL * update installer script * update changelog * Update CHANGELOG.md Co-authored-by: jason plumb <[email protected]> * Update internal/buildscripts/packaging/installer/install.sh Co-authored-by: Jina Jain <[email protected]> --------- Co-authored-by: jeffreyc-splunk <[email protected]> Co-authored-by: Jeff Cheng <[email protected]> Co-authored-by: jason plumb <[email protected]> Co-authored-by: Jina Jain <[email protected]>
1 parent 441403d commit 15fd2df

File tree

6 files changed

+124
-57
lines changed

6 files changed

+124
-57
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
report higher memory usage, but it will be bound to the same configured limits. If you want to revert to the previous
1212
behavior, set the `GOGC` environment variable to `100`.
1313
- (Splunk) Upgrade to golang 1.21.12
14+
- (Splunk) Auto Discovery for Linux:
15+
- Update `splunk-otel-java` to v2.5.0 for the `splunk-otel-auto-instrumentation` deb/rpm packages. This is a major version bump that includes breaking changes. Check the [release notes](https://github.com/signalfx/splunk-otel-java/releases/tag/v2.5.0) for details about breaking changes.
16+
- Linux installer script:
17+
- The default for the `--otlp-endpoint` option is now empty, i.e. defers to the default `OTEL_EXPORTER_OTLP_ENDPOINT` value for each activated SDK
18+
- Add new `--otlp-endpoint-protocol <protocol>` option to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable for the configured endpoint. Only applicable if the `--otlp-endpoint` option is also specified.
19+
- Add new `--metrics-exporter <exporter>` option to configure the `OTEL_METRICS_EXPORTER` environment variable for instrumentation metrics. Specify `none` to disable metric collection and export.
1420

1521
### 🧰 Bug fixes 🧰
1622

instrumentation/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ The following methods are supported to manually activate and configure Auto Inst
9090
Configuration of the respective agents is supported by the adding/updating the following environment variables in
9191
each of these files (***any environment variable not in this list will be ignored***):
9292
- `OTEL_EXPORTER_OTLP_ENDPOINT`
93+
- `OTEL_EXPORTER_OTLP_PROTOCOL`
94+
- `OTEL_METRICS_EXPORTER`
9395
- `OTEL_RESOURCE_ATTRIBUTES`
9496
- `OTEL_SERVICE_NAME`
9597
- `SPLUNK_METRICS_ENABLED`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.32.2
1+
v2.5.0

instrumentation/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define MAX_LINE_LENGTH 1023
77
#define MAX_LINES 50
88

9-
#define ALLOWED_ENV_VARS "OTEL_SERVICE_NAME", "OTEL_EXPORTER_OTLP_ENDPOINT", "OTEL_RESOURCE_ATTRIBUTES", "SPLUNK_PROFILER_ENABLED", "SPLUNK_PROFILER_MEMORY_ENABLED", "SPLUNK_METRICS_ENABLED", "JAVA_TOOL_OPTIONS", "NODE_OPTIONS", "CORECLR_ENABLE_PROFILING", "CORECLR_PROFILER", "CORECLR_PROFILER_PATH", "DOTNET_ADDITIONAL_DEPS", "DOTNET_SHARED_STORE", "DOTNET_STARTUP_HOOKS", "OTEL_DOTNET_AUTO_HOME", "OTEL_DOTNET_AUTO_PLUGINS"
9+
#define ALLOWED_ENV_VARS "OTEL_SERVICE_NAME", "OTEL_EXPORTER_OTLP_ENDPOINT", "OTEL_RESOURCE_ATTRIBUTES", "SPLUNK_PROFILER_ENABLED", "SPLUNK_PROFILER_MEMORY_ENABLED", "SPLUNK_METRICS_ENABLED", "JAVA_TOOL_OPTIONS", "NODE_OPTIONS", "CORECLR_ENABLE_PROFILING", "CORECLR_PROFILER", "CORECLR_PROFILER_PATH", "DOTNET_ADDITIONAL_DEPS", "DOTNET_SHARED_STORE", "DOTNET_STARTUP_HOOKS", "OTEL_DOTNET_AUTO_HOME", "OTEL_DOTNET_AUTO_PLUGINS", "OTEL_EXPORTER_OTLP_PROTOCOL", "OTEL_METRICS_EXPORTER"
1010

1111
static char *const allowed_env_vars[] = {ALLOWED_ENV_VARS};
1212
static size_t const allowed_env_vars_size = sizeof(allowed_env_vars) / sizeof(*allowed_env_vars);

internal/buildscripts/packaging/installer/install.sh

Lines changed: 99 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ service_name=""
116116
enable_profiler="false"
117117
enable_profiler_memory="false"
118118
enable_metrics="false"
119+
otlp_endpoint=""
120+
otlp_endpoint_protocol=""
121+
metrics_exporter=""
119122
java_zeroconfig_path="/etc/splunk/zeroconfig/java.conf"
120123
node_zeroconfig_path="/etc/splunk/zeroconfig/node.conf"
121124
dotnet_zeroconfig_path="/etc/splunk/zeroconfig/dotnet.conf"
@@ -496,7 +499,6 @@ disable_preload() {
496499
}
497500

498501
create_zeroconfig_java() {
499-
local otlp_endpoint="$1"
500502
local version="$( get_package_version splunk-otel-auto-instrumentation )"
501503
local resource_attributes="splunk.zc.method=splunk-otel-auto-instrumentation-${version}"
502504

@@ -513,12 +515,22 @@ OTEL_RESOURCE_ATTRIBUTES=${resource_attributes}
513515
SPLUNK_PROFILER_ENABLED=${enable_profiler}
514516
SPLUNK_PROFILER_MEMORY_ENABLED=${enable_profiler_memory}
515517
SPLUNK_METRICS_ENABLED=${enable_metrics}
516-
OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}
517518
EOH
518519

519520
if [ -n "$service_name" ]; then
520521
echo "OTEL_SERVICE_NAME=${service_name}" >> $java_zeroconfig_path
521522
fi
523+
524+
if [ -n "$otlp_endpoint" ]; then
525+
echo "OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}" >> $java_zeroconfig_path
526+
if [ -n "$otlp_endpoint_protocol" ]; then
527+
echo "OTEL_EXPORTER_OTLP_PROTOCOL=${otlp_endpoint_protocol}" >> $java_zeroconfig_path
528+
fi
529+
fi
530+
531+
if [ -n "$metrics_exporter" ]; then
532+
echo "OTEL_METRICS_EXPORTER=${metrics_exporter}" >> $java_zeroconfig_path
533+
fi
522534
}
523535

524536
splunk_otel_js_installed() {
@@ -561,7 +573,6 @@ install_node_package() {
561573
}
562574

563575
create_zeroconfig_node() {
564-
local otlp_endpoint="$1"
565576
local version="$( get_package_version splunk-otel-auto-instrumentation )"
566577
local resource_attributes="splunk.zc.method=splunk-otel-auto-instrumentation-${version}"
567578

@@ -578,16 +589,25 @@ OTEL_RESOURCE_ATTRIBUTES=${resource_attributes}
578589
SPLUNK_PROFILER_ENABLED=${enable_profiler}
579590
SPLUNK_PROFILER_MEMORY_ENABLED=${enable_profiler_memory}
580591
SPLUNK_METRICS_ENABLED=${enable_metrics}
581-
OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}
582592
EOH
583593

584594
if [ -n "$service_name" ]; then
585595
echo "OTEL_SERVICE_NAME=${service_name}" >> $node_zeroconfig_path
586596
fi
597+
598+
if [ -n "$otlp_endpoint" ]; then
599+
echo "OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}" >> $node_zeroconfig_path
600+
if [ -n "$otlp_endpoint_protocol" ]; then
601+
echo "OTEL_EXPORTER_OTLP_PROTOCOL=${otlp_endpoint_protocol}" >> $node_zeroconfig_path
602+
fi
603+
fi
604+
605+
if [ -n "$metrics_exporter" ]; then
606+
echo "OTEL_METRICS_EXPORTER=${metrics_exporter}" >> $node_zeroconfig_path
607+
fi
587608
}
588609

589610
create_zeroconfig_dotnet() {
590-
local otlp_endpoint="$1"
591611
local version="$( get_package_version splunk-otel-auto-instrumentation )"
592612
local resource_attributes="splunk.zc.method=splunk-otel-auto-instrumentation-${version}"
593613

@@ -611,17 +631,26 @@ OTEL_RESOURCE_ATTRIBUTES=${resource_attributes}
611631
SPLUNK_PROFILER_ENABLED=${enable_profiler}
612632
SPLUNK_PROFILER_MEMORY_ENABLED=${enable_profiler_memory}
613633
SPLUNK_METRICS_ENABLED=${enable_metrics}
614-
OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}
615634
EOH
616635

617636
if [ -n "$service_name" ]; then
618637
echo "OTEL_SERVICE_NAME=${service_name}" >> $dotnet_zeroconfig_path
619638
fi
639+
640+
if [ -n "$otlp_endpoint" ]; then
641+
echo "OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}" >> $dotnet_zeroconfig_path
642+
if [ -n "$otlp_endpoint_protocol" ]; then
643+
echo "OTEL_EXPORTER_OTLP_PROTOCOL=${otlp_endpoint_protocol}" >> $dotnet_zeroconfig_path
644+
fi
645+
fi
646+
647+
if [ -n "$metrics_exporter" ]; then
648+
echo "OTEL_METRICS_EXPORTER=${metrics_exporter}" >> $dotnet_zeroconfig_path
649+
fi
620650
}
621651

622652
create_systemd_instrumentation_config() {
623-
local otlp_endpoint="$1"
624-
local sdks="$2"
653+
local sdks="$1"
625654
local version="$( get_package_version splunk-otel-auto-instrumentation )"
626655
local resource_attributes="splunk.zc.method=splunk-otel-auto-instrumentation-${version}-systemd"
627656

@@ -640,13 +669,23 @@ DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=${resource_attributes}"
640669
DefaultEnvironment="SPLUNK_PROFILER_ENABLED=${enable_profiler}"
641670
DefaultEnvironment="SPLUNK_PROFILER_MEMORY_ENABLED=${enable_profiler_memory}"
642671
DefaultEnvironment="SPLUNK_METRICS_ENABLED=${enable_metrics}"
643-
DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}"
644672
EOH
645673

646674
if [ -n "$service_name" ]; then
647675
echo "DefaultEnvironment=\"OTEL_SERVICE_NAME=${service_name}\"" >> $systemd_instrumentation_config_path
648676
fi
649677

678+
if [ -n "$otlp_endpoint" ]; then
679+
echo "DefaultEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=${otlp_endpoint}\"" >> $systemd_instrumentation_config_path
680+
if [ -n "$otlp_endpoint_protocol" ]; then
681+
echo "DefaultEnvironment=\"OTEL_EXPORTER_OTLP_PROTOCOL=${otlp_endpoint_protocol}\"" >> $systemd_instrumentation_config_path
682+
fi
683+
fi
684+
685+
if [ -n "$metrics_exporter" ]; then
686+
echo "DefaultEnvironment=\"OTEL_METRICS_EXPORTER=${metrics_exporter}\"" >> $systemd_instrumentation_config_path
687+
fi
688+
650689
if item_in_list "java" "$sdks"; then
651690
echo "DefaultEnvironment=\"JAVA_TOOL_OPTIONS=-javaagent:${instrumentation_jar_path}\"" >> $systemd_instrumentation_config_path
652691
fi
@@ -910,48 +949,54 @@ Auto Instrumentation:
910949
(default: --without-systemd-instrumentation)
911950
--with[out]-instrumentation-sdk "<s>" Whether to enable Auto Instrumentation for a specific language. This option
912951
takes a comma separated set of values representing supported
913-
auto-instrumentation SDKs. Currently supported: java,node,dotnet.
952+
auto-instrumentation SDKs.
953+
Currently supported values: "java", "node", and "dotnet"
914954
Use --with-instrumentation-sdk to enable only the specified language(s),
915955
for example "--with-instrumentation-sdk java".
916956
*Note*: .NET (dotnet) auto instrumentation is only supported on x86_64/amd64.
917-
(default: --with-instrumentation-sdk "$( echo $all_sdks | tr ' ' ',' )" if
918-
--with-instrumentation or --with-systemd-instrumentation is also specified)
957+
(default: --with-instrumentation-sdk $( echo $all_sdks | tr ' ' ',' ))
919958
--npm-path <path> If Auto Instrumentation for Node.js is enabled, npm is required to install the
920959
included Splunk OpenTelemetry Auto Instrumentation for Node.js package. If npm
921-
is not found via the 'command -v npm' shell command or if installation fails,
960+
is not found via the "command -v npm" shell command or if installation fails,
922961
Auto Instrumentation for Node.js will not be activated. Use this option to
923962
specify a custom path to npm, for example "/my/path/to/npm".
924963
(default: npm)
925-
--deployment-environment <value> Set the 'deployment.environment' resource attribute to the specified value.
964+
--deployment-environment <value> Set the "deployment.environment" resource attribute to the specified value.
926965
If not specified, the "Environment" in the Splunk APM UI will appear as
927-
"unknown" for the auto instrumented application(s).
928-
Only applicable if the '--with-instrumentation' or
929-
'--with-systemd-instrumentation' option is also specified.
966+
"unknown" for all instrumented applications. The resource attribute will be
967+
appended to the OTEL_RESOURCE_ATTRIBUTES environment variable.
930968
(default: empty)
931-
--service-name <name> Override the auto-generated service names for all instrumented Java applications
932-
on this host with '<name>'.
933-
Only applicable if the '--with-instrumentation' or
934-
'--with-systemd-instrumentation' option is also specified.
969+
--service-name <name> Override the auto-generated service names for all instrumented applications
970+
on this host with the specified value. The value will be set to the
971+
OTEL_SERVICE_NAME environment variable.
935972
(default: empty)
936-
--otlp-endpoint <host:port> Set the OTLP gRPC endpoint for captured traces.
937-
Only applicable if the '--with-systemd-instrumentation' option is also specified.
938-
(default: http://LISTEN_INTERFACE:4317 where LISTEN_INTERFACE is the value from
939-
the --listen-interface option if specified, or "127.0.0.1" otherwise)
940-
--[enable|disable]-profiler Enable or disable AlwaysOn Profiling.
941-
Only applicable if the '--with-instrumentation' or
942-
'--with-systemd-instrumentation' option is also specified.
973+
--otlp-endpoint <host:port> Set the OTLP endpoint for captured traces, logs, and metrics for all activated
974+
SDKs. The value will be set to the OTEL_EXPORTER_OTLP_ENDPOINT environment
975+
variable.
976+
(default: empty, i.e. defer to the default OTEL_EXPORTER_OTLP_ENDPOINT value for
977+
each activated SDK)
978+
--otlp-endpoint-protocol <protocol> Set the protocol for the configured OTLP endpoint, for example "grpc" or
979+
"http/protobuf". The value will be set to the OTEL_EXPORTER_OTLP_PROTOCOL
980+
environment variable.
981+
Only applicable if the "--otlp-endpoint <host:port>" option is also specified.
982+
(default: empty, i.e. defer to the default OTEL_EXPORTER_OTLP_PROTOCOL value for
983+
each activated SDK)
984+
--metrics-exporter <exporters> Comma-separated list of exporters for collected metrics by all activated SDKs,
985+
for example "otlp,prometheus". Set the value to "none" to disable collection and
986+
export of metrics. The value will be set to the OTEL_METRICS_EXPORTER
987+
environment variable.
988+
(default: empty, i.e. defer to the default OTEL_METRICS_EXPORTER value for each
989+
activated SDK)
990+
--[enable|disable]-profiler Enable or disable AlwaysOn Profiling for all activated SDKs that support the
991+
SPLUNK_PROFILER_ENABLED environment variable.
943992
(default: --disable-profiler)
944-
--[enable|disable]-profiler-memory Enable or disable AlwaysOn Memory Profiling.
945-
Only applicable if the '--with-instrumentation' or
946-
'--with-systemd-instrumentation' option is also specified.
993+
--[enable|disable]-profiler-memory Enable or disable AlwaysOn Memory Profiling for all activated SDKs that support
994+
the SPLUNK_PROFILER_MEMORY_ENABLED environment variable.
947995
(default: --disable-profiler-memory)
948-
--[enable|disable]-metrics Enable or disable instrumentation metrics collection.
949-
Only applicable if the '--with-instrumentation' or
950-
'--with-systemd-instrumentation' option is also specified.
996+
--[enable|disable]-metrics Enable or disable instrumentation metrics collection for all activated SDKs that
997+
support the SPLUNK_METRICS_ENABLED environment variable.
951998
(default: --disable-metrics)
952999
--instrumentation-version The splunk-otel-auto-instrumentation package version to install.
953-
Only applicable if the '--with-instrumentation' or
954-
'--with-systemd-instrumentation' option is also specified.
9551000
*Note*: The minimum supported version for Java and Node.js auto instrumentation
9561001
is 0.87.0, and the minimum supported version for .NET auto instrumentation is
9571002
0.99.0.
@@ -1191,7 +1236,6 @@ parse_args_and_install() {
11911236
local instrumentation_version="$default_instrumentation_version"
11921237
local deployment_environment="$default_deployment_environment"
11931238
local discovery=
1194-
local otlp_endpoint=""
11951239
local npm_path="npm"
11961240
local node_package_installed="false"
11971241
local with_sdks=""
@@ -1354,6 +1398,14 @@ parse_args_and_install() {
13541398
otlp_endpoint="$2"
13551399
shift 1
13561400
;;
1401+
--otlp-endpoint-protocol)
1402+
otlp_endpoint_protocol="$2"
1403+
shift 1
1404+
;;
1405+
--metrics-exporter)
1406+
metrics_exporter="$2"
1407+
shift 1
1408+
;;
13571409
--enable-profiler)
13581410
enable_profiler="true"
13591411
;;
@@ -1431,14 +1483,6 @@ parse_args_and_install() {
14311483
trace_url="${ingest_url}/v2/trace"
14321484
fi
14331485

1434-
if [ -z "$otlp_endpoint" ]; then
1435-
if [ -n "$listen_interface" ]; then
1436-
otlp_endpoint="http://${listen_interface}:4317"
1437-
else
1438-
otlp_endpoint="http://127.0.0.1:4317"
1439-
fi
1440-
fi
1441-
14421486
check_support
14431487

14441488
# check auto instrumentation options
@@ -1543,7 +1587,12 @@ parse_args_and_install() {
15431587
fi
15441588
echo " AlwaysOn Profiling enabled: $enable_profiler"
15451589
echo " AlwaysOn Memory Profiling enabled: $enable_profiler_memory"
1546-
echo " OTLP Endpoint: $otlp_endpoint"
1590+
if [ -n "$otlp_endpoint" ]; then
1591+
echo " OTLP Endpoint: $otlp_endpoint"
1592+
if [ -n "$otlp_endpoint_protocol" ]; then
1593+
echo " OTLP Endpoint Protocol: ${otlp_endpoint_protocol}"
1594+
fi
1595+
fi
15471596
fi
15481597
echo
15491598

@@ -1556,22 +1605,22 @@ parse_args_and_install() {
15561605

15571606
if [ "$with_instrumentation" = "true" ]; then
15581607
if item_in_list "java" "$sdks_to_enable"; then
1559-
create_zeroconfig_java "$otlp_endpoint"
1608+
create_zeroconfig_java
15601609
sdks_enabled=$( add_item_to_list "java" "$sdks_enabled" )
15611610
elif [ -f "$java_zeroconfig_path" ]; then
15621611
backup_file "$java_zeroconfig_path"
15631612
rm -f "$java_zeroconfig_path"
15641613
fi
15651614
if item_in_list "node" "$sdks_to_enable" && install_node_package "$npm_path"; then
1566-
create_zeroconfig_node "$otlp_endpoint"
1615+
create_zeroconfig_node
15671616
node_package_installed="true"
15681617
sdks_enabled=$( add_item_to_list "node" "$sdks_enabled" )
15691618
elif [ -f "$node_zeroconfig_path" ]; then
15701619
backup_file "$node_zeroconfig_path"
15711620
rm -f "$node_zeroconfig_path"
15721621
fi
15731622
if item_in_list "dotnet" "$sdks_to_enable" && [ -f "$dotnet_agent_path" ]; then
1574-
create_zeroconfig_dotnet "$otlp_endpoint"
1623+
create_zeroconfig_dotnet
15751624
sdks_enabled=$( add_item_to_list "dotnet" "$sdks_enabled" )
15761625
elif [ -f "$dotnet_zeroconfig_path" ]; then
15771626
backup_file "$dotnet_zeroconfig_path"
@@ -1599,7 +1648,7 @@ parse_args_and_install() {
15991648
sdks_enabled=$( remove_item_from_list "dotnet" "$sdks_enabled" )
16001649
fi
16011650
if [ -n "$sdks_enabled" ]; then
1602-
create_systemd_instrumentation_config "$otlp_endpoint" "$sdks_enabled"
1651+
create_systemd_instrumentation_config "$sdks_enabled"
16031652
else
16041653
backup_file "$systemd_instrumentation_config_path"
16051654
rm -f "$systemd_instrumentation_config_path"

0 commit comments

Comments
 (0)