Interface ClientTrace
-
- All Superinterfaces:
AutoCloseable,ImmutableTrace,Trace
public interface ClientTrace extends Trace, AutoCloseable
Tracefor client side implementations. Compared to other trace implementations it has a different way of creating children. Instead of enriching a child trace within a given scope, the child is returned for the caller to enrich.The reason for this is that keeping this scope synchronized between client and server is difficult and requires us to keep state in a complex way (because the full trace tree is not necessarily sent at once from server to client).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hansken.plugin.extraction.api.Trace
Trace.Tracelet, Trace.TraceletBuilder, Trace.TraceletProperty
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Default implementation which callssave().Stringname()Get the name of theClientTrace.ClientTracenewChild(String name)SeeTrace.newChild(String, ThrowingConsumer), but returns the new childtrace.default TracenewChild(String name, ThrowingConsumer<Trace,IOException> enrichChildCallback)Implementation which by default throws an exception.voidsave()Save this childtracein the backing storage.-
Methods inherited from interface org.hansken.plugin.extraction.api.ImmutableTrace
get, properties, traceId, types
-
Methods inherited from interface org.hansken.plugin.extraction.api.Trace
addTracelet, addTracelet, addType, set, setData, setData, setData, setData
-
-
-
-
Method Detail
-
name
String name()
Get the name of theClientTrace. It should be unique among its siblings.- Returns:
- the name of the trace
-
newChild
default Trace newChild(String name, ThrowingConsumer<Trace,IOException> enrichChildCallback) throws IOException
Implementation which by default throws an exception.- Specified by:
newChildin interfaceTrace- Parameters:
name- the name of the childenrichChildCallback- consumer that gets the new child trace as input- Returns:
- nothing
- Throws:
IOException
-
newChild
ClientTrace newChild(String name)
SeeTrace.newChild(String, ThrowingConsumer), but returns the new childtrace.Note: clients using this method must take care to
save()the returned traces manually.- Parameters:
name- the name of the child trace- Returns:
- the newly created child
-
close
default void close() throws ExceptionDefault implementation which callssave().- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- if the close failed
-
-