Using the Streaming API
General
The streaming API fetches both test and monitor data. It is not possible to single out one of these categories.
The streaming API does not fetch data from script-based tests (those represented by a rectangle instead of a jigsaw piece in the Control Center GUI), such as Ethernet service activation tests and transparency tests.
Kafka Topic Names
The Kafka topic names for the streaming API are as follows, where %s
is
the short name of the Control Center account (indicated when creating the account):
const ( exporterName = "kafka" metadataTopicTpl = "paa.public.accounts.%s.metadata" metricsTopicTpl = "paa.public.accounts.%s.metrics" )
Examples of Using the Streaming API
The examples that follow are found in the tarball
paa-streaming-api-client-examples.tar.gz
contained within the Control
Center tarball.
First, there is a basic example demonstrating how the metrics and their metadata are streamed separately and simply print the received messages to the console. You can run it as follows:
sudo ./build.sh run-basic --kafka-brokers localhost:9092 --account ACCOUNT_SHORTNAME
There is also a more advanced example where metrics and metadata messages are correlated. Use this command to run it:
sudo ./build.sh run-advanced --kafka-brokers localhost:9092 --account ACCOUNT_SHORTNAME
You need to use sudo
to run Docker commands such as the ones above.
Optionally, you can follow the Linux post-installation steps to be able to run Docker
commands without sudo
. For details, go to docs.docker.com/engine/install/linux-postinstall.