public final class ThreadLocalServerClientAndLocalSpanState extends Object implements ServerClientAndLocalSpanState
ServerClientAndLocalSpanState implementation that keeps trace state using a ThreadLocal variable.| Constructor and Description |
|---|
ThreadLocalServerClientAndLocalSpanState(InetAddress ip,
int port,
String serviceName)
Deprecated.
Please switch to constructor that takes 'int' for ip. This only does a conversion from the InetAddress to integer anyway
and using InetAddress can result in ns lookup and nasty side effects.
|
ThreadLocalServerClientAndLocalSpanState(int ip,
int port,
String serviceName)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Endpoint |
endpoint()
Gets the Endpoint (ip, port, service name) for this service.
|
Span |
getCurrentClientSpan()
Gets the Span for the client request that was started as part of current request.
|
Span |
getCurrentLocalSpan()
Gets the Span for the local request that was started as part of current request.
|
ServerSpan |
getCurrentServerSpan()
Gets the Span for the server request we are currently part of.
|
Boolean |
sample()
Indicates if we should sample current request.
|
void |
setCurrentClientSpan(Span span)
Sets current client span.
|
void |
setCurrentLocalSpan(Span span)
Sets current local span.
|
void |
setCurrentServerSpan(ServerSpan span)
Set span for current request.
|
@Deprecated public ThreadLocalServerClientAndLocalSpanState(InetAddress ip, int port, String serviceName)
ip - InetAddress of current host. If you don't have access to InetAddress you can use InetAddressUtilities#getLocalHostLANAddress()port - port on which current process is listening.serviceName - Name of the local service being traced. Should be lowercase and not null or empty.public ThreadLocalServerClientAndLocalSpanState(int ip,
int port,
String serviceName)
ip - Int representation of ipv4 address.port - port on which current process is listening.serviceName - Name of the local service being traced. Should be lowercase and not null or empty.public ServerSpan getCurrentServerSpan()
getCurrentServerSpan in interface ServerSpanStatenull will be returned.public void setCurrentServerSpan(ServerSpan span)
setCurrentServerSpan in interface ServerSpanStatespan - Span for current request.public Endpoint endpoint()
endpoint in interface CommonSpanStatepublic Span getCurrentClientSpan()
getCurrentClientSpan in interface ClientSpanStatepublic void setCurrentClientSpan(Span span)
setCurrentClientSpan in interface ClientSpanStatespan - Client span.public Boolean sample()
CommonSpanStatesample in interface CommonSpanStatenull in case there is no indication if we should sample or not. true in case we got
the indication we should sample current request, false in case we should not sample the current
request.public Span getCurrentLocalSpan()
LocalSpanStategetCurrentLocalSpan in interface LocalSpanStatepublic void setCurrentLocalSpan(Span span)
LocalSpanStatesetCurrentLocalSpan in interface LocalSpanStatespan - Local span.Copyright © 2016. All rights reserved.