/** * Returns a new {@link Builder}. * * @return a {@code Builder}. * @since 0.12 */ public static Builder builder() { return new AutoValue_StackdriverTraceConfiguration.Builder(); }
/** * Unregisters the Stackdriver Trace exporter from the OpenCensus library. * * @throws IllegalStateException if a Stackdriver exporter is not registered. * @since 0.6 */ public static void unregister() { StackdriverTraceExporter.unregister(); }
/** * Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit * project ID and using explicit credentials. Only one Stackdriver exporter can be registered at * any point. * * @param credentials a credentials used to authenticate API calls. * @param projectId the cloud project id. * @throws IllegalStateException if a Stackdriver exporter is already registered. * @since 0.6 */ public static void createAndRegisterWithCredentialsAndProjectId( Credentials credentials, String projectId) throws IOException { StackdriverTraceExporter.createAndRegister( StackdriverTraceConfiguration.builder() .setCredentials(credentials) .setProjectId(projectId) .build()); }
@Test public void updateAll() { StackdriverTraceConfiguration configuration = StackdriverTraceConfiguration.builder() .setCredentials(FAKE_CREDENTIALS) .setProjectId(PROJECT_ID) .build(); assertThat(configuration.getCredentials()).isEqualTo(FAKE_CREDENTIALS); assertThat(configuration.getProjectId()).isEqualTo(PROJECT_ID); } }
private static void putToResourceAttributeMap( Map<String, AttributeValue> map, io.opencensus.contrib.monitoredresource.util.ResourceType resourceType, String attributeName, String attributeValue) { map.put( createResourceLabelKey(resourceType, attributeName), toStringAttributeValueProto(attributeValue)); }
/** * Registers the {@code StackdriverExporter}. * * @param spanExporter the instance of the {@code SpanExporter} where this service is registered. */ @VisibleForTesting static void register(SpanExporter spanExporter, Handler handler) { StackdriverTraceExporter.register(spanExporter, handler); }
static StackdriverV2ExporterHandler createWithStub( String projectId, TraceServiceClient traceServiceClient, @javax.annotation.Nullable Map<String, io.opencensus.trace.AttributeValue> fixedAttributes) { return new StackdriverV2ExporterHandler(projectId, traceServiceClient, fixedAttributes); }
@Test public void getResourceLabels_GceResourceLabels() { testGetResourceLabels(GCP_GCE_INSTANCE_MONITORED_RESOURCE, GCE_RESOURCE_LABELS); }
StackdriverExporter.createAndRegister(); Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection( Arrays.asList(SAMPLE_SPAN));
/** * Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit * project ID and using explicit credentials. Only one Stackdriver exporter can be registered at * any point. * * @param credentials a credentials used to authenticate API calls. * @param projectId the cloud project id. * @throws IllegalStateException if a Stackdriver exporter is already registered. * @since 0.6 */ public static void createAndRegisterWithCredentialsAndProjectId( Credentials credentials, String projectId) throws IOException { StackdriverTraceExporter.createAndRegister( StackdriverTraceConfiguration.builder() .setCredentials(credentials) .setProjectId(projectId) .build()); }
private static void putToResourceAttributeMap( Map<String, AttributeValue> map, ResourceType resourceType, String attributeName, String attributeValue) { map.put( createResourceLabelKey(resourceType, attributeName), toStringAttributeValueProto(attributeValue)); }
/** * Unregisters the Stackdriver Trace exporter from the OpenCensus library. * * @throws IllegalStateException if a Stackdriver exporter is not registered. * @since 0.6 */ public static void unregister() { StackdriverTraceExporter.unregister(); }
/** * Registers the {@code StackdriverExporter}. * * @param spanExporter the instance of the {@code SpanExporter} where this service is registered. */ @VisibleForTesting static void register(SpanExporter spanExporter, Handler handler) { StackdriverTraceExporter.register(spanExporter, handler); }
/** * Returns a new {@link Builder}. * * @return a {@code Builder}. * @since 0.12 */ public static Builder builder() { return new AutoValue_StackdriverTraceConfiguration.Builder(); }
static StackdriverV2ExporterHandler createWithStub( String projectId, TraceServiceClient traceServiceClient, @javax.annotation.Nullable Map<String, io.opencensus.trace.AttributeValue> fixedAttributes) { return new StackdriverV2ExporterHandler(projectId, traceServiceClient, fixedAttributes); }
@Test public void getResourceLabels_AwsEc2ResourceLabels() { testGetResourceLabels(AWS_EC2_INSTANCE_MONITORED_RESOURCE, AWS_RESOURCE_LABELS); }
/** * Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit * project ID. Only one Stackdriver exporter can be registered at any point. * * <p>This uses the default application credentials see {@link * GoogleCredentials#getApplicationDefault}. * * <p>This is equivalent with: * * <pre>{@code * StackdriverExporter.createAndRegisterWithCredentialsAndProjectId( * GoogleCredentials.getApplicationDefault(), projectId); * }</pre> * * @param projectId the cloud project id. * @throws IllegalStateException if a Stackdriver exporter is already registered. * @since 0.6 */ public static void createAndRegisterWithProjectId(String projectId) throws IOException { StackdriverTraceExporter.createAndRegister( StackdriverTraceConfiguration.builder() .setCredentials(GoogleCredentials.getApplicationDefault()) .setProjectId(projectId) .build()); }
/** * Unregisters the {@code StackdriverExporter}. * * @param spanExporter the instance of the {@code SpanExporter} from where this service is * unregistered. */ @VisibleForTesting static void unregister(SpanExporter spanExporter) { StackdriverTraceExporter.unregister(spanExporter); }
@Test public void getResourceLabels_GkeResourceLabels() { testGetResourceLabels(GCP_GKE_CONTAINER_MONITORED_RESOURCE, GKE_RESOURCE_LABELS); }
/** * Unregisters the {@code StackdriverExporter}. * * @param spanExporter the instance of the {@code SpanExporter} from where this service is * unregistered. */ @VisibleForTesting static void unregister(SpanExporter spanExporter) { StackdriverTraceExporter.unregister(spanExporter); }