Skip to content

Reporters

Aditya Mukhopadhyay edited this page Aug 15, 2020 · 1 revision

foxx-tracer-collector has a simple plugin mechanism through which external reporters can be added and configured. This lets you use an external reporter designed for your specific endpoint even when it does not come bundled with the collector itself.

The collector comes with two reporters pre-installed:

  1. A noop reporter that does nothing. This reporter is baked in and cannot be removed, but it can be disabled.
  2. A console reporter that prints traces to the ArangoDB log. This reporter is pluggable and can be removed or disabled if required.

Finding Reporters

Pluggable reporters can be found by searching the NPM registry for the keyword "foxx-tracer-reporter". At the time of this writing, there is a production-ready reporter available for the Datadog Cloud Monitoring Service service. It is named foxx-tracer-reporter-datadog.

Adding a Reporter

foxx-tracer-collector uses Grunt as its build tool, and reporters are also managed by Grunt tasks. To add a reporter, execute the following:

npx grunt reporter:add --pkg=<reporter-package-name> --namespace=<reporter-key>

When this command has finished running, the reporter plugin in the package reporter-package-name is installed under node_modules, package.json gets updated, and an entry is made in 2 places using the provided reporter-key:

  1. An entry in reporters.json - A file present in the top-level project root folder that informs the collector about what reporters are available and under what key to search for their configuration in the manifest.
  2. An entry in the configuration object in manifest.json - This entry is prefixed with the term reporters- to minimize chances of collision with other configuration keys. If for example you provide datadog as the key, then the corresponding manifest configuration key becomes reporters-datadog. The contents of this setting object is provided by the reporter plugin being installed.

Removing a Reporter

To remove an installed reporter, execute the following:

npx grunt reporter:remove  --namespace=<reporter-key>

The reporter-key is key in reporters.json under which this reporter is registered. Executing this command performs the following actions:

  1. The reporter is uninstalled from node_modules.
  2. package.json gets updated.
  3. The reporter's entry is removed from reporters.json.
  4. The reporter's entry is removed from the manifest's configuration object.

Writing Your Own Reporter

See foxx-tracer-reporter-console.