From 53d4fb9a49a6ce18c83f5c0e3ef7ed3cbdb69806 Mon Sep 17 00:00:00 2001 From: Pranav Sharma Date: Wed, 30 Oct 2024 13:55:56 -0400 Subject: [PATCH] Hardcode versions on all samples (#384) * Hardcode the version for examples-spring module * Hardcode version for spring-slueth example * Hardcode version for resource example * Hardcode version for otlptrace example * Hardcode version for otlpmetrics-function example * Hardcode version for otlp-spring example * Hardcode version for metrics example * Hardcode version for autoinstrument example * Hardcode version for autoconf example * Remove group from example modules * Change the name of placeholder variable * Change version numbers for samples to be 0.1.0 --- examples/autoconf/build.gradle | 4 +++- examples/autoinstrument/build.gradle | 3 +++ examples/metrics/build.gradle | 3 +++ examples/otlp-spring/build.gradle | 3 ++- examples/otlpmetrics-function/build.gradle | 3 ++- examples/otlptrace/build.gradle | 2 ++ examples/resource/build.gradle | 2 ++ examples/spring-sleuth/README.md | 2 +- examples/spring-sleuth/build.gradle | 2 ++ examples/spring/build.gradle | 6 ++++-- 10 files changed, 24 insertions(+), 6 deletions(-) diff --git a/examples/autoconf/build.gradle b/examples/autoconf/build.gradle index 56c91f36..5184eadf 100644 --- a/examples/autoconf/build.gradle +++ b/examples/autoconf/build.gradle @@ -19,9 +19,11 @@ plugins { id 'com.google.cloud.tools.jib' } - description = 'Examples for using java autoconfiguration and Google Cloud Operations' +// examples are not published, so version can be hardcoded +version = '0.1.0' + dependencies { implementation(libraries.opentelemetry_api) implementation(libraries.opentelemetry_sdk_metrics) diff --git a/examples/autoinstrument/build.gradle b/examples/autoinstrument/build.gradle index cfd2efa0..cef6a2bf 100644 --- a/examples/autoinstrument/build.gradle +++ b/examples/autoinstrument/build.gradle @@ -22,6 +22,9 @@ plugins { description = 'Examples for using java auto instrumentation and Google Cloud Operations' +// examples are not published, so version can be hardcoded +version = '0.1.0' + configurations { agent } diff --git a/examples/metrics/build.gradle b/examples/metrics/build.gradle index cecaf1ae..24f16f62 100644 --- a/examples/metrics/build.gradle +++ b/examples/metrics/build.gradle @@ -19,6 +19,9 @@ plugins { id 'com.google.cloud.tools.jib' } +// examples are not published, so version can be hardcoded +version = '0.1.0' + // Set Docker image path here, e.g. using Google Container Registry or Docker Hub // https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#configuration jib { diff --git a/examples/otlp-spring/build.gradle b/examples/otlp-spring/build.gradle index 9c6c6f18..c9a38cc2 100644 --- a/examples/otlp-spring/build.gradle +++ b/examples/otlp-spring/build.gradle @@ -21,7 +21,8 @@ plugins { description = 'Example showcasing OTLP trace ingest on GCP and Google Auth in a Spring Boot App' -group 'com.google.cloud.opentelemetry.examples' +// examples are not published, so version can be hardcoded +version = '0.1.0' repositories { mavenCentral() diff --git a/examples/otlpmetrics-function/build.gradle b/examples/otlpmetrics-function/build.gradle index d28f083b..018a5ee9 100644 --- a/examples/otlpmetrics-function/build.gradle +++ b/examples/otlpmetrics-function/build.gradle @@ -20,7 +20,8 @@ plugins { import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -group 'org.example' +// examples are not published, so version can be hardcoded +version = '0.1.0' repositories { mavenCentral() diff --git a/examples/otlptrace/build.gradle b/examples/otlptrace/build.gradle index 713117b6..f78ffec0 100644 --- a/examples/otlptrace/build.gradle +++ b/examples/otlptrace/build.gradle @@ -17,6 +17,8 @@ plugins { id 'java' id 'application' } +// examples are not published, so version can be hardcoded +version = '0.1.0' mainClassName = 'com.google.cloud.opentelemetry.example.otlptrace.OTLPTraceExample' diff --git a/examples/resource/build.gradle b/examples/resource/build.gradle index 9d452057..103c62fa 100644 --- a/examples/resource/build.gradle +++ b/examples/resource/build.gradle @@ -18,6 +18,8 @@ plugins { id 'application' id 'com.google.cloud.tools.jib' } +// examples are not published, so version can be hardcoded +version = '0.1.0' description = 'Examples for showing resource detection in various GCP environments.' diff --git a/examples/spring-sleuth/README.md b/examples/spring-sleuth/README.md index e2532946..188d50ab 100644 --- a/examples/spring-sleuth/README.md +++ b/examples/spring-sleuth/README.md @@ -35,7 +35,7 @@ cd examples/spring-sleuth/ && gradle bootJar The JAR built from the previous command typically ends up in `build/libs` - ```shell -java -jar build/libs/examples-spring-sleuth-0.1.0-SNAPSHOT.jar +java -jar build/libs/examples-spring-sleuth-0.1.0.jar ``` The application is now running. To generate traces, head to `http://localhost:8080` in your browser. diff --git a/examples/spring-sleuth/build.gradle b/examples/spring-sleuth/build.gradle index 8261e30e..198031fc 100644 --- a/examples/spring-sleuth/build.gradle +++ b/examples/spring-sleuth/build.gradle @@ -18,6 +18,8 @@ plugins { id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' } +// examples are not published, so version can be hardcoded +version = '0.1.0' jar { manifest { diff --git a/examples/spring/build.gradle b/examples/spring/build.gradle index cc4c54c3..3de4c228 100644 --- a/examples/spring/build.gradle +++ b/examples/spring/build.gradle @@ -20,6 +20,8 @@ plugins { id 'application' id 'com.google.cloud.tools.jib' } +// examples are not published, so version can be hardcoded +version = '0.1.0' repositories { mavenCentral() @@ -37,7 +39,7 @@ jar { // OpenTelemetry Autoconfigure module can be configured using system properties def autoconf_config = [ - '-Dotel.resource.attributes=gcp.project_id=otel-test-sharmapranav', + '-Dotel.resource.attributes=gcp.project_id=', '-Dotel.traces.exporter=google_cloud_trace', '-Dotel.metrics.exporter=google_cloud_monitoring,logging', '-Dotel.logs.exporter=none', @@ -58,7 +60,7 @@ tasks.register('runApp', JavaExec) { description = "Builds and runs the spring application's execuable JAR" dependsOn tasks.bootJar - classpath = files('build/libs/examples-spring-0.1.0-SNAPSHOT.jar') + classpath = files('build/libs/examples-spring-0.1.0.jar') jvmArgs = autoconf_config }