All Downloads are FREE. Search and download functionalities are using the official Maven repository.

d.tnt4j.streams.tnt4j-streams-kafka.2.3.0.source-code.tnt-data-source_kafka_msg_trace.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="utf-8"?>
<tnt-data-source
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/Nastel/tnt4j-streams/master/config/tnt-data-source.xsd">

    <parser name="HeadersParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="SupportedClass" value="org.apache.kafka.common.header.Header"/>

        <field name="H_${HFieldNameLoc}" locator="value" locator-type="Label" datatype="String">
            <field-locator id="HFieldNameLoc" locator="key" locator-type="Label" datatype="String"/>
        </field>
    </parser>

    <parser name="TopicPartitionParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="supportedClass" value="org.apache.kafka.common.TopicPartition"/>

        <field name="Topic" locator="topic" locator-type="Label"/>
        <field name="Partition" locator="partition" locator-type="Label" datatype="Number"/>
    </parser>

    <!-- PRODUCER parsers start -->
    <parser name="ProducerRecordParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="SupportedClass" value="org.apache.kafka.clients.producer.ProducerRecord"/>

        <field name="EventType" value="SEND"/>
        <field name="EventName" value="Kafka_Producer_Send"/>

        <field name="Topic" locator="topic" locator-type="Label"/>
        <field name="Partition" locator="partition" locator-type="Label" datatype="Number"/>

        <field name="Key" locator="key" locator-type="Label"/>
        <field name="Value" locator="value" locator-type="Label" datatype="AsInput"/>
        <field name="Message" locator="value" locator-type="Label" datatype="String"/>

        <field name="StreamTime" locator="DateTime" locator-type="StreamProp" datatype="DateTime" units="Milliseconds" transparent="true"/>
        <field name="StartTime" locator="timestamp" locator-type="Label" datatype="Timestamp" units="Milliseconds">
            <field-transform lang="groovy" name="ProducerStartTimeTransform"><![CDATA[
                $fieldValue == null ? ${StreamTime} : $fieldValue;
            ]]></field-transform>
        </field>
        <field name="EndTime" locator="StartTime" locator-type="Activity"/>

        <field name="MsgSignature" value="" transparent="true">
            <field-transform lang="groovy" name="SendSignatureTransform"><![CDATA[
                ${Value} == null
                    ? null
                    : com.jkoolcloud.tnt4j.streams.custom.interceptors.kafka.reporters.trace.MsgTraceReporter.calcSignature(${Topic}, ${Value})
            ]]></field-transform>
        </field>

        <embedded-activity name="Headers" locator="headers.headers" locator-type="Label">
            <parser-ref name="HeadersParser"/>
        </embedded-activity>
    </parser>

    <parser name="RecordMetadataParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="SupportedClass" value="org.apache.kafka.clients.producer.RecordMetadata"/>

        <field name="EventType" value="EVENT"/>
        <field name="EventName" value="Kafka_Producer_Acknowledge"/>

        <field name="TopicPartition" locator="topicPartition" locator-type="Label" transparent="true">
            <parser-ref name="TopicPartitionParser" aggregation="Merge"/>
        </field>
        <field name="Offset" locator="offset" locator-type="Label" datatype="Number"/>

        <field name="StreamTime" locator="DateTime" locator-type="StreamProp" datatype="DateTime" units="Milliseconds" transparent="true"/>
        <field name="StartTime" locator="timestamp" locator-type="Label" datatype="Timestamp" units="Milliseconds">
            <field-transform lang="groovy" name="ProducerStartTimeTransform"><![CDATA[
                $fieldValue == null ? ${StreamTime} : $fieldValue;
            ]]></field-transform>
        </field>
        <field name="EndTime" locator="StartTime" locator-type="Activity"/>

        <field name="serializedKeySize" locator="serializedKeySize" locator-type="Label" datatype="Number"/>
        <field name="serializedValueSize" locator="serializedValueSize" locator-type="Label" datatype="Number"/>

        <field name="MsgLength" value="" datatype="Number">
            <field-transform lang="groovy"><![CDATA[
                (${serializedKeySize} >= 0
                    ? ${serializedKeySize}
                    : 0) +
                (${serializedValueSize} >=0
                    ? ${serializedValueSize}
                    : 0)
            ]]></field-transform>
        </field>
    </parser>
    <!-- PRODUCER parsers end -->

    <!-- CONSUMER parsers start -->
    <parser name="ConsumerRecordParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="SupportedClass" value="org.apache.kafka.clients.consumer.ConsumerRecord"/>

        <field name="EventType" value="RECEIVE"/>
        <field name="EventName" value="Kafka_Consumer_Consume_Record"/>

        <field name="Topic" locator="topic" locator-type="Label"/>
        <field name="Partition" locator="partition" locator-type="Label" datatype="Number"/>
        <field name="Offset" locator="offset" locator-type="Label" datatype="Number"/>

        <field name="StartTime" locator="timestamp" locator-type="Label" datatype="Timestamp" units="Milliseconds"/>
        <field name="EndTime" locator="DateTime" locator-type="StreamProp" datatype="DateTime" units="Milliseconds"/>

        <field name="TimestampType" locator="timestampType" locator-type="Label"/>
        <field name="Key" locator="key" locator-type="Label"/>
        <field name="Value" locator="value" locator-type="Label" datatype="AsInput"/>
        <field name="Message" locator="value" locator-type="Label" datatype="String"/>

        <field name="serializedKeySize" locator="serializedKeySize" locator-type="Label"/>
        <field name="serializedValueSize" locator="serializedValueSize" locator-type="Label"/>

        <field name="leaderEpoch" locator="leaderEpoch.value" locator-type="Label"/>

        <field name="MsgLength" value="" datatype="Number">
            <field-transform lang="groovy"><![CDATA[
               (${serializedKeySize} >= 0
                   ? ${serializedKeySize}
                   : 0) +
               (${serializedValueSize} >=0
                   ? ${serializedValueSize}
                   : 0)
           ]]></field-transform>
        </field>
        <field name="MsgSignature" value="" transparent="true">
            <field-transform lang="groovy" name="ConsumeSignatureTransform"><![CDATA[
                ${Value} == null
                    ? null
                    : com.jkoolcloud.tnt4j.streams.custom.interceptors.kafka.reporters.trace.MsgTraceReporter.calcSignature(${Topic}, ${Value})
            ]]></field-transform>
        </field>

        <embedded-activity name="Headers" locator="headers.headers" locator-type="Label">
            <parser-ref name="HeadersParser"/>
        </embedded-activity>
    </parser>

    <parser name="OffsetAndMetadataParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="SupportedClass" value="org.apache.kafka.clients.consumer.OffsetAndMetadata"/>

        <field name="EventType" value="EVENT"/>
        <field name="EventName" value="Kafka_Consumer_Commit_Record"/>
        <field name="Offset" locator="offset" locator-type="Label" datatype="Number"/>
        <field name="Metadata" locator="metadata" locator-type="Label"/>
        <field name="StartTime" locator="DateTime" locator-type="StreamProp" datatype="DateTime" units="Milliseconds"/>
        <field name="EndTime" locator="StartTime" locator-type="Activity"/>
        <field name="leaderEpoch" locator="leaderEpoch.value" locator-type="Label"/>
    </parser>
    <!-- CONSUMER parsers end -->

    <parser name="KafkaTraceParser" class="com.jkoolcloud.tnt4j.streams.parsers.ActivityJavaObjectParser">
        <property name="SupportedClass" value="com.jkoolcloud.tnt4j.streams.custom.interceptors.kafka.reporters.trace.KafkaTraceEventData"/>

        <!-- SEND fields -->
        <field name="producerRecord" locator="producerRecord" locator-type="Label" transparent="true">
            <parser-ref name="ProducerRecordParser" aggregation="Merge"/>
        </field>
        <!-- SEND end -->

        <!-- ACK fields -->
        <field name="recordMetadata" locator="recordMetadata" locator-type="Label" transparent="true">
            <parser-ref name="RecordMetadataParser" aggregation="Merge"/>
        </field>
        <field name="Exception" locator="exception.getMessage" locator-type="Label"/>
        <field name="ClusterId" locator="clusterResource.clusterId" locator-type="Label"/>
        <!-- ACK end -->

        <!-- CONSUME Fields -->
        <field name="ConsumerRecord" locator="consumerRecord" locator-type="Label" transparent="true">
            <parser-ref name="ConsumerRecordParser" aggregation="Merge"/>
        </field>
        <!-- CONSUME end -->

        <!-- COMMIT Fields -->
        <field name="TopicPartition" locator="topicPartition" locator-type="Label" transparent="true">
            <parser-ref name="TopicPartitionParser" aggregation="Merge"/>
        </field>

        <field name="OffsetAndMetadataParser" locator="offsetAndMetadata" locator-type="Label" transparent="true">
            <parser-ref name="OffsetAndMetadataParser" aggregation="Merge"/>
        </field>
        <!--COMMIT end -->

        <!-- COMMON Fields -->
        <field name="KafkaType" locator="type" locator-type="Label"/>
        <field name="ApplName" locator="appInfo" locator-type="Label"/>
        <field name="TrackingId" locator="MsgSignature" locator-type="Activity">
            <field-transform lang="groovy" name="SignatureTransform"><![CDATA[
                StringUtils.isNotEmpty($fieldValue)
                    ? $fieldValue
                    : null
            ]]></field-transform>
        </field>
        <field name="ParentId" locator="parentId" locator-type="Label"/>
        <field name="MessageAge" locator="msgAgeMs" locator-type="Label"/>

        <field name="ResourceName" formattingPattern="QUEUE={0}">
            <field-locator locator="Topic" locator-type="Activity"/>
        </field>
        <field name="Correlator" value="">
            <field-transform lang="groovy" name="CorrelatorTransform"><![CDATA[
                ${Offset} == null
                    ? null
                    : ${Topic} + "_" + ${Partition} + "_" + ${Offset}
            ]]></field-transform>
        </field>
    </parser>
</tnt-data-source>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy