jenkinsci / datadog-plugin

A Jenkins plugin used to forward metrics, events, and service checks to an account at Datadog, automatically.
https://plugins.jenkins.io/datadog/
MIT License
34 stars 48 forks source link

Send webhooks via the Agent EVP Proxy when supported #316

Closed albertvaka closed 1 year ago

albertvaka commented 1 year ago

What does this PR do?

I also added tests for the whole webhooks logic, which didn't have any. They are mostly copies of the tests for the traces logic.

Description of the Change

Verification Process

Open Questions

albertvaka commented 1 year ago

I've changed the detection of the EVP Proxy support to be lazy, so it is checked when it's first needed and the result is cached for 1 hour.

This way we don't block at boot time and in the worst case scenario we add a 10 second delay (the timeout of the /info request) once every hour. Most times, the Agent will respond in a few milliseconds or not respond at all (ie: if it's not there or doesn't support the /info API) which will not block.

This also lets us support Agent upgrades without having to restart Jenkins.