|
15 | 15 | */
|
16 | 16 | package com.google.cloud.opentelemetry.trace;
|
17 | 17 |
|
| 18 | +import com.google.cloud.ServiceOptions; |
18 | 19 | import io.opentelemetry.sdk.common.CompletableResultCode;
|
19 | 20 | import io.opentelemetry.sdk.trace.data.SpanData;
|
20 | 21 | import io.opentelemetry.sdk.trace.export.SpanExporter;
|
@@ -42,10 +43,36 @@ private SpanExporter createActualTraceExporter() throws IOException {
|
42 | 43 | this.customTraceConfigurationBuilder.build());
|
43 | 44 | }
|
44 | 45 |
|
| 46 | + /** |
| 47 | + * Method that generates an instance of {@link TraceExporter} using a minimally configured {@link |
| 48 | + * TraceConfiguration} object that requires no input from the user. Since no project ID is |
| 49 | + * specified, default project ID is used instead. See {@link ServiceOptions#getDefaultProjectId()} |
| 50 | + * for details. |
| 51 | + * |
| 52 | + * <p>This method defers the creation of an actual {@link TraceExporter} to a point when it is |
| 53 | + * actually needed - which is when the spans need to be exported. As a result, while this method |
| 54 | + * does not throw any exception, an exception may still be thrown during the attempt to generate |
| 55 | + * the actual {@link TraceExporter}. |
| 56 | + * |
| 57 | + * @return An instance of {@link TraceExporter} as a {@link SpanExporter} object. |
| 58 | + */ |
45 | 59 | public static SpanExporter createWithDefaultConfiguration() {
|
46 | 60 | return generateStubTraceExporter(TraceConfiguration.builder());
|
47 | 61 | }
|
48 | 62 |
|
| 63 | + /** |
| 64 | + * Method that generates an instance of {@link TraceExporter} using a {@link |
| 65 | + * TraceConfiguration.Builder} that allows the user to provide preferences. |
| 66 | + * |
| 67 | + * <p>This method defers the creation of an actual {@link TraceExporter} to a point when it is |
| 68 | + * actually needed - which is when the spans need to be exported. As a result, while this method |
| 69 | + * does not throw any exception, an exception may still be thrown during the attempt to generate |
| 70 | + * the actual {@link TraceExporter}. |
| 71 | + * |
| 72 | + * @param configBuilder The {@link TraceConfiguration.Builder} object containing user preferences |
| 73 | + * for Trace. |
| 74 | + * @return An instance of {@link TraceExporter} as a {@link SpanExporter} object. |
| 75 | + */ |
49 | 76 | public static SpanExporter createWithConfiguration(TraceConfiguration.Builder configBuilder) {
|
50 | 77 | return generateStubTraceExporter(configBuilder);
|
51 | 78 | }
|
|
0 commit comments