components/global/core/io.cellery.observability.tracing.receiver/src/main/java/io/cellery/observability/tracing/receiver/TracingEventSource.java
private void handleEventReceive(byte[] byteArray, String contentType) {
            if (logger.isDebugEnabled()) {
                logger.debug("Received message of type " + contentType);
            }

            // Decoding the Zipkin spans
            // Decoding Zipkin spans (encoding is automatically detected)
            List<ZipkinSpan> spans = null;
            try {
                spans = Codec.decodeData(byteArray);
                if (logger.isDebugEnabled()) {
                    logger.debug("Decoded " + spans.size() + " Zipkin Spans");
                }
            } catch (Throwable t) {
                logger.error("Failed to parse received tracing data", t);
            }

            if (spans != null) {
                // Sending the received Zipkin spans to the source event listener
                for (ZipkinSpan span : spans) {
                    Map<String, Object> attributes = new HashMap<>();

                    attributes.put(Constants.ATTRIBUTE_TRACE_ID, span.getTraceId());
                    attributes.put(Constants.ATTRIBUTE_SPAN_ID, span.getId());
                    attributes.put(Constants.ATTRIBUTE_PARENT_ID, span.getParentId());
                    attributes.put(Constants.ATTRIBUTE_OPERATION_NAME, span.getName());
                    attributes.put(Constants.ATTRIBUTE_SERVICE_NAME, span.getServiceName());
                    attributes.put(Constants.ATTRIBUTE_SPAN_KIND, span.getKind());
                    attributes.put(Constants.ATTRIBUTE_TIMESTAMP, span.getTimestamp() / 1000);
                    attributes.put(Constants.ATTRIBUTE_DURATION, span.getDuration() / 1000);
                    attributes.put(Constants.ATTRIBUTE_TAGS, gson.toJson(span.getTags()));

                    sourceEventListener.onEvent(attributes, new String[0]);
                    if (logger.isDebugEnabled()) {
                        logger.debug("Emitted event - span " + span.getTraceId() + "-" + span.getId()
                                + " to event source listener");
                    }
                }
            }
        }
/**
         * Handle tracing data receive.
         *
         * @param byteArray   The byte array received
         * @param contentType The content type of the message received
         */
Handle tracing data receive.
@param byteArray   The byte array received
@param contentType The content type of the message received
Handle tracing data receive . @param byteArray The byte array received @param contentType The content type of the message received
private void handleEventReceive(byte[] byteArray, String contentType) {
            if (logger.isDebugEnabled()) {
                logger.debug("Received message of type " + contentType);
            }
            List<ZipkinSpan> spans = null;
            try {
                spans = Codec.decodeData(byteArray);
                if (logger.isDebugEnabled()) {
                    logger.debug("Decoded " + spans.size() + " Zipkin Spans");
                }
            } catch (Throwable t) {
                logger.error("Failed to parse received tracing data", t);
            }
            if (spans != null) {
                for (ZipkinSpan span : spans) {
                    Map<String, Object> attributes = new HashMap<>();
                    attributes.put(Constants.ATTRIBUTE_TRACE_ID, span.getTraceId());
                    attributes.put(Constants.ATTRIBUTE_SPAN_ID, span.getId());
                    attributes.put(Constants.ATTRIBUTE_PARENT_ID, span.getParentId());
                    attributes.put(Constants.ATTRIBUTE_OPERATION_NAME, span.getName());
                    attributes.put(Constants.ATTRIBUTE_SERVICE_NAME, span.getServiceName());
                    attributes.put(Constants.ATTRIBUTE_SPAN_KIND, span.getKind());
                    attributes.put(Constants.ATTRIBUTE_TIMESTAMP, span.getTimestamp() / 1000);
                    attributes.put(Constants.ATTRIBUTE_DURATION, span.getDuration() / 1000);
                    attributes.put(Constants.ATTRIBUTE_TAGS, gson.toJson(span.getTags()));
                    sourceEventListener.onEvent(attributes, new String[0]);
                    if (logger.isDebugEnabled()) {
                        logger.debug("Emitted event - span " + span.getTraceId() + "-" + span.getId()
                                + " to event source listener");
                    }
                }
            }
        }
private void handleEventReceive ( byte [ ] byteArray , String contentType ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Received message of type " + contentType ) ; } List < ZipkinSpan > spans = null ; try { spans = Codec . decodeData ( byteArray ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Decoded " + spans . size ( ) + " Zipkin Spans" ) ; } } catch ( Throwable t ) { logger . error ( "Failed to parse received tracing data" , t ) ; } if ( spans != null ) { for ( ZipkinSpan span : spans ) { Map < String , Object > attributes = new HashMap < > ( ) ; attributes . put ( Constants . ATTRIBUTE_TRACE_ID , span . getTraceId ( ) ) ; attributes . put ( Constants . ATTRIBUTE_SPAN_ID , span . getId ( ) ) ; attributes . put ( Constants . ATTRIBUTE_PARENT_ID , span . getParentId ( ) ) ; attributes . put ( Constants . ATTRIBUTE_OPERATION_NAME , span . getName ( ) ) ; attributes . put ( Constants . ATTRIBUTE_SERVICE_NAME , span . getServiceName ( ) ) ; attributes . put ( Constants . ATTRIBUTE_SPAN_KIND , span . getKind ( ) ) ; attributes . put ( Constants . ATTRIBUTE_TIMESTAMP , span . getTimestamp ( ) / 1000 ) ; attributes . put ( Constants . ATTRIBUTE_DURATION , span . getDuration ( ) / 1000 ) ; attributes . put ( Constants . ATTRIBUTE_TAGS , gson . toJson ( span . getTags ( ) ) ) ; sourceEventListener . onEvent ( attributes , new String [ 0 ] ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Emitted event - span " + span . getTraceId ( ) + "-" + span . getId ( ) + " to event source listener" ) ; } } } }
Handle tracing data receive.
Handle tracing data receive .
// Decoding the Zipkin spans // Decoding Zipkin spans (encoding is automatically detected) // Sending the received Zipkin spans to the source event listener