Skip to content

Commit 53d4fb9

Browse files
authored
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
1 parent 6455156 commit 53d4fb9

File tree

10 files changed

+24
-6
lines changed

10 files changed

+24
-6
lines changed

examples/autoconf/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ plugins {
1919
id 'com.google.cloud.tools.jib'
2020
}
2121

22-
2322
description = 'Examples for using java autoconfiguration and Google Cloud Operations'
2423

24+
// examples are not published, so version can be hardcoded
25+
version = '0.1.0'
26+
2527
dependencies {
2628
implementation(libraries.opentelemetry_api)
2729
implementation(libraries.opentelemetry_sdk_metrics)

examples/autoinstrument/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ plugins {
2222

2323
description = 'Examples for using java auto instrumentation and Google Cloud Operations'
2424

25+
// examples are not published, so version can be hardcoded
26+
version = '0.1.0'
27+
2528
configurations {
2629
agent
2730
}

examples/metrics/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ plugins {
1919
id 'com.google.cloud.tools.jib'
2020
}
2121

22+
// examples are not published, so version can be hardcoded
23+
version = '0.1.0'
24+
2225
// Set Docker image path here, e.g. using Google Container Registry or Docker Hub
2326
// https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#configuration
2427
jib {

examples/otlp-spring/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ plugins {
2121

2222
description = 'Example showcasing OTLP trace ingest on GCP and Google Auth in a Spring Boot App'
2323

24-
group 'com.google.cloud.opentelemetry.examples'
24+
// examples are not published, so version can be hardcoded
25+
version = '0.1.0'
2526

2627
repositories {
2728
mavenCentral()

examples/otlpmetrics-function/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ plugins {
2020

2121
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2222

23-
group 'org.example'
23+
// examples are not published, so version can be hardcoded
24+
version = '0.1.0'
2425

2526
repositories {
2627
mavenCentral()

examples/otlptrace/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ plugins {
1717
id 'java'
1818
id 'application'
1919
}
20+
// examples are not published, so version can be hardcoded
21+
version = '0.1.0'
2022

2123
mainClassName = 'com.google.cloud.opentelemetry.example.otlptrace.OTLPTraceExample'
2224

examples/resource/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ plugins {
1818
id 'application'
1919
id 'com.google.cloud.tools.jib'
2020
}
21+
// examples are not published, so version can be hardcoded
22+
version = '0.1.0'
2123

2224
description = 'Examples for showing resource detection in various GCP environments.'
2325

examples/spring-sleuth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cd examples/spring-sleuth/ && gradle bootJar
3535
The JAR built from the previous command typically ends up in `build/libs` -
3636

3737
```shell
38-
java -jar build/libs/examples-spring-sleuth-0.1.0-SNAPSHOT.jar
38+
java -jar build/libs/examples-spring-sleuth-0.1.0.jar
3939
```
4040

4141
The application is now running. To generate traces, head to `http://localhost:8080` in your browser.

examples/spring-sleuth/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ plugins {
1818
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
1919
id 'java'
2020
}
21+
// examples are not published, so version can be hardcoded
22+
version = '0.1.0'
2123

2224
jar {
2325
manifest {

examples/spring/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ plugins {
2020
id 'application'
2121
id 'com.google.cloud.tools.jib'
2222
}
23+
// examples are not published, so version can be hardcoded
24+
version = '0.1.0'
2325

2426
repositories {
2527
mavenCentral()
@@ -37,7 +39,7 @@ jar {
3739

3840
// OpenTelemetry Autoconfigure module can be configured using system properties
3941
def autoconf_config = [
40-
'-Dotel.resource.attributes=gcp.project_id=otel-test-sharmapranav',
42+
'-Dotel.resource.attributes=gcp.project_id=<YOUR_PROJECT>',
4143
'-Dotel.traces.exporter=google_cloud_trace',
4244
'-Dotel.metrics.exporter=google_cloud_monitoring,logging',
4345
'-Dotel.logs.exporter=none',
@@ -58,7 +60,7 @@ tasks.register('runApp', JavaExec) {
5860
description = "Builds and runs the spring application's execuable JAR"
5961

6062
dependsOn tasks.bootJar
61-
classpath = files('build/libs/examples-spring-0.1.0-SNAPSHOT.jar')
63+
classpath = files('build/libs/examples-spring-0.1.0.jar')
6264
jvmArgs = autoconf_config
6365
}
6466

0 commit comments

Comments
 (0)