Class ForwardingStorageComponent
- java.lang.Object
-
- zipkin2.Component
-
- zipkin2.storage.StorageComponent
-
- zipkin2.storage.ForwardingStorageComponent
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public abstract class ForwardingStorageComponent extends StorageComponent
We provide a forwarding variant of the storage component for use cases such as trace decoration, or throttling.Extending this is better than extending
StorageComponentdirectly because it reduces risk of accidentally masking new methods. For example, if you extended storage component and later a new feature for cache control was added, that feature would be blocked until the wrapper was re-compiled. Such would be worse in most cases than not having decoration on new methods.- Since:
- 2.16
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class zipkin2.storage.StorageComponent
StorageComponent.Builder
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedForwardingStorageComponent()Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AutocompleteTagsautocompleteTags()CheckResultcheck()Answers the question: Are operations on this component likely to succeed?voidclose()Closes any network resources created implicitly by the component.protected abstract StorageComponentdelegate()The delegate is a method as opposed to a field, to allow for flexibility.booleanisOverCapacity(Throwable e)A storage request failed and was dropped due to a limit, resource unavailability, or a timeout.ServiceAndSpanNamesserviceAndSpanNames()SpanConsumerspanConsumer()SpanStorespanStore()StringtoString()Tracestraces()
-
-
-
Method Detail
-
delegate
protected abstract StorageComponent delegate()
The delegate is a method as opposed to a field, to allow for flexibility. For example, this allows you to choose to make a final or lazy field, or no field at all.
-
spanConsumer
public SpanConsumer spanConsumer()
- Specified by:
spanConsumerin classStorageComponent
-
traces
public Traces traces()
- Overrides:
tracesin classStorageComponent
-
spanStore
public SpanStore spanStore()
- Specified by:
spanStorein classStorageComponent
-
autocompleteTags
public AutocompleteTags autocompleteTags()
- Overrides:
autocompleteTagsin classStorageComponent
-
serviceAndSpanNames
public ServiceAndSpanNames serviceAndSpanNames()
- Overrides:
serviceAndSpanNamesin classStorageComponent
-
check
public CheckResult check()
Description copied from class:ComponentAnswers the question: Are operations on this component likely to succeed?Implementations should initialize the component if necessary. It should test a remote connection, or consult a trusted source to derive the result. They should use least resources possible to establish a meaningful result, and be safe to call many times, even concurrently.
- Overrides:
checkin classComponent- See Also:
CheckResult.OK
-
isOverCapacity
public boolean isOverCapacity(Throwable e)
Description copied from class:StorageComponentA storage request failed and was dropped due to a limit, resource unavailability, or a timeout. Implementations of throttling can use this signal to differentiate between failures, for example to reduce traffic.Callers of this method will submit an exception raised by
Call.execute()or on the error callback ofCall.enqueue(Callback).By default, this returns true if the input is a
RejectedExecutionException. When originating exceptions, use this type to indicate a load related failure.It is generally preferred to specialize this method to handle relevant exceptions for the particular storage rather than wrapping them in
RejectedExecutionExceptionat call sites. Extra wrapping can make errors harder to read, for example, by making it harder to "google" a solution for a well known error message for the storage client, instead thinking the error is in Zipkin code itself.See also
While implementation is flexible, one known use is Netflix concurrency limits
- Overrides:
isOverCapacityin classStorageComponent
-
close
public void close() throws IOExceptionDescription copied from class:ComponentCloses any network resources created implicitly by the component.For example, if this created a connection, it would close it. If it was provided one, this would close any sessions, but leave the connection open.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classComponent- Throws:
IOException
-
-