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

Set API Key in URL when submit distribution metrics #480

Merged
merged 2 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions datadog/api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def _set_api_and_app_keys_in_params(cls, api_version, path):
constructed_path = construct_path(api_version, path)

set_of_paths = {
"v1/distribution_points",
"v1/series",
"v1/check_run",
"v1/events",
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,25 @@ def retry_condition(r):
assert len(metric_query_tuple["series"][0]["pointlist"]) == 1
assert metric_query_tuple["series"][0]["pointlist"][0][1] == 1

def test_distribution_metrics(self):
now = datetime.datetime.now()
now_ts = int(time.mktime(now.timetuple()))
metric_name = "test.distribution_metric." + str(now_ts)
host_name = "test.host." + str(now_ts)

# Submit a distribution metric
assert dog.Distribution.send(
distributions=[{
'metric': metric_name,
'points': [(now_ts - 60, [1.0])],
'type': 'distribution',
'host': host_name,
}]
)["status"] == "ok"

# FIXME: Query and verify the test metric result. Currently, it takes
# too long for a new distribution metric to become available for query.

def test_graph_snapshot(self):
metric_query = "system.load.1{*}"
event_query = "*"
Expand Down