diff --git a/custom/build.gradle b/custom/build.gradle index fb6b13f9..f040ed09 100644 --- a/custom/build.gradle +++ b/custom/build.gradle @@ -1,5 +1,6 @@ plugins { id "java" + id "com.github.jarmstrong.buildconfig" version "1.9.0" } dependencies { @@ -8,7 +9,7 @@ dependencies { compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagentAlpha}") compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:${versions.opentelemetryJavaagent}") compileOnly("io.opentelemetry:opentelemetry-semconv:${versions.opentelemetryAlpha}") - compileOnly('org.checkerframework:checker-qual:3.21.2') + compileOnly('org.checkerframework:checker-qual:3.32.0') compileOnly project(path: ":bootstrap") compileOnly 'org.slf4j:slf4j-api:2.0.6' @@ -17,4 +18,13 @@ dependencies { compileOnly "com.google.auto.service:auto-service-annotations:1.0.1" annotationProcessor 'com.google.auto.service:auto-service:1.0.1' +} + +buildConfig { + buildConfigField('String', 'OTEL_AGENT_VERSION', "\"${versions.opentelemetry}\"") + buildConfigField('String', 'SOLARWINDS_AGENT_VERSION', "\"${versions.agent}\"" ) +} + +tasks.withType(Checkstyle) { + exclude '**/BuildConfig.java' } \ No newline at end of file diff --git a/custom/src/main/java/com/appoptics/opentelemetry/extensions/initialize/Initializer.java b/custom/src/main/java/com/appoptics/opentelemetry/extensions/initialize/Initializer.java index 5bf5f7ab..0134c35e 100644 --- a/custom/src/main/java/com/appoptics/opentelemetry/extensions/initialize/Initializer.java +++ b/custom/src/main/java/com/appoptics/opentelemetry/extensions/initialize/Initializer.java @@ -47,6 +47,7 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; +import otel_custom_distro.custom.BuildConfig; import java.io.File; import java.io.FileInputStream; @@ -97,9 +98,11 @@ public class Initializer { } public static void initialize() throws InvalidConfigException { + LOGGER.info(String.format("Otel agent version: %s", BuildConfig.OTEL_AGENT_VERSION)); + LOGGER.info(String.format("Solarwinds agent version: %s", BuildConfig.SOLARWINDS_AGENT_VERSION)); initializeConfig(); - registerShutdownTasks(); + registerShutdownTasks(); String serviceKey = (String) ConfigManager.getConfig(ConfigProperty.AGENT_SERVICE_KEY); LOGGER.info("Successfully initialized SolarwindsAPM OpenTelemetry extensions with service key " + ServiceKeyUtils.maskServiceKey(serviceKey)); }