Skip to content

Commit

Permalink
Hardcode versions on all samples (#384)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
psx95 authored Oct 30, 2024
1 parent 6455156 commit 53d4fb9
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion examples/autoconf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions examples/autoinstrument/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions examples/metrics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion examples/otlp-spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion examples/otlpmetrics-function/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions examples/otlptrace/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 2 additions & 0 deletions examples/resource/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'

Expand Down
2 changes: 1 addition & 1 deletion examples/spring-sleuth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions examples/spring-sleuth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions examples/spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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=<YOUR_PROJECT>',
'-Dotel.traces.exporter=google_cloud_trace',
'-Dotel.metrics.exporter=google_cloud_monitoring,logging',
'-Dotel.logs.exporter=none',
Expand All @@ -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
}

Expand Down

0 comments on commit 53d4fb9

Please sign in to comment.