Skip to content

Update usage attribute endpoint metadata fields #435

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

Merged
merged 1 commit into from
May 14, 2021
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.4.1.dev6",
"regenerated": "2021-05-12 18:19:21.712592",
"spec_repo_commit": "3445859"
"regenerated": "2021-05-14 06:52:51.788682",
"spec_repo_commit": "b30ab78"
},
"v2": {
"apigentools_version": "1.4.1.dev6",
"regenerated": "2021-05-12 18:19:53.536116",
"spec_repo_commit": "3445859"
"regenerated": "2021-05-14 06:53:21.404107",
"spec_repo_commit": "b30ab78"
}
}
}
2 changes: 1 addition & 1 deletion docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Class | Method | HTTP request | Description
*UsageMeteringApi* | [**get_usage_synthetics_api**](UsageMeteringApi.md#get_usage_synthetics_api) | **GET** /api/v1/usage/synthetics_api | Get hourly usage for Synthetics API Checks
*UsageMeteringApi* | [**get_usage_synthetics_browser**](UsageMeteringApi.md#get_usage_synthetics_browser) | **GET** /api/v1/usage/synthetics_browser | Get hourly usage for Synthetics Browser Checks
*UsageMeteringApi* | [**get_usage_timeseries**](UsageMeteringApi.md#get_usage_timeseries) | **GET** /api/v1/usage/timeseries | Get hourly usage for custom metrics
*UsageMeteringApi* | [**get_usage_top_avg_metrics**](UsageMeteringApi.md#get_usage_top_avg_metrics) | **GET** /api/v1/usage/top_avg_metrics | Get top custom metrics by hourly average
*UsageMeteringApi* | [**get_usage_top_avg_metrics**](UsageMeteringApi.md#get_usage_top_avg_metrics) | **GET** /api/v1/usage/top_avg_metrics | Get all custom metrics by hourly average
*UsageMeteringApi* | [**get_usage_trace**](UsageMeteringApi.md#get_usage_trace) | **GET** /api/v1/usage/traces | Get hourly usage for Trace Search
*UsersApi* | [**create_user**](UsersApi.md#create_user) | **POST** /api/v1/user | Create a user
*UsersApi* | [**disable_user**](UsersApi.md#disable_user) | **DELETE** /api/v1/user/{user_handle} | Disable a user
Expand Down
8 changes: 3 additions & 5 deletions docs/v1/UsageAttributionPagination.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# UsageAttributionPagination

The page count for the current pagination.
The metadata for the current pagination.

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**limit** | **int** | Maximum amount of records to be returned. | [optional]
**offset** | **int** | Records to be skipped before beginning to return. | [optional]
**sort_direction** | **str** | Direction to sort by. | [optional]
**sort_name** | **str** | Field to sort by. | [optional]
**total_number_of_records** | **int** | Total number of records. | [optional]
**next_record_id** | **str** | The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of this next_record_id. | [optional]
**total_number_of_records** | **int** | Total number of records. (deprecated after May 1st, 2021) | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)

Expand Down
12 changes: 7 additions & 5 deletions docs/v1/UsageMeteringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Method | HTTP request | Description
[**get_usage_synthetics_api**](UsageMeteringApi.md#get_usage_synthetics_api) | **GET** /api/v1/usage/synthetics_api | Get hourly usage for Synthetics API Checks
[**get_usage_synthetics_browser**](UsageMeteringApi.md#get_usage_synthetics_browser) | **GET** /api/v1/usage/synthetics_browser | Get hourly usage for Synthetics Browser Checks
[**get_usage_timeseries**](UsageMeteringApi.md#get_usage_timeseries) | **GET** /api/v1/usage/timeseries | Get hourly usage for custom metrics
[**get_usage_top_avg_metrics**](UsageMeteringApi.md#get_usage_top_avg_metrics) | **GET** /api/v1/usage/top_avg_metrics | Get top custom metrics by hourly average
[**get_usage_top_avg_metrics**](UsageMeteringApi.md#get_usage_top_avg_metrics) | **GET** /api/v1/usage/top_avg_metrics | Get all custom metrics by hourly average
[**get_usage_trace**](UsageMeteringApi.md#get_usage_trace) | **GET** /api/v1/usage/traces | Get hourly usage for Trace Search


Expand Down Expand Up @@ -2250,9 +2250,9 @@ Name | Type | Description | Notes
# **get_usage_top_avg_metrics**
> UsageTopAvgMetricsResponse get_usage_top_avg_metrics()

Get top custom metrics by hourly average
Get all custom metrics by hourly average

Get top [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed.
Get all [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed.

### Example

Expand All @@ -2278,12 +2278,13 @@ with ApiClient(configuration) as api_client:
"names_example",
] # [str] | Comma-separated list of metric names. (optional)
limit = 500 # int | Maximum number of results to return (between 1 and 5000) - defaults to 500 results if limit not specified. (optional) if omitted the server will use the default value of 500
next_record_id = "next_record_id_example" # str | List following results with a next_record_id provided in the previous query. (optional)

# example passing only required values which don't have defaults set
# and optional values
try:
# Get top custom metrics by hourly average
api_response = api_instance.get_usage_top_avg_metrics(month=month, day=day, names=names, limit=limit)
# Get all custom metrics by hourly average
api_response = api_instance.get_usage_top_avg_metrics(month=month, day=day, names=names, limit=limit, next_record_id=next_record_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling UsageMeteringApi->get_usage_top_avg_metrics: %s\n" % e)
Expand All @@ -2298,6 +2299,7 @@ Name | Type | Description | Notes
**day** | **datetime**| Datetime in ISO-8601 format, UTC, precise to day: [YYYY-MM-DD] for usage beginning at this hour. (Either month or day should be specified, but not both) | [optional]
**names** | **[str]**| Comma-separated list of metric names. | [optional]
**limit** | **int**| Maximum number of results to return (between 1 and 5000) - defaults to 500 results if limit not specified. | [optional] if omitted the server will use the default value of 500
**next_record_id** | **str**| List following results with a next_record_id provided in the previous query. | [optional]

### Return type

Expand Down
9 changes: 7 additions & 2 deletions src/datadog_api_client/v1/api/usage_metering_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ def __init__(self, api_client=None):
"day",
"names",
"limit",
"next_record_id",
],
"required": [],
"nullable": [],
Expand All @@ -1430,18 +1431,21 @@ def __init__(self, api_client=None):
"day": (datetime,),
"names": ([str],),
"limit": (int,),
"next_record_id": (str,),
},
"attribute_map": {
"month": "month",
"day": "day",
"names": "names",
"limit": "limit",
"next_record_id": "next_record_id",
},
"location_map": {
"month": "query",
"day": "query",
"names": "query",
"limit": "query",
"next_record_id": "query",
},
"collection_format_map": {
"names": "multi",
Expand Down Expand Up @@ -2778,9 +2782,9 @@ def get_usage_timeseries(self, start_hr, **kwargs):
return self._get_usage_timeseries_endpoint.call_with_http_info(**kwargs)

def get_usage_top_avg_metrics(self, **kwargs):
"""Get top custom metrics by hourly average # noqa: E501
"""Get all custom metrics by hourly average # noqa: E501

Get top [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed. # noqa: E501
Get all [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

Expand All @@ -2793,6 +2797,7 @@ def get_usage_top_avg_metrics(self, **kwargs):
day (datetime): Datetime in ISO-8601 format, UTC, precise to day: [YYYY-MM-DD] for usage beginning at this hour. (Either month or day should be specified, but not both). [optional]
names ([str]): Comma-separated list of metric names.. [optional]
limit (int): Maximum number of results to return (between 1 and 5000) - defaults to 500 results if limit not specified.. [optional] if omitted the server will use the default value of 500
next_record_id (str): List following results with a next_record_id provided in the previous query.. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
Expand Down
14 changes: 4 additions & 10 deletions src/datadog_api_client/v1/model/usage_attribution_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ def openapi_types():
"""
return {
"limit": (int,), # noqa: E501
"offset": (int,), # noqa: E501
"sort_direction": (str,), # noqa: E501
"sort_name": (str,), # noqa: E501
"next_record_id": (str,), # noqa: E501
"total_number_of_records": (int,), # noqa: E501
}

Expand All @@ -78,9 +76,7 @@ def discriminator():

attribute_map = {
"limit": "limit", # noqa: E501
"offset": "offset", # noqa: E501
"sort_direction": "sort_direction", # noqa: E501
"sort_name": "sort_name", # noqa: E501
"next_record_id": "next_record_id", # noqa: E501
"total_number_of_records": "total_number_of_records", # noqa: E501
}

Expand Down Expand Up @@ -133,10 +129,8 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
limit (int): Maximum amount of records to be returned.. [optional] # noqa: E501
offset (int): Records to be skipped before beginning to return.. [optional] # noqa: E501
sort_direction (str): Direction to sort by.. [optional] # noqa: E501
sort_name (str): Field to sort by.. [optional] # noqa: E501
total_number_of_records (int): Total number of records.. [optional] # noqa: E501
next_record_id (str): The cursor to use to get the next results, if any. To make the next request, use the same parameters with the addition of this next_record_id.. [optional] # noqa: E501
total_number_of_records (int): Total number of records. (deprecated after May 1st, 2021). [optional] # noqa: E501
"""

_check_type = kwargs.pop("_check_type", True)
Expand Down
27 changes: 14 additions & 13 deletions src/datadog_api_client/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10170,24 +10170,18 @@ components:
$ref: '#/components/schemas/UsageAttributionPagination'
type: object
UsageAttributionPagination:
description: The page count for the current pagination.
description: The metadata for the current pagination.
properties:
limit:
description: Maximum amount of records to be returned.
format: int64
type: integer
offset:
description: Records to be skipped before beginning to return.
format: int64
type: integer
sort_direction:
description: Direction to sort by.
type: string
sort_name:
description: Field to sort by.
next_record_id:
description: The cursor to use to get the next results, if any. To make
the next request, use the same parameters with the addition of this next_record_id.
type: string
total_number_of_records:
description: Total number of records.
description: Total number of records. (deprecated after May 1st, 2021)
format: int64
type: integer
type: object
Expand Down Expand Up @@ -21158,7 +21152,7 @@ paths:
type: safe
/api/v1/usage/top_avg_metrics:
get:
description: Get top [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/)
description: Get all [custom metrics](https://docs.datadoghq.com/developers/metrics/custom_metrics/)
by hourly average. Use the month parameter to get a month-to-date data resolution
or use the day parameter to get a daily resolution. One of the two is required,
and only one of the two is allowed.
Expand Down Expand Up @@ -21199,6 +21193,13 @@ paths:
maximum: 5000
minimum: 1
type: integer
- description: List following results with a next_record_id provided in the
previous query.
in: query
name: next_record_id
required: false
schema:
type: string
responses:
'200':
content:
Expand All @@ -21218,7 +21219,7 @@ paths:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden - User is not authorized
summary: Get top custom metrics by hourly average
summary: Get all custom metrics by hourly average
tags:
- Usage Metering
x-menu-order: 5
Expand Down
24 changes: 12 additions & 12 deletions tests/v1/features/usage_metering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ Feature: Usage Metering
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Get all custom metrics by hourly average returns "Bad Request" response
Given new "GetUsageTopAvgMetrics" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip
Scenario: Get all custom metrics by hourly average returns "OK" response
Given new "GetUsageTopAvgMetrics" request
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Get billable usage across your account returns "Bad Request" response
Given new "GetUsageBillableSummary" request
Expand Down Expand Up @@ -361,18 +373,6 @@ Feature: Usage Metering
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Get top custom metrics by hourly average returns "Bad Request" response
Given new "GetUsageTopAvgMetrics" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip
Scenario: Get top custom metrics by hourly average returns "OK" response
Given new "GetUsageTopAvgMetrics" request
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Get usage across your multi-org account returns "Bad Request" response
Given new "GetUsageSummary" request
Expand Down