public final class InMemorySpanStore extends Object implements SpanStore
Here's an example of some traces in memory:
spansByTraceIdTimeStamp:
<aaaa,July 4> --> ( spanA(time:July 4, traceId:aaaa, service:foo, name:GET),
spanB(time:July 4, traceId:aaaa, service:bar, name:GET) )
<cccc,July 4> --> ( spanC(time:July 4, traceId:aaaa, service:foo, name:GET) )
<bbbb,July 5> --> ( spanD(time:July 5, traceId:bbbb, service:biz, name:GET) )
<bbbb,July 6> --> ( spanE(time:July 6, traceId:bbbb) service:foo, name:POST )
traceIdToTraceIdTimeStamps:
aaaa --> [ <aaaa,July 4> ]
bbbb --> [ <bbbb,July 5>, <bbbb,July 6> ]
cccc --> [ <cccc,July 4> ]
serviceToTraceIds:
foo --> [ <aaaa>, <cccc>, <bbbb> ]
bar --> [ <aaaa> ]
biz --> [ <bbbb> ]
serviceToSpanNames:
bar --> ( GET )
biz --> ( GET )
foo --> ( GET, POST )
| Constructor and Description |
|---|
InMemorySpanStore() |
| Modifier and Type | Method and Description |
|---|---|
List<DependencyLink> |
getDependencies(long endTs,
Long lookback)
Returns dependency links derived from spans.
|
List<Span> |
getRawTrace(long traceId)
This calls
SpanStore.getRawTrace(long, long) with traceIdHigh set to zero. |
List<Span> |
getRawTrace(long traceIdHigh,
long traceId)
Retrieves spans that share a 128-bit trace id, as returned from backend data store queries,
with no ordering expectation.
|
List<List<Span>> |
getRawTraces()
Used for testing.
|
List<String> |
getServiceNames()
Get all the
service names. |
List<String> |
getSpanNames(String service)
Get all the span names for a particular
Endpoint.serviceName. |
List<Span> |
getTrace(long traceId)
This calls
SpanStore.getTrace(long, long) with traceIdHigh set to zero. |
List<Span> |
getTrace(long traceIdHigh,
long traceIdLow)
Get the available trace information from the storage system.
|
List<List<Span>> |
getTraces(QueryRequest request)
Get the available trace information from the storage system.
|
List<Long> |
traceIds()
Deprecated.
use
getRawTraces() |
@Deprecated public List<Long> traceIds()
getRawTraces()public List<List<Span>> getRawTraces()
public List<List<Span>> getTraces(QueryRequest request)
SpanStore Results are sorted in order of the first span's timestamp, and contain up to QueryRequest.limit elements.
If StorageComponent.Builder.strictTraceId(boolean) is enabled, spans with the
same 64-bit trace ID will be grouped together.
public List<Span> getTrace(long traceId)
SpanStoreSpanStore.getTrace(long, long) with traceIdHigh set to zero.public List<Span> getTrace(long traceIdHigh, long traceIdLow)
SpanStoreWhen StorageComponent.Builder.strictTraceId(boolean) is true, spans with the
same traceIdLow are returned even if the traceIdHigh is different.
getTrace in interface SpanStoretraceIdHigh - The upper 64-bits of the trace ID. See Span.traceIdHightraceIdLow - The lower 64-bits of the trace ID. See Span.traceIdpublic List<Span> getRawTrace(long traceId)
SpanStoreSpanStore.getRawTrace(long, long) with traceIdHigh set to zero.getRawTrace in interface SpanStorepublic List<Span> getRawTrace(long traceIdHigh, long traceId)
SpanStoreThis is different, but related to SpanStore.getTrace(long, long). SpanStore.getTrace(long, long) cleans data by
merging spans, adding timestamps and performing clock skew adjustment. This feature is for
debugging zipkin logic or zipkin instrumentation.
When StorageComponent.Builder.strictTraceId(boolean) is true, spans with the
same traceIdLow are returned even if the traceIdHigh is different.
getRawTrace in interface SpanStoretraceIdHigh - The upper 64-bits of the trace ID. See Span.traceIdHightraceId - The lower 64-bits of the trace ID. See Span.traceIdpublic List<String> getServiceNames()
SpanStoreservice names.
Results are sorted lexicographically
getServiceNames in interface SpanStorepublic List<String> getSpanNames(String service)
SpanStoreEndpoint.serviceName.
Results are sorted lexicographically
getSpanNames in interface SpanStorepublic List<DependencyLink> getDependencies(long endTs, @Nullable Long lookback)
SpanStoreImplementations may bucket aggregated data, for example daily. When this is the case, endTs may be floored to align with that bucket, for example midnight if daily. lookback applies to the original endTs, even when bucketed. Using the daily example, if endTs was 11pm and lookback was 25 hours, the implementation would query against 2 buckets.
Some implementations parse Span from storage and call
DependencyLinker to aggregate links. The reason is certain graph logic,
such as skipping up the tree is difficult to implement as a storage query.
There's no parameter to indicate how to handle mixed ID length: this operates the same as if
StorageComponent.Builder.strictTraceId(boolean) was set to false. This ensures call
counts are not incremented twice due to one hop downgrading from 128 to 64-bit trace IDs.
getDependencies in interface SpanStoreendTs - only return links from spans where Span.timestamp are at or before this
time in epoch milliseconds.lookback - only return links from spans where Span.timestamp are at or after
(endTs - lookback) in milliseconds. Defaults to endTs.Copyright © 2015–2018 OpenZipkin. All rights reserved.