@Override public void submit() { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_BATCH_SUBMIT); Scope scope = tracer.withSpan(span); try { span.putAttribute("batch size", AttributeValue.longAttributeValue(batches.size())); for (BatchRequest batch : batches) { // TODO(hailongwen@): instrument 'google-api-java-client' to further break down the span. // Here we only add a annotation to at least know how much time each batch takes. span.addAnnotation("Execute batch request"); batch.setBatchUrl( new GenericUrl(String.format("%s/batch/storage/v1", options.getHost()))); batch.execute(); } } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); throw translate(ex); } finally { scope.close(); span.end(); } } }
public HttpStorageRpc(StorageOptions options) { HttpTransportOptions transportOptions = (HttpTransportOptions) options.getTransportOptions(); HttpTransport transport = transportOptions.getHttpTransportFactory().create(); HttpRequestInitializer initializer = transportOptions.getHttpRequestInitializer(options); this.options = options; // Open Census initialization censusHttpModule = new CensusHttpModule(tracer, true); initializer = censusHttpModule.getHttpRequestInitializer(initializer); batchRequestInitializer = censusHttpModule.getHttpRequestInitializer(null); HttpStorageRpcSpans.registerAllSpanNamesForCollection(); storage = new Storage.Builder(transport, new JacksonFactory(), initializer) .setRootUrl(options.getHost()) .setApplicationName(options.getApplicationName()) .build(); }
@Override public void submit() { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_BATCH_SUBMIT); Scope scope = tracer.withSpan(span); try { span.putAttribute("batch size", AttributeValue.longAttributeValue(batches.size())); for (BatchRequest batch : batches) { // TODO(hailongwen@): instrument 'google-api-java-client' to further break down the span. // Here we only add a annotation to at least know how much time each batch takes. span.addAnnotation("Execute batch request"); batch.setBatchUrl( new GenericUrl(String.format("%s/batch/storage/v1", options.getHost()))); batch.execute(); } } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); throw translate(ex); } finally { scope.close(); span.end(); } } }
public HttpStorageRpc(StorageOptions options) { HttpTransportOptions transportOptions = (HttpTransportOptions) options.getTransportOptions(); HttpTransport transport = transportOptions.getHttpTransportFactory().create(); HttpRequestInitializer initializer = transportOptions.getHttpRequestInitializer(options); this.options = options; // Open Census initialization censusHttpModule = new CensusHttpModule(tracer, true); initializer = censusHttpModule.getHttpRequestInitializer(initializer); batchRequestInitializer = censusHttpModule.getHttpRequestInitializer(null); HttpStorageRpcSpans.registerAllSpanNamesForCollection(); storage = new Storage.Builder(transport, new JacksonFactory(), initializer) .setRootUrl(options.getHost()) .setApplicationName(options.getApplicationName()) .build(); }