本文整理了Java中zipkin.internal.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:zipkin.internal.Util
类名称:Util
暂无
代码示例来源:origin: io.zipkin.java/zipkin-transport-scribe
/**
* {@link CollectorSampler#isSampled(Span) samples spans} to reduce load on the storage system.
* Defaults to always sample.
*/
public Builder sampler(CollectorSampler sampler) {
this.sampler = checkNotNull(sampler, "sampler");
return this;
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra
@Override public String toString() {
return "(" + table + "," + partitionKey + "," + Util.toLowerHex(traceId) + ")";
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-mysql
if (equal(saService, caService)) caService = null;
.traceId(toLowerHex(traceIdHi != null ? traceIdHi : 0L, traceIdLo))
.parentId(parentId != null ? toLowerHex(parentId) : null)
.id(toLowerHex(spanId));
代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra
static List<String> annotationKeys(QueryRequest request) {
if (request.annotations.isEmpty() && request.binaryAnnotations.isEmpty()) {
return Collections.emptyList();
}
checkArgument(request.serviceName != null, "serviceName needed with annotation query");
Set<String> annotationKeys = new LinkedHashSet<>();
for (String a : request.annotations) { // doesn't include CORE_ANNOTATIONS
annotationKeys.add(request.serviceName + ":" + a);
}
for (Map.Entry<String, String> b : request.binaryAnnotations.entrySet()) {
annotationKeys.add(request.serviceName + ":" + b.getKey() + ":" + b.getValue());
}
return sortedList(annotationKeys);
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch
static GregorianCalendar midnightUTC(long epochMillis) {
GregorianCalendar result = new GregorianCalendar(UTC);
result.setTimeInMillis(Util.midnightUTC(epochMillis));
return result;
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra
@Override public ListenableFuture<List<DependencyLink>> getDependencies(long endTs,
@Nullable Long lookback) {
List<Date> days = getDays(endTs, lookback);
try {
BoundStatement bound = CassandraUtil.bindWithName(selectDependencies, "select-dependencies")
.setList("days", days);
return transform(session.executeAsync(bound), ConvertDependenciesResponse.INSTANCE);
} catch (RuntimeException ex) {
return immediateFailedFuture(ex);
}
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch-http
/** Note: this runs on the {@link okhttp3.OkHttpClient#dispatcher() dispatcher} thread! */
@Override public void onResponse(okhttp3.Call call, Response response) {
try {
delegate.onSuccess(parseResponse(response, bodyConverter));
} catch (Throwable e) {
propagateIfFatal(e);
delegate.onError(e);
}
}
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch
@Override public List<String> apply(SearchResponse input) {
Iterator<Aggregation> aggregations = input.getAggregations() != null
? input.getAggregations().iterator()
: null;
if (aggregations == null) {
return ImmutableList.of();
}
ImmutableSet.Builder<String> result = ImmutableSet.builder();
while (aggregations.hasNext()) {
addBucketKeys(aggregations.next(), result);
}
return Util.sortedList(result.build());
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra
@VisibleForTesting void write(List<DependencyLink> links, long timestampMillis) {
long midnight = Util.midnightUTC(timestampMillis);
Dependencies deps = Dependencies.create(midnight, midnight /* ignored */, links);
ByteBuffer thrift = deps.toThrift();
Futures.getUnchecked(storeDependencies(midnight, thrift));
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-mysql
@Override
public List<DependencyLink> getDependencies(long endTs, @Nullable Long lookback) {
try (Connection conn = datasource.getConnection()) {
if (schema.hasPreAggregatedDependencies) {
List<Date> days = getDays(endTs, lookback);
List<DependencyLink> unmerged = context.get(conn)
.select(schema.dependencyLinkFields)
.from(ZIPKIN_DEPENDENCIES)
.where(ZIPKIN_DEPENDENCIES.DAY.in(days))
.fetch((Record l) -> DependencyLink.builder()
.parent(l.get(ZIPKIN_DEPENDENCIES.PARENT))
.child(l.get(ZIPKIN_DEPENDENCIES.CHILD))
.callCount(l.get(ZIPKIN_DEPENDENCIES.CALL_COUNT))
.errorCount(maybeGet(l, ZIPKIN_DEPENDENCIES.ERROR_COUNT, 0L))
.build()
);
return DependencyLinker.merge(unmerged);
} else {
return aggregateDependencies(endTs, lookback, conn);
}
} catch (SQLException e) {
throw new RuntimeException("Error querying dependencies for endTs "
+ endTs + " and lookback " + lookback + ": " + e.getMessage());
}
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch
@Override public void accept(List<Span> spans, Callback<Void> callback) {
if (spans.isEmpty()) {
callback.onSuccess(null);
return;
}
try {
indexSpans(client.bulkSpanIndexer(), spans).execute(callback);
} catch (Throwable t) {
propagateIfFatal(t);
callback.onError(t);
}
}
代码示例来源:origin: io.zipkin.java/transport-kafka
/** The zookeeper connect string, ex. 127.0.0.1:2181. No default */
public Builder zookeeper(String zookeeper) {
this.zookeeper = checkNotNull(zookeeper, "zookeeper");
return this;
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch
@Override public ListenableFuture<List<Span>> getRawTrace(long traceIdHigh, long traceIdLow) {
String traceIdHex = Util.toLowerHex(strictTraceId ? traceIdHigh : 0L, traceIdLow);
return client.findSpans(catchAll, termQuery("traceId", traceIdHex));
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch
/**
* The index prefix to use when generating daily index names. Defaults to zipkin.
*/
public Builder index(String index) {
this.index = checkNotNull(index, "index");
return this;
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-elasticsearch-http
@Override
public void getRawTrace(long traceIdHigh, long traceIdLow, Callback<List<Span>> callback) {
String traceIdHex = Util.toLowerHex(strictTraceId ? traceIdHigh : 0L, traceIdLow);
SearchRequest request = SearchRequest.create(asList(allIndices), SPAN)
.term("traceId", traceIdHex);
submit(search.newCall(request, NULLABLE_SPANS), callback);
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra
/** Keyspace to store span and index data. Defaults to "zipkin" */
public Builder keyspace(String keyspace) {
this.keyspace = checkNotNull(keyspace, "keyspace");
return this;
}
代码示例来源:origin: io.zipkin.sparkstreaming/zipkin-sparkstreaming
static void streamSpansToStorage(
JavaDStream<byte[]> stream,
ReadSpans readSpans,
AdjustAndConsumeSpansSharingTraceId adjustAndConsumeSpansSharingTraceId
) {
JavaDStream<Span> spans = stream.flatMap(readSpans);
// TODO: plug in some filter to drop spans regardless of trace ID
// spans = spans.filter(spanFilter);
JavaPairDStream<String, Iterable<Span>> tracesById = spans
.mapToPair(s -> new Tuple2<>(Util.toLowerHex(s.traceIdHigh, s.traceId), s))
.groupByKey();
tracesById.foreachRDD(rdd -> {
rdd.values().foreachPartition(adjustAndConsumeSpansSharingTraceId);
});
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra
/** Comma separated list of host addresses part of Cassandra cluster. You can also specify a custom port with 'host:port'. Defaults to localhost on port 9042 **/
public Builder contactPoints(String contactPoints) {
this.contactPoints = checkNotNull(contactPoints, "contactPoints");
return this;
}
代码示例来源:origin: io.zipkin.java/zipkin-transport-scribe
/** Category zipkin spans will be consumed from. Defaults to "zipkin" */
public Builder category(String category) {
this.category = checkNotNull(category, "category");
return this;
}
代码示例来源:origin: io.zipkin.java/zipkin-transport-kafka
/**
* {@link CollectorSampler#isSampled(Span) samples spans} to reduce load on the storage system.
* Defaults to always sample.
*/
public Builder sampler(CollectorSampler sampler) {
this.sampler = checkNotNull(sampler, "sampler");
return this;
}
内容来源于网络,如有侵权,请联系作者删除!