static void exportSpans(String... spans) { SampledSpanStore store = Tracing.getExportComponent().getSampledSpanStore(); if (store != null) { store.registerSpanNamesForCollection(Arrays.asList(spans)); } } }
static void registerAllSpanNamesForCollection() { Tracing.getExportComponent() .getSampledSpanStore() .registerSpanNamesForCollection(ALL_SPAN_NAMES); }
Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection( Arrays.asList(SAMPLE_SPAN));
static void exportSpans(String... spans) { SampledSpanStore store = Tracing.getExportComponent().getSampledSpanStore(); if (store != null) { store.registerSpanNamesForCollection(Arrays.asList(spans)); } } }
static void registerAllSpanNamesForCollection() { Tracing.getExportComponent() .getSampledSpanStore() .registerSpanNamesForCollection(ALL_SPAN_NAMES); }
/** * This is a one time setup for grpcz pages. This adds all of the methods to the Tracing * environment required to show a consistent set of methods relating to Cloud Bigtable and HBase * methods on the grpcz page. */ public static void setupTracingConfig() { TracingUtilities.setupTracingConfig(); List<String> descriptors = Arrays.asList( "BigtableTable.getTableDescriptor", "BigtableTable.exists", "BigtableTable.existsAll", "BigtableTable.batch", "BigtableTable.batchCallback", "BigtableTable.get", "BigtableTable.put", "BigtableTable.checkAndPut", "BigtableTable.delete", "BigtableTable.checkAndDelete", "BigtableTable.checkAndMutate", "BigtableTable.mutateRow", "BigtableTable.append", "BigtableTable.increment", "BigtableTable.incrementColumnValue" ); Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(descriptors); }
/** * This is a one time setup for grpcz pages. This adds all of the methods to the Tracing * environment required to show a consistent set of methods relating to Cloud Bigtable and HBase * methods on the grpcz page. */ public static void setupTracingConfig() { TracingUtilities.setupTracingConfig(); List<String> descriptors = Arrays.asList( "BigtableTable.getTableDescriptor", "BigtableTable.exists", "BigtableTable.existsAll", "BigtableTable.batch", "BigtableTable.batchCallback", "BigtableTable.get", "BigtableTable.put", "BigtableTable.checkAndPut", "BigtableTable.delete", "BigtableTable.checkAndDelete", "BigtableTable.checkAndMutate", "BigtableTable.mutateRow", "BigtableTable.append", "BigtableTable.increment", "BigtableTable.incrementColumnValue" ); Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(descriptors); }
@Test public void implementationOfSampledSpanStore() { assertThat(exportComponentWithInProcess.getSampledSpanStore()) .isInstanceOf(InProcessSampledSpanStoreImpl.class); assertThat(exportComponentWithoutInProcess.getSampledSpanStore()) .isInstanceOf(SampledSpanStoreImpl.getNoopSampledSpanStoreImpl().getClass()); } }
/** * This is a one time setup for grpcz pages. This adds all of the methods to the Tracing * environment required to show a consistent set of methods relating to Cloud Bigtable on the * grpcz page. If HBase artifacts are present, this will add tracing metadata for HBase methods. */ public static void setupTracingConfig() { List<String> descriptors = new ArrayList<>(); addDescriptor(descriptors, BigtableTableAdminGrpc.getServiceDescriptor()); addDescriptor(descriptors, BigtableGrpc.getServiceDescriptor()); Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(descriptors); }
@Test public void implementationOfSampledSpanStore() { assertThat(exportComponent.getSampledSpanStore()) .isInstanceOf(SampledSpanStore.newNoopSampledSpanStore().getClass()); } }
@Test public void noopSampledSpanStore_GetRegisteredSpanNamesForCollection() { SampledSpanStore sampledSpanStore = ExportComponent.newNoopExportComponent().getSampledSpanStore(); sampledSpanStore.registerSpanNamesForCollection( Collections.unmodifiableList(Lists.newArrayList("TestSpan3", "TestSpan4"))); Set<String> registeredSpanNames = sampledSpanStore.getRegisteredSpanNamesForCollection(); assertThat(registeredSpanNames).containsExactly("TestSpan3", "TestSpan4"); } }
@Test public void noopSampledSpanStore_GetLatencySampledSpans() { SampledSpanStore sampledSpanStore = ExportComponent.newNoopExportComponent().getSampledSpanStore(); Collection<SpanData> latencySampledSpans = sampledSpanStore.getLatencySampledSpans( SampledSpanStore.LatencyFilter.create("TestLatencyFilter", 0, 0, 0)); assertThat(latencySampledSpans).isEmpty(); }
@Test public void noopSampledSpanStore_GetErrorSampledSpans() { SampledSpanStore sampledSpanStore = ExportComponent.newNoopExportComponent().getSampledSpanStore(); Collection<SpanData> errorSampledSpans = sampledSpanStore.getErrorSampledSpans( SampledSpanStore.ErrorFilter.create("TestErrorFilter", null, 0)); assertThat(errorSampledSpans).isEmpty(); }
@Test public void noopSampledSpanStore_RegisterUnregisterAndGetSummary() { // should return empty before register SampledSpanStore sampledSpanStore = ExportComponent.newNoopExportComponent().getSampledSpanStore(); SampledSpanStore.Summary summary = sampledSpanStore.getSummary(); assertThat(summary.getPerSpanNameSummary()).isEmpty(); // should return non-empty summaries with zero latency/error sampled spans after register sampledSpanStore.registerSpanNamesForCollection( Collections.unmodifiableList(Lists.newArrayList("TestSpan1", "TestSpan2", "TestSpan3"))); summary = sampledSpanStore.getSummary(); assertThat(summary.getPerSpanNameSummary()) .containsExactly( "TestSpan1", EMPTY_PER_SPAN_NAME_SUMMARY, "TestSpan2", EMPTY_PER_SPAN_NAME_SUMMARY, "TestSpan3", EMPTY_PER_SPAN_NAME_SUMMARY); // should unregister specific spanNames sampledSpanStore.unregisterSpanNamesForCollection( Collections.unmodifiableList(Lists.newArrayList("TestSpan1", "TestSpan3"))); summary = sampledSpanStore.getSummary(); assertThat(summary.getPerSpanNameSummary()) .containsExactly("TestSpan2", EMPTY_PER_SPAN_NAME_SUMMARY); }