Package codes.grow.packages.skywalking
Record Class NativeSpan
java.lang.Object
java.lang.Record
codes.grow.packages.skywalking.NativeSpan
- Record Components:
traceId- native trace id (for example<hex>.<n>.<ms>)segmentId- segment idspanId- span id within the segmentparentSpanId- parent within the segment, −1 for the segment rootrefs- cross-segment parentsserviceCode- service nameserviceInstanceName- instance namestartTime- start (epoch ms)endTime- end (epoch ms)endpointName- endpoint (operation) nametype-Entry,ExitorLocalpeer- remote address of exit spanscomponent- component nameisError- whether the span failedlayer- layer (Http,Database, ...)- tagslogs- span logs
public record NativeSpan(String traceId, String segmentId, int spanId, int parentSpanId, List<NativeSpanRef> refs, String serviceCode, String serviceInstanceName, long startTime, long endTime, String endpointName, String type, String peer, String component, boolean isError, String layer, List<KeyValue> tags, List<NativeSpanLog> logs)
extends Record
A span as SkyWalking stores it (agents,
/v3/segments), read through GraphQL. Ids are
opaque strings; a span is identified by (segmentId, spanId); parentSpanId −1
marks the segment root whose parent, if any, is refs[0]. Times are epoch milliseconds.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNativeSpan(String traceId, String segmentId, int spanId, int parentSpanId, List<NativeSpanRef> refs, String serviceCode, String serviceInstanceName, long startTime, long endTime, String endpointName, String type, String peer, String component, boolean isError, String layer, List<KeyValue> tags, List<NativeSpanLog> logs) Copies the lists and normalises nulls. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponentrecord component.Returns the value of theendpointNamerecord component.longendTime()Returns the value of theendTimerecord component.final booleanIndicates whether some other object is "equal to" this one.static NativeSpanfromJson(com.fasterxml.jackson.databind.JsonNode s) Decodes one span of a GraphQL response (missing fields get neutral defaults).final inthashCode()Returns a hash code value for this object.booleanisError()Returns the value of theisErrorrecord component.layer()Returns the value of thelayerrecord component.logs()Returns the value of thelogsrecord component.intReturns the value of theparentSpanIdrecord component.peer()Returns the value of thepeerrecord component.refs()Returns the value of therefsrecord component.Returns the value of thesegmentIdrecord component.Returns the value of theserviceCoderecord component.Returns the value of theserviceInstanceNamerecord component.intspanId()Returns the value of thespanIdrecord component.static StringThe SPEC span id of a native span.longReturns the value of thestartTimerecord component.tags()Returns the value of thetagsrecord component.toSpan()Converts to the SPEC model: trace id verbatim; span id<segmentId>-<spanId>; the parent is the same segment's parent span whenparentSpanId >= 0, elserefs[0]; further refs become links (attributesw.ref_type); kind Entry → server, Exit → client, Local → internal (other: unspecified); name = endpoint name; times ms → µs; status error whenisError; attributes = tags plussw.component,sw.layer,sw.peer,sw.service_instance(when set); span logs become events (name = theeventvalue, elselog).final StringtoString()Returns a string representation of this record class.traceId()Returns the value of thetraceIdrecord component.type()Returns the value of thetyperecord component.
-
Field Details
-
FIELDS
GraphQL selection of a native span.- See Also:
-
-
Constructor Details
-
NativeSpan
public NativeSpan(String traceId, String segmentId, int spanId, int parentSpanId, List<NativeSpanRef> refs, String serviceCode, String serviceInstanceName, long startTime, long endTime, String endpointName, String type, String peer, String component, boolean isError, String layer, List<KeyValue> tags, List<NativeSpanLog> logs) Copies the lists and normalises nulls.- Parameters:
traceId- trace idsegmentId- segment idspanId- span idparentSpanId- parent span idrefs- refsserviceCode- serviceserviceInstanceName- instancestartTime- startendTime- endendpointName- endpointtype- typepeer- peercomponent- componentisError- error flaglayer- layertags- tagslogs- logs
-
-
Method Details
-
fromJson
Decodes one span of a GraphQL response (missing fields get neutral defaults).- Parameters:
s- JSON object- Returns:
- the span
-
spanKey
The SPEC span id of a native span.- Parameters:
segmentId- segment idspanId- span id within the segment- Returns:
<segmentId>-<spanId>
-
toSpan
Converts to the SPEC model: trace id verbatim; span id<segmentId>-<spanId>; the parent is the same segment's parent span whenparentSpanId >= 0, elserefs[0]; further refs become links (attributesw.ref_type); kind Entry → server, Exit → client, Local → internal (other: unspecified); name = endpoint name; times ms → µs; status error whenisError; attributes = tags plussw.component,sw.layer,sw.peer,sw.service_instance(when set); span logs become events (name = theeventvalue, elselog).- Returns:
- the span
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
traceId
Returns the value of thetraceIdrecord component.- Returns:
- the value of the
traceIdrecord component
-
segmentId
Returns the value of thesegmentIdrecord component.- Returns:
- the value of the
segmentIdrecord component
-
spanId
public int spanId()Returns the value of thespanIdrecord component.- Returns:
- the value of the
spanIdrecord component
-
parentSpanId
public int parentSpanId()Returns the value of theparentSpanIdrecord component.- Returns:
- the value of the
parentSpanIdrecord component
-
refs
Returns the value of therefsrecord component.- Returns:
- the value of the
refsrecord component
-
serviceCode
Returns the value of theserviceCoderecord component.- Returns:
- the value of the
serviceCoderecord component
-
serviceInstanceName
Returns the value of theserviceInstanceNamerecord component.- Returns:
- the value of the
serviceInstanceNamerecord component
-
startTime
public long startTime()Returns the value of thestartTimerecord component.- Returns:
- the value of the
startTimerecord component
-
endTime
public long endTime()Returns the value of theendTimerecord component.- Returns:
- the value of the
endTimerecord component
-
endpointName
Returns the value of theendpointNamerecord component.- Returns:
- the value of the
endpointNamerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
peer
Returns the value of thepeerrecord component.- Returns:
- the value of the
peerrecord component
-
component
Returns the value of thecomponentrecord component.- Returns:
- the value of the
componentrecord component
-
isError
public boolean isError()Returns the value of theisErrorrecord component.- Returns:
- the value of the
isErrorrecord component
-
layer
Returns the value of thelayerrecord component.- Returns:
- the value of the
layerrecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-
logs
Returns the value of thelogsrecord component.- Returns:
- the value of the
logsrecord component
-