Class SampledSpanStore
- java.lang.Object
-
- io.opencensus.trace.export.SampledSpanStore
-
- Direct Known Subclasses:
SampledSpanStore.NoopSampledSpanStore,SampledSpanStoreImpl
@ThreadSafe public abstract class SampledSpanStore extends java.lang.ObjectThis class allows users to access in-process information such as latency based sampled spans and error based sampled spans.For all completed spans with the option
Span.Options.RECORD_EVENTSthe 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 (seeregisterSpanNamesForCollection(Collection)).- Since:
- 0.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSampledSpanStore.ErrorFilterFilter for error based sampled spans.static classSampledSpanStore.LatencyBucketBoundariesThe latency buckets boundaries.static classSampledSpanStore.LatencyFilterFilter for latency based sampled spans.private static classSampledSpanStore.NoopSampledSpanStorestatic classSampledSpanStore.PerSpanNameSummarySummary of all available data for a span name.static classSampledSpanStore.SummaryThe summary of all available data.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSampledSpanStore()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract java.util.Collection<SpanData>getErrorSampledSpans(SampledSpanStore.ErrorFilter filter)abstract java.util.Collection<SpanData>getLatencySampledSpans(SampledSpanStore.LatencyFilter filter)abstract java.util.Set<java.lang.String>getRegisteredSpanNamesForCollection()Returns the set of unique span names registered to the library, for use in tests.abstract SampledSpanStore.SummarygetSummary()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 SampledSpanStorenewNoopSampledSpanStore()Returns aSampledSpanStorethat maintains a set of span names, but always returns an empty list ofSpanData.abstract voidregisterSpanNamesForCollection(java.util.Collection<java.lang.String> spanNames)Deprecated.since 0.18.abstract voidunregisterSpanNamesForCollection(java.util.Collection<java.lang.String> spanNames)Deprecated.since 0.18.
-
-
-
Method Detail
-
newNoopSampledSpanStore
static SampledSpanStore newNoopSampledSpanStore()
Returns aSampledSpanStorethat maintains a set of span names, but always returns an empty list ofSpanData.- Returns:
- a
SampledSpanStorethat maintains a set of span names, but always returns an empty list ofSpanData.
-
getSummary
public abstract SampledSpanStore.Summary 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
public abstract java.util.Collection<SpanData> getLatencySampledSpans(SampledSpanStore.LatencyFilter filter)
Returns a list of succeeded spans (spans withStatusequal 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
public abstract java.util.Collection<SpanData> getErrorSampledSpans(SampledSpanStore.ErrorFilter filter)
Returns a list of failed spans (spans withStatusother 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 public abstract void registerSpanNamesForCollection(java.util.Collection<java.lang.String> spanNames)
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 public abstract void unregisterSpanNamesForCollection(java.util.Collection<java.lang.String> spanNames)
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
public abstract java.util.Set<java.lang.String> 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
-
-