Search code examples
datadogartillery

Artillery test script exits without waiting for artillery-plugin-datadog to finish flushing


I have an Artillery test script which uses artillery-plugin-datadog for periodically flushing metrics to Datadog.

In shell script:

export DEBUG=metrics,plugin:datadog

In artillery yml file:

plugins:
  datadog:
    prefix: "artillery.[my-prefix]."
    tags:
      ...

However, it looks like Artillery does not wait for plugin to complete the metrics sending and exits process when test scenario is complete. I see in logs that plugin initiates flushing of metrics, but they do not reach DD:

  metrics Flushing 31 metrics to DataDog +12s
  metrics Calling add_metrics with ...

In short scenarios I was not able to get any metrics in DD. In longer scenarios last couple of metric flushes always do not appear in DD.

Is there any way to tell Artillery to wait for plugin flushing before exiting test process? I didn't found anything about it in documentation.


Solution

  • Unfortunately this is a known issue with artillery-plugin-datadog, which seems abandoned. I took a quick look and the call to flush the stats is not synchronous.

    Consider using artillery-plugin-publish-metrics instead.