Skip to content

Commit 8a2496f

Browse files
authored
Update auth extension usage in samples (#400)
1 parent ea23bcd commit 8a2496f

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ subprojects {
160160
googleTraceVersion = '2.51.0'
161161
googleCloudBomVersion = '26.48.0'
162162
cloudMonitoringVersion = '3.52.0'
163-
openTelemetryBomVersion = '1.46.0'
164-
openTelemetryVersion = '1.46.0'
163+
openTelemetryBomVersion = '1.47.0'
164+
openTelemetryVersion = '1.47.0'
165165
openTelemetryInstrumentationBomVersion = '2.12.0'
166166
openTelemetryInstrumentationVersion = '2.12.0'
167167
openTelemetrySemconvVersion = '1.29.0'
168-
openTelemetryContribVersion = '1.43.0'
168+
openTelemetryContribVersion = '1.44.0'
169169
junitVersion = '4.13'
170170
junit5Version = '5.10.0'
171171
mockitoVersion = '5.2.0'

examples/autoinstrument/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ configurations {
2929
agent
3030
}
3131

32-
// the shaded variant name for gcp auth extension is an empty string
33-
def gcp_auth_extension_shaded_classifier = ''
32+
// the shaded variant name for gcp auth extension
33+
def gcp_auth_extension_shaded_classifier = 'shadow'
3434

3535
dependencies {
3636
agent agentLibraries.agent

examples/otlp-spring/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ repositories {
2828
mavenCentral()
2929
}
3030

31-
// the shaded variant name for gcp auth extension is an empty string
32-
def gcp_auth_extension_shaded_classifier = ''
33-
3431
dependencies {
3532
implementation(libraries.opentelemetry_api)
3633
implementation(libraries.opentelemetry_sdk)
3734
implementation(libraries.opentelemetry_otlp_exporter)
3835
implementation(libraries.opentelemetry_sdk_autoconf)
39-
implementation("${libraries.opentelemetry_gcp_auth_extension}:${gcp_auth_extension_shaded_classifier}")
36+
implementation(libraries.opentelemetry_gcp_auth_extension)
4037
implementation(libraries.opentelemetry_gcp_resources)
4138

4239
implementation(libraries.spring_boot_starter_web)

examples/otlptrace/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ Finally, to run the sample from the project root:
2222
```
2323
cd examples/otlptrace && gradle run
2424
```
25+
26+
Running this sample will generate and export Traces to Google Cloud.

examples/otlptrace/build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,19 @@ plugins {
2020
// examples are not published, so version can be hardcoded
2121
version = '0.1.0'
2222

23-
description = 'Example for OTLP exporter'
24-
25-
// the shaded variant name for gcp auth extension is an empty string
26-
def gcp_auth_extension_shaded_classifier = ''
23+
description = 'Example showing OTLP exporter being used for traces export to GCP'
2724

2825
dependencies {
2926
implementation(libraries.opentelemetry_api)
3027
implementation(libraries.opentelemetry_sdk)
3128
implementation(libraries.opentelemetry_otlp_exporter)
3229
implementation(libraries.opentelemetry_sdk_autoconf)
33-
implementation("${libraries.opentelemetry_gcp_auth_extension}:${gcp_auth_extension_shaded_classifier}")
30+
implementation(libraries.opentelemetry_gcp_auth_extension)
3431
implementation(libraries.opentelemetry_gcp_resources)
3532
}
3633

3734
// Provide headers from env variable
3835
def autoconf_config = [
39-
'-Dgoogle.cloud.project=your-gcp-project-id',
4036
'-Dotel.exporter.otlp.endpoint=https://telemetry.googleapis.com',
4137
'-Dotel.traces.exporter=otlp',
4238
'-Dotel.logs.exporter=none',

examples/otlptrace/src/main/java/com/google/cloud/opentelemetry/example/otlptrace/OTLPTraceExample.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import io.opentelemetry.sdk.OpenTelemetrySdk;
2121
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
2222
import io.opentelemetry.sdk.common.CompletableResultCode;
23-
import java.io.IOException;
2423
import java.util.Random;
2524
import java.util.concurrent.TimeUnit;
2625

@@ -63,8 +62,8 @@ private static void doWork(String description) {
6362
}
6463
}
6564

66-
public static void main(String[] args) throws IOException {
67-
// Configure the OpenTelemetry pipeline with CloudTrace exporter
65+
public static void main(String[] args) {
66+
// Configure the OpenTelemetry pipeline with Auto configuration
6867
openTelemetrySdk = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
6968

7069
// Application-specific logic

0 commit comments

Comments
 (0)