Skip to content

Commit

Permalink
Set API Key in URL when submit distribution metrics (#480)
Browse files Browse the repository at this point in the history
* Set API Key in URL when submit distribution metrics

* Add integration test for distribution metric submission
  • Loading branch information
tianchu authored and nmuesch committed Nov 15, 2019
1 parent 3c190f0 commit 09c0a95
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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

0 comments on commit 09c0a95

Please sign in to comment.