Skip to content

Commit

Permalink
limit to scalar result type from custom query
Browse files Browse the repository at this point in the history
Pushing further limits to customer that is engineering the query anyhow.
Result type of any query must be reduced to a scalar.

Looks to be best approach for now as enforcing any start or endtime
deltas seems too confining for consumers.

Also parsing arbitratry query results appears intractable currently
and lacks any justifiable accuracy.
  • Loading branch information
cherusk committed Dec 26, 2023
1 parent a0b370c commit 06e57d4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions breeder/linux_network_stack/effectuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,20 @@ def run_reconnaissance():
query_name = objective.get('name')

query_result = prom_conn.custom_query(recon_query)
metric_value = query_result[0]
metric_data[query_name] = metric_value.get('value')[1]

if query_result.get('resultType') != 'scalar':
raise Exception("Custom Query must be of result type scalar.")

# Example format of result processed
# "data": {
# "resultType": "scalar",
# "result": [
# 1703619892.31, << TS
# "0.401370548" << Value
# ]
# }

metric_data[query_name] = metric_value.get('result')[1]
else:
raise Exception("Reconnaisance service type {recon_service_type} not supported yet.")

Expand Down

0 comments on commit 06e57d4

Please sign in to comment.