Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tests): allow to setup the Datadog host URL #359

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

sdenef-adeo
Copy link
Contributor

For local tests purposes, we may want to update the Datadog host URL used for Datadog API requests.

Example: testing rate limiting
Running a local NginX server acting as a Datadog API mock. We can set a dedicated rate-limit config without burning our Datadog instance (called "organization" by Datadog) quota.

Reminder: https://docs.datadoghq.com/api/latest/rate-limits/

@lvaylet
Copy link
Collaborator

lvaylet commented Nov 3, 2023

Hi @sdenef-adeo, I understand the rationale behind this request. This being said, I do not understand how the Datadog client will be able to use the host defined in these environment variables. Unlike DATADOG_API_KEY and DATADOG_APP_KEY, there is no mention of DATADOG_HOST in the package documentation on PyPi.

@sdenef-adeo sdenef-adeo force-pushed the refactor/tests-setup-datadog-host branch from 329431a to 20fd1ee Compare November 3, 2023 12:53
@sdenef-adeo
Copy link
Contributor Author

Sorry, I made a typo, then I updated the PR.

It's api_host then the client will initialize accordingly.
cf https://datadogpy.readthedocs.io/en/latest/#datadog.initialize

Also part of docs/provides/datadog.md

Optional arguments to configure Datadog are documented in the Datadog initialize method here. You can pass them in the backend section, such as specifying api_host: api.datadoghq.eu in order to use the EU site.

Copy link
Collaborator

@lvaylet lvaylet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Just a tiny change and we can merge.

samples/config.yaml Outdated Show resolved Hide resolved
tests/unit/test_stubs.py Outdated Show resolved Hide resolved
@sdenef-adeo sdenef-adeo force-pushed the refactor/tests-setup-datadog-host branch from 20fd1ee to 24115cb Compare November 27, 2023 15:47
@sdenef-adeo
Copy link
Contributor Author

sdenef-adeo commented Nov 27, 2023

DATADOG_HOST renamed to DATADOG_API_HOST
And rebase on the last commit from main branch

@lvaylet
Copy link
Collaborator

lvaylet commented Nov 27, 2023

Thanks @sdenef-adeo. Let me take care of the new vulnerabilities reported by safety and let's merge.

@lvaylet lvaylet added p/datadog Datadog provider issue backend tests Testing improvements / bugs refactor labels Nov 29, 2023
@lvaylet
Copy link
Collaborator

lvaylet commented Nov 29, 2023

The new vulnerability reported by safety check was handled in #397. I will move forward and merge this PR.

@lvaylet lvaylet merged commit d6fc07d into google:master Nov 29, 2023
6 of 12 checks passed
@sdenef-adeo sdenef-adeo deleted the refactor/tests-setup-datadog-host branch November 30, 2023 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend p/datadog Datadog provider issue refactor tests Testing improvements / bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants