Interface ClientTrace
- All Superinterfaces:
AutoCloseable,ImmutableTrace,Trace
Trace for 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
Modifier and TypeMethodDescriptiondefault voidclose()Default implementation which callssave().name()Get the name of theClientTrace.SeeTrace.newChild(String, ThrowingConsumer), but returns the new childtrace.default TracenewChild(String name, ThrowingConsumer<Trace, IOException> enrichChildCallback) Implementation which by default throws an exception.profile()Returns thePluginRunProfilereturned by the plugin.voidprofile(PluginRunProfile profile) Set thePluginRunProfileat the end of an extraction.voidsave()Save this childtracein the backing storage.Methods inherited from interface org.hansken.plugin.extraction.api.ImmutableTrace
get, properties, traceId, typesMethods inherited from interface org.hansken.plugin.extraction.api.Trace
addTracelet, addTracelet, addType, addValue, getNewTracelets, set, setData, setData, setData, setData
-
Method Details
-
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 IOExceptionImplementation 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
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 implementation which callssave().- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- if the close failed
-
save
Save this childtracein the backing storage.- Throws:
Exception- if the save failed
-
profile
Set thePluginRunProfileat the end of an extraction. This variable will be set the extraction plugin framework when processing a trace has finished.- Parameters:
profile- the profile to set
-
profile
Optional<PluginRunProfile> profile()Returns thePluginRunProfilereturned by the plugin. This variable will be set the extraction plugin framework when processing a trace has finished.- Returns:
- the set profile, empty if no profile was not returned by the plugin
-