/** Constructs an instance of TraceServiceClient with default settings. */ public static final TraceServiceClient create() throws IOException { return create(TraceServiceSettings.newBuilder().build()); }
public static void executeNoCatch(String projectId) throws Exception { try (TraceServiceClient client = TraceServiceClient.create()) { ProjectName name = ProjectName.of(projectId); List<Span> spans = new ArrayList<>(); client.batchWriteSpans(name, spans); } }
@Before public void setUp() throws IOException { serviceHelper.reset(); channelProvider = serviceHelper.createChannelProvider(); TraceServiceSettings settings = TraceServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) .setCredentialsProvider(NoCredentialsProvider.create()) .build(); client = TraceServiceClient.create(settings); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); // TODO(@Hailong): TraceServiceClient.create(TraceServiceStub) is a beta API and might change // in the future. traceServiceClient = TraceServiceClient.create(traceServiceStub); handler = StackdriverV2ExporterHandler.createWithStub( PROJECT_ID, traceServiceClient, Collections.<String, AttributeValue>emptyMap()); }
static StackdriverV2ExporterHandler createWithCredentials( String projectId, Credentials credentials, @javax.annotation.Nullable Map<String, io.opencensus.trace.AttributeValue> fixedAttributes) throws IOException { TraceServiceSettings traceServiceSettings = TraceServiceSettings.newBuilder() .setCredentialsProvider( FixedCredentialsProvider.create(checkNotNull(credentials, "credentials"))) .build(); return new StackdriverV2ExporterHandler( projectId, TraceServiceClient.create(traceServiceSettings), fixedAttributes); }
static StackdriverV2ExporterHandler createWithCredentials( String projectId, Credentials credentials, @javax.annotation.Nullable Map<String, io.opencensus.trace.AttributeValue> fixedAttributes) throws IOException { TraceServiceSettings traceServiceSettings = TraceServiceSettings.newBuilder() .setCredentialsProvider( FixedCredentialsProvider.create(checkNotNull(credentials, "credentials"))) .build(); return new StackdriverV2ExporterHandler( projectId, TraceServiceClient.create(traceServiceSettings), fixedAttributes); }
handler = StackdriverV2ExporterHandler.createWithStub( projectId, TraceServiceClient.create(stub), configuration.getFixedAttributes());
handler = StackdriverV2ExporterHandler.createWithStub( projectId, TraceServiceClient.create(stub), configuration.getFixedAttributes());