For more information on how to get started with Datadog, see this article.

A recent update to Datadog service integrations allows you to set custom tags for Datadog. The CLI has a --user-config-json parameter that accepts a JSON document in the same form as the corresponding API call. Information on the allowed tag format is available from Datadog.

The example in this article shows you how to create an integration between Aiven for Apache Kafka and Datadog using the command line client and how to set up a custom tag. Creating the integration works similarly for all services that support Datadog integration (Apache Kafka, Elasticsearch, PostgreSQL, and Redis). Note that the console output in the examples has been truncated to make it easier to read.

Requirements:

  • A user authorized to create services.

  • CLI authentication set up. You can find instructions for setting up and using the command line client in the client README.

  • An existing project (named test in the example).

To set up a Datadog integration with custom tags:

  1. Create a new Apache Kafka service named kafka1 under the test project:

    $ avn service create --project=test -tkafka -pstartup-2 kafka1

  2. Create a service integration endpoint for Datadog in the test project using custom tags:

    $ avn service integration-endpoint-create --project=test \
    --endpoint-name=ddog1 --endpoint-type=datadog \
    --user-config-json=\
    '{"datadog_api_key":"<api-key>", "datadog_tags":[{"tag":"foo", "comment":"bar"}]}'

  3. Run the service list command to check that the service starts up and the status is RUNNING:

    $ avn service list --project=test
    SERVICE_NAME SERVICE_TYPE STATE CLOUD_NAME PLAN ...
    ============ ============ ======= =========== ========= ...
    kafka1 kafka RUNNING google-e... startup-2 ...

    Note: It may take some time for the service to reach RUNNING status.

  4. Check that the integration endpoint is found, and make note of the ENDPOINT_ID value:

    $ avn service integration-endpoint-list --project=test
    ENDPOINT_ID ENDPOINT_NAME ENDPOINT_TYPE
    ==================================== ============= =============
    01234567-89ab-cdef-0123-456789abcdef ddog1 datadog

  5. Create the service integration between the source Kafka service and the Datadog destination endpoint:

    $ avn service integration-create --project=test \
    --integration-type=datadog \
    --source-service=kafka1 \
    --dest-endpoint-id=01234567-89ab-cdef-0123-456789abcdef

  6. Check that the Kafka-Datadog integration appears in the list of integrations:

    $ avn service integration-list --project=test kafka1
    SERVICE_INTEGRATION_ID SOURCE DEST INTEGRATION_TYPE
    ======================= ======= ========== ================
    e590456b-54e9-4334-9... kafka1 f269edb... datadog
    (integration not ena... kafka1 kafka1 kafka_logs

    For the purposes of your Datadog integration, you can ignore the listed Kafka-Kafka integration.

Did this answer your question?