Class SampledSpanStore
- Direct Known Subclasses:
SampledSpanStore.NoopSampledSpanStore
,SampledSpanStoreImpl
For all completed spans with the option Span.Options.RECORD_EVENTS
the library can
store samples based on latency for succeeded operations or based on error code for failed
operations. To activate this, users MUST manually configure all the span names for which samples
will be collected (see registerSpanNamesForCollection(Collection)
).
- Since:
- 0.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Filter for error based sampled spans.static enum
The latency buckets boundaries.static class
Filter for latency based sampled spans.private static final class
static class
Summary of all available data for a span name.static class
The summary of all available data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Collection
<SpanData> abstract Collection
<SpanData> Returns the set of unique span names registered to the library, for use in tests.abstract SampledSpanStore.Summary
Returns the summary of all available data, such as number of sampled spans in the latency based samples or error based samples.(package private) static SampledSpanStore
Returns aSampledSpanStore
that maintains a set of span names, but always returns an empty list ofSpanData
.abstract void
registerSpanNamesForCollection
(Collection<String> spanNames) Deprecated.since 0.18.abstract void
unregisterSpanNamesForCollection
(Collection<String> spanNames) Deprecated.since 0.18.
-
Constructor Details
-
SampledSpanStore
protected SampledSpanStore()
-
-
Method Details
-
newNoopSampledSpanStore
Returns aSampledSpanStore
that maintains a set of span names, but always returns an empty list ofSpanData
.- Returns:
- a
SampledSpanStore
that maintains a set of span names, but always returns an empty list ofSpanData
.
-
getSummary
Returns the summary of all available data, such as number of sampled spans in the latency based samples or error based samples.Data available only for span names registered using
registerSpanNamesForCollection(Collection)
.- Returns:
- the summary of all available data.
- Since:
- 0.5
-
getLatencySampledSpans
Returns a list of succeeded spans (spans withStatus
equal toStatus.OK
) that match thefilter
.Latency based sampled spans are available only for span names registered using
registerSpanNamesForCollection(Collection)
.- Parameters:
filter
- used to filter the returned sampled spans.- Returns:
- a list of succeeded spans that match the
filter
. - Since:
- 0.5
-
getErrorSampledSpans
Returns a list of failed spans (spans withStatus
other thanStatus.OK
) that match thefilter
.Error based sampled spans are available only for span names registered using
registerSpanNamesForCollection(Collection)
.- Parameters:
filter
- used to filter the returned sampled spans.- Returns:
- a list of failed spans that match the
filter
. - Since:
- 0.5
-
registerSpanNamesForCollection
Deprecated.since 0.18. UseEndSpanOptions.getSampleToLocalSpanStore()
.Appends a list of span names for which the library will collect latency based sampled spans and error based sampled spans.If called multiple times the library keeps the list of unique span names from all the calls.
- Parameters:
spanNames
- list of span names for which the library will collect samples.- Since:
- 0.5
-
unregisterSpanNamesForCollection
Deprecated.since 0.18. The need of controlling the registration the span name will be removed soon.Removes a list of span names for which the library will collect latency based sampled spans and error based sampled spans.The library keeps the list of unique registered span names for which samples will be called. This method allows users to remove span names from that list.
- Parameters:
spanNames
- list of span names for which the library will no longer collect samples.- Since:
- 0.5
-
getRegisteredSpanNamesForCollection
Returns the set of unique span names registered to the library, for use in tests. For this set of span names the library will collect latency based sampled spans and error based sampled spans.This method is only meant for testing code that uses OpenCensus, and it is not performant.
- Returns:
- the set of unique span names registered to the library.
- Since:
- 0.7
-