Updated on 2022-06-02 GMT+08:00

Data Subscription

Application Performance Management (APM) allows you to subscribe to metrics or alarms. After the subscription, data can be forwarded to configured Kafka topics for you to retrieve.

Procedure

  1. In the navigation pane, choose Configuration Center > Data Subscription.
  2. Click Create Subscription Rule in the upper right corner of the page. Then, set parameters according to Table 1 and click OK.

    Table 1 Subscription rule parameters

    Parameter

    Description

    Example

    Rule name

    Subscription rule name.

    Enter apm-kafka-test.

    Subscription content

    Tracing.

    Select Apm Tracing.

    Subscription Target Type

    Custom Kafka, which cannot be changed.

    -

    Subscription target connection address

    Kafka address, which needs to be connected to Internet.

    Each address must be in the format of "IPv4 address:port". If there are multiple addresses, separate them by commas (,). Example: 192.168.0.1:9092,192.168.0.2:9092

    Set the parameters based on actual requirements.

  3. (Optional) Click to enable Kafka SASL_SSL and set the parameters according to Table 2.

    Currently, APM supports only Kafka SASL_SSL security authentication. If Kafka SASL_SSL has been enabled for instances, enable this option when configuring data subscription.

    Table 2 Kafka SASL_SSL parameters

    Parameter

    Description

    Example

    User name

    SASL username for instance access authentication.

    demo

    Password

    SASL password for instance access authentication. Keep your password secure. The system cannot detect your password.

    -

    Client certificate

    Client certificate in the .pem format.

    -

  4. On the Rule Details page, click Verify and Save Custom Kafka Configuration to verify the connectivity of the custom Kafka instance.
  5. Select the Kafka topic to which the data is to be sent.
  6. Click OK.

Data Subscription Format

  • The tracing data of APM is in the standard Zipkin format. Keywords appId and projectId need to be parsed from binaryAnnotations. The following shows an example.
    [{
    	"traceId": "adb64773d88dfac2",
    	"id": "91324c265f7415a3",
    	"name": "usg-stun:usg-cce-demo-99592:redis.clients.jedis.binaryjediscluster.subscribe",
    	"timestamp": 1599187789769000,
    	"duration": 6000,
    	"binaryAnnotations": [{
    		"key": "SRC-RESOURCE-ID",
    		"value": "usg-stun:8080|d74a54d7a25be6552e640b3f658c5ad7"
    	},
    	{
    		"key": "TX-TYPE",
    		"value": "subscribe"
    	},
    	{
    		"key": "appId",
    		"value": "1011c321b34ff7bf7f2d02ab8a95750b"
    	},
    	{
    		"key": "clusterId",
    		"value": "unknown"
    	},
    	{
    		"key": "destinationId",
    		"value": "REDIS"
    	},
    	{
    		"key": "monitorGroup",
    		"value": "meeting-ulanqab3-mgdc1"
    	},
    	{
    		"key": "namespace",
    		"value": "usg"
    	},
    	{
    		"key": "projectId",
    		"value": "fd5c4fcd87874b5f85240cd9d93b34e0"
    	},
    	{
    		"key": "result",
    		"value": "1"
    	},
    	{
    		"key": "root",
    		"value": "true"
    	},
    	{
    		"key": "serviceType",
    		"value": "REDIS"
    	},
    	{
    		"key": "transaction.info",
    		"value": "false"
    	}]
    }]
  • Kafka message example:
    key:, 
    value:[{"traceId":"adb64773d88dfac2","id":"91324c265f7415a3","name":"usg-stun:usg-cce-demo-99592:redis.clients.jedis.binaryjediscluster.subscribe","timestamp":1599187789769000,"duration":6000,"binaryAnnotations":[{"key":"SRC-RESOURCE-ID","value":"usg-stun:8080|d74a54d7a25be6552e640b3f658c5ad7"},{"key":"TX-TYPE","value":"subscribe"},{"key":"appId","value":"1011c321b34ff7bf7f2d02ab8a95750b"},{"key":"clusterId","value":"unknown"},{"key":"destinationId","value":"REDIS"},{"key":"monitorGroup","value":"meeting-ulanqab3-mgdc1"},{"key":"namespace","value":"usg"},{"key":"projectId","value":"fd5c4fcd87874b5f85240cd9d93b34e0"},{"key":"result","value":"1"},{"key":"root","value":"true"},{"key":"serviceType","value":"REDIS"},{"key":"transaction.info","value":"false"}]}]

Follow-up Operations

After the data subscription rule is created, APM will send data to your configured Kafka topic so that you can retrieve the subscribed tracing data.