Class ForwardingStorageComponent
- java.lang.Object
-
- zipkin2.Component
-
- zipkin2.storage.StorageComponent
-
- zipkin2.storage.ForwardingStorageComponent
-
- All Implemented Interfaces:
Closeable
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
StorageComponent
directly 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 protected
ForwardingStorageComponent()
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AutocompleteTags
autocompleteTags()
CheckResult
check()
Answers the question: Are operations on this component likely to succeed?void
close()
Closes any network resources created implicitly by the component.protected abstract StorageComponent
delegate()
The delegate is a method as opposed to a field, to allow for flexibility.boolean
isOverCapacity(Throwable e)
A storage request failed and was dropped due to a limit, resource unavailability, or a timeout.ServiceAndSpanNames
serviceAndSpanNames()
SpanConsumer
spanConsumer()
SpanStore
spanStore()
String
toString()
Traces
traces()
-
-
-
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:
spanConsumer
in classStorageComponent
-
traces
public Traces traces()
- Overrides:
traces
in classStorageComponent
-
spanStore
public SpanStore spanStore()
- Specified by:
spanStore
in classStorageComponent
-
autocompleteTags
public AutocompleteTags autocompleteTags()
- Overrides:
autocompleteTags
in classStorageComponent
-
serviceAndSpanNames
public ServiceAndSpanNames serviceAndSpanNames()
- Overrides:
serviceAndSpanNames
in classStorageComponent
-
check
public CheckResult check()
Description copied from class:Component
Answers 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:
check
in classComponent
- See Also:
CheckResult.OK
-
isOverCapacity
public boolean isOverCapacity(Throwable e)
Description copied from class:StorageComponent
A 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
RejectedExecutionException
at 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:
isOverCapacity
in classStorageComponent
-
close
public void close() throws IOException
Description copied from class:Component
Closes 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:
close
in interfaceCloseable
- Overrides:
close
in classComponent
- Throws:
IOException
-
-