private ObjectNode getStreamSerializeObjectNode() { ObjectNode obj = (ObjectNode) mapper.valueToTree(this); obj.put("type", "subsegment"); obj.put("parent_id", getParent().getId()); obj.put("trace_id", parentSegment.getTraceId().toString()); return obj; }
private ObjectNode getStreamSerializeObjectNode() { ObjectNode obj = (ObjectNode) mapper.valueToTree(this); obj.put("type", "subsegment"); obj.put("parent_id", getParent().getId()); obj.put("trace_id", parentSegment.getTraceId().toString()); return obj; }
/** * * @throws SegmentNotFoundException * if {@code contextMissingStrategy} throws exceptions and no segment or subsegment is currently in progress * @return the ID of the {@code Segment} or {@code Subsegment} currently in progress, or {@code null} if {@code contextMissingStrategy} suppresses exceptions and no segment or subsegment is currently in progress */ public String currentEntityId() { SegmentContext context = getSegmentContext(); if (null == context) { return null; } Entity current = context.getTraceEntity(); if (null != current) { return current.getId(); } else { contextMissingStrategy.contextMissing("Failed to get current entity ID: segment or subsegment cannot be found.", SegmentNotFoundException.class); return null; } }
/** * * @throws SegmentNotFoundException * if {@code contextMissingStrategy} throws exceptions and no segment or subsegment is currently in progress * @return the ID of the {@code Segment} or {@code Subsegment} currently in progress, or {@code null} if {@code contextMissingStrategy} suppresses exceptions and no segment or subsegment is currently in progress */ public String currentEntityId() { SegmentContext context = getSegmentContext(); if (null == context) { return null; } Entity current = context.getTraceEntity(); if (null != current) { return current.getId(); } else { contextMissingStrategy.contextMissing("Failed to get current entity ID: segment or subsegment cannot be found.", SegmentNotFoundException.class); return null; } }