Skip to content

Commit ab6bb69

Browse files
committed
Populate provided system properties from config.
1 parent d9bfa17 commit ab6bb69

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/java_buildpack/framework/open_telemetry_javaagent.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def release
3434
java_opts = @droplet.java_opts
3535
java_opts.add_javaagent(@droplet.sandbox + jar_name)
3636

37+
credentials = @application.services.find_service(REQUIRED_SERVICE_NAME_FILTER)['credentials']
38+
# Add all otel.* credentials from the service bind as jvm system properties
39+
credentials&.each do |key, value|
40+
java_opts.add_system_property(key, value) if key.start_with?('otel.')
41+
end
42+
43+
# Set the otel.service.name to the application_name if not specified in credentials
44+
return if credentials.key? 'otel.service.name'
45+
3746
# Set the otel.service.name to the application_name
3847
app_name = @application.details['application_name']
3948
java_opts.add_system_property('otel.service.name', app_name)

0 commit comments

Comments
 (0)