.spanBuilderWithExplicitParent(SAMPLE_SPAN, null) .setSampler(Samplers.alwaysSample()) .startScopedSpan()) { ResultSet resultSet = dbClient.singleUse().executeQuery(Statement.of("SELECT 1"));
@MustBeClosed private static Scope newExportScope() { // Start a new span with explicit sampler (with low probability) to avoid the case when user // sets the default sampler to always sample and we get the Thrift span of the Jaeger // export call always sampled and go to an infinite loop. return tracer.spanBuilder(EXPORT_SPAN_NAME).setSampler(lowProbabilitySampler).startScopedSpan(); }
/** {@inheritDoc} */ @Override public HTableDescriptor getTableDescriptor() throws IOException { try ( Scope scope = TRACER.spanBuilder("BigtableTable.getTableDescriptor").startScopedSpan(); Admin admin = this.bigtableConnection.getAdmin()) { return admin.getTableDescriptor(tableName); } }
/** {@inheritDoc} */ @Override public boolean[] existsAll(List<Get> gets) throws IOException { LOG.trace("existsAll(Get)"); try (Scope scope = TRACER.spanBuilder("BigtableTable.existsAll").startScopedSpan()) { addBatchSizeAnnotation(gets); List<Get> existGets = new ArrayList<>(gets.size()); for(Get get : gets ){ existGets.add(GetAdapter.setCheckExistenceOnly(get)); } return getBatchExecutor().exists(existGets); } }
/** {@inheritDoc} */ @Override public HTableDescriptor getTableDescriptor() throws IOException { try ( Scope scope = TRACER.spanBuilder("BigtableTable.getTableDescriptor").startScopedSpan(); Admin admin = this.bigtableConnection.getAdmin()) { return admin.getTableDescriptor(tableName); } }
/** {@inheritDoc} */ @Deprecated @Override public Object[] batch(List<? extends Row> actions) throws IOException, InterruptedException { LOG.trace("batch(List<>)"); try (Scope scope = TRACER.spanBuilder("BigtableTable.batch").startScopedSpan()) { addBatchSizeAnnotation(actions); return getBatchExecutor().batch(actions); } }
/** {@inheritDoc} */ @Deprecated @Override public Object[] batch(List<? extends Row> actions) throws IOException, InterruptedException { LOG.trace("batch(List<>)"); try (Scope scope = TRACER.spanBuilder("BigtableTable.batch").startScopedSpan()) { addBatchSizeAnnotation(actions); return getBatchExecutor().batch(actions); } }
/** {@inheritDoc} */ @Override public Result get(Get get) throws IOException { LOG.trace("get(Get)"); try (Scope scope = TRACER.spanBuilder("BigtableTable.get").startScopedSpan()) { return convertToResult(getResults(get, "get")); } }
/** {@inheritDoc} */ @Override public void delete(List<Delete> deletes) throws IOException { LOG.trace("delete(List<Delete>)"); try (Scope scope = TRACER.spanBuilder("BigtableTable.delete").startScopedSpan()) { getBatchExecutor().batch(deletes); } }
void tick() { try (Scope ss = tracer.spanBuilder("Styx.TriggerManager.tick") .setRecordEvents(true) .setSampler(Samplers.alwaysSample()) .startScopedSpan()) { tick0(); } }
void tick() { try (Scope ss = tracer.spanBuilder("Styx.BackfillTriggerManager.tick") .setRecordEvents(true) .setSampler(Samplers.alwaysSample()) .startScopedSpan()) { tick0(); } }
/** {@inheritDoc} */ @Override public void batch(List<? extends Row> actions, Object[] results) throws IOException, InterruptedException { LOG.trace("batch(List<>, Object[])"); try (Scope scope = TRACER.spanBuilder("BigtableTable.batch").startScopedSpan()) { addBatchSizeAnnotation(actions); getBatchExecutor().batch(actions, results); } }
void tick() { try (Scope ss = tracer.spanBuilder("Styx.Scheduler.tick") .setRecordEvents(true) .setSampler(Samplers.alwaysSample()) .startScopedSpan()) { tick0(); } }
/** {@inheritDoc} */ @Override public void batch(List<? extends Row> actions, Object[] results) throws IOException, InterruptedException { LOG.trace("batch(List<>, Object[])"); try (Scope scope = TRACER.spanBuilder("BigtableTable.batch").startScopedSpan()) { addBatchSizeAnnotation(actions); getBatchExecutor().batch(actions, results); } }
/** {@inheritDoc} */ @Override public <R> void batchCallback(List<? extends Row> actions, Object[] results, Batch.Callback<R> callback) throws IOException, InterruptedException { LOG.trace("batchCallback(List<>, Object[], Batch.Callback)"); try (Scope scope = TRACER.spanBuilder("BigtableTable.batchCallback").startScopedSpan()) { addBatchSizeAnnotation(actions); getBatchExecutor().batchCallback(actions, results, callback); } }
void tick() { try (Scope ss = tracer.spanBuilder("Styx.Cleaner.tick") .setRecordEvents(true) .setSampler(Samplers.alwaysSample()) .startScopedSpan()) { tick0(); } }
/** {@inheritDoc} */ @Override public boolean exists(Get get) throws IOException { try (Scope scope = TRACER.spanBuilder("BigtableTable.exists").startScopedSpan()) { LOG.trace("exists(Get)"); return !convertToResult(getResults(GetAdapter.setCheckExistenceOnly(get), "exists")).isEmpty(); } }
/** {@inheritDoc} */ @Override public boolean exists(Get get) throws IOException { try (Scope scope = TRACER.spanBuilder("BigtableTable.exists").startScopedSpan()) { LOG.trace("exists(Get)"); return !convertToResult(getResults(GetAdapter.setCheckExistenceOnly(get), "exists")).isEmpty(); } }
@MustBeClosed @Override public Closeable startScopedSpan(String spanName) { checkNotNull(spanName, "spanName"); return Tracing.getTracer() .spanBuilder(spanName) .setSampler(Samplers.alwaysSample()) .setRecordEvents(true) .startScopedSpan(); }
@Test public void startScopedSpan() { assertThat(tracer.getCurrentSpan()).isSameAs(BlankSpan.INSTANCE); Scope scope = spanBuilder.startScopedSpan(); try { assertThat(tracer.getCurrentSpan()).isSameAs(span); } finally { scope.close(); } verify(span).end(EndSpanOptions.DEFAULT); assertThat(tracer.getCurrentSpan()).isSameAs(BlankSpan.INSTANCE); }