Repository navigation
example: datadog_api_client.v2 query_timeseries_data does not work #2240
Description
Activity
I faced the similar issue while concating a list and pass it :
metric_query_list = [] for metric_query in metric_queries_list: metric_query_list.append(MetricsTimeseriesQuery( data_source=MetricsDataSource.METRICS, query=metric_query['query'], name=metric_query['name'], )) TimeseriesFormulaQueryRequest( data=TimeseriesFormulaRequest( attributes=TimeseriesFormulaRequestAttributes( formulas=[ QueryFormula( formula=fo_expr, limit=FormulaLimit( count=10, order=QuerySortOrder.DESC, ), ) ], _from=start_time_ms, interval=864000000, queries=TimeseriesFormulaRequestQueries(metric_query_list), # this line can not correct handle to=current_time_ms, ), type=TimeseriesFormulaRequestType.TIMESERIES_REQUEST, ), )If use code above and submitting the query will get empty response.
If I hard code the list will get the correct response(all query conditions are the same):
queries=TimeseriesFormulaRequestQueries( [ MetricsTimeseriesQuery( data_source=MetricsDataSource.METRICS, query="sum:langflow_rag_infer_api_total{http_return_code:200} by {xxx}.as_count().rollup(sum, 60)", name="query3", ), MetricsTimeseriesQuery( data_source=MetricsDataSource.METRICS, query="sum:langflow_rag_infer_api_total{*} by {xxx}.as_count().rollup(sum, 60)", name="query4", ), MetricsTimeseriesQuery( data_source=MetricsDataSource.METRICS, query="sum:langflow_infer_api_total{$xxx, http_return_code:200} by {xxx}.as_count().rollup(sum, 60)", name="query1", ), MetricsTimeseriesQuery( data_source=MetricsDataSource.METRICS, query="sum:xxx{$xxx} by {byoa_app}.as_count().rollup(sum, 60)", name="query2", ), ] ),python client version: 2.30.0
Thanks for your contribution!
This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.
If you would like this issue to remain open:
-
Verify that you can still reproduce the issue in the latest version of this project.
-
Comment that the issue is still reproducible and include updated details requested in the issue template.
-
I'm also affected by this or similar issue. Followed the examples from docs. Code snippet:
body = TimeseriesFormulaQueryRequest( data=TimeseriesFormulaRequest( type=TimeseriesFormulaRequestType.TIMESERIES_REQUEST, attributes=TimeseriesFormulaRequestAttributes( queries=[ MetricsTimeseriesQuery( data_source=MetricsDataSource.METRICS, name="q1", query=query_str, ) ], formulas=[QueryFormula(formula="q1")], from_=t_from_ms, to=t_to_ms, interval=3600 * 1000, # 1h in ms ), ) )error:
Traceback (most recent call last): (...) attributes=TimeseriesFormulaRequestAttributes( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ queries=[ ^^^^^^^^^ ...<9 lines>... interval=3600 * 1000, # 1h in ms ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ), ^ TypeError: TimeseriesFormulaRequestAttributes.__init__() missing 1 required positional argument: '_from'Thanks for your contribution!
This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.
If you would like this issue to remain open:
-
Verify that you can still reproduce the issue in the latest version of this project.
-
Comment that the issue is still reproducible and include updated details requested in the issue template.
-
Describe the bug
A clear and concise description of what the bug is.
when I run test in
https://github.com/DataDog/datadog-api-client-python/blob/master/examples/v2/metrics/QueryTimeseriesData.py
return error: {'errors': ['Invalid query input']}
Label the issue properly.
severity/label.documentationlabel if this issue is related to documentation changes.To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment and Versions (please complete the following information):
A clear and precise description of your setup:
Additional context
Add any other context about the problem here.