➜ runwhen docker exec mycodecollection bash -c "ro /app/codecollection/codebundles/rds-mysql-conn-count/sli.robot && ls -R /robot_logs"
[ ERROR ] Error in library 'RW.Core': Adding keyword 'add_datagrid_to_report' failed: Union cannot be empty.
[ ERROR ] Error in library 'RW.Core': Adding keyword 'add_table_to_report' failed: Union cannot be empty.
==============================================================================
Sli :: Run a PromQL query against Prometheus instant query API, perform a p...
==============================================================================
Querying Prometheus Instance And Pushing Aggregated Data | FAIL |
ValueError: Response received is malformed {'status': 'error', 'errorType': 'bad_data', 'error': 'invalid parameter "query": 1:69: parse error: unexpected identifier "robotshopmysql" in label matching, expected string'} against url http://ab916f39fadce498ead455d91e808053-1900228415.us-west-2.elb.amazonaws.com/prometheus/api/v1/query and params {'query': 'aws_rds_database_connections_average{dimension_DBInstanceIdentifier=robotshopmysql} > 1', 'time': '2024-01-16T13:14:05.027310Z', 'step': '30'}
------------------------------------------------------------------------------
Sli :: Run a PromQL query against Prometheus instant query API, pe... | FAIL |
1 task, 0 passed, 1 failed
==============================================================================
Output: /robot_logs/rds-mysql-conn-count/sli-output.xml
Log: /robot_logs/rds-mysql-conn-count/sli-log.html
Report: /robot_logs/rds-mysql-conn-count/sli-report.html
Manual curl Works:
By doing manual curl we do get results from the promethues the difference is that we manually encoded url and prarams:
➜ runwhen docker exec rds-codecollection bash -c 'curl -X GET -H "Content-Type: application/json" "http://ab916f39fadce498ead455d91e808053-1900228415.us-west-2.elb.amazonaws.com/prometheus/api/v1/query?query=aws_rds_database_connections_average%7Bdimension_DBInstanceIdentifier%3D%22robotshopmysql%22%7D%20%3E%201&time=1705390117&step=30"'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 492 100 492 0 0 78 0 0:00:06 0:00:06 --:--:-- 101
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"aws_rds_database_connections_average","account_id":"590183940259","container":"yet-another-cloudwatch-exporter","dimension_DBInstanceIdentifier":"robotshopmysql","endpoint":"http","instance":"192.168.115.6:5000","job":"yace","name":"arn:aws:rds:us-west-2:590183940259:db:robotshopmysql","namespace":"monitoring","pod":"yace-8b8bd5598-k2wxt","region":"us-west-2","service":"yace"},"value":[1705390117,"30"]}]}}%
Traceback (most recent call last):
File "/app/codecollection/libraries/RW/Prometheus/Prometheus.py", line 127, in query_instant
return self._query(api_url, target_service=target_service, optional_headers=optional_headers, params=params)
File "/app/codecollection/libraries/RW/Prometheus/Prometheus.py", line 25, in _query
rsp = self._query_with_service(
File "/app/codecollection/libraries/RW/Prometheus/Prometheus.py", line 83, in _query_with_service
optional_headers = self._secret_to_curl_headers(optional_headers=optional_headers)
File "/app/codecollection/libraries/RW/Prometheus/Prometheus.py", line 54, in _secret_to_curl_headers
headers.update(json.loads(optional_headers.value))
AttributeError: 'NoneType' object has no attribute 'value'
Steps to reproduce:
Build Image
docker build --tag runwhen . --no-cache
Run container with env vars
ENV_PROMETHEUS_HOST
andENV_QUERY
through these variables we are passing values to sli.robot: https://github.com/infracloudio/ifc-rw-codecollection/blob/eb973e6072320d1743460928a8b517ece2fe331b/codebundles/rds-mysql-conn-count/sli.robot#L9C1-L11C31RUN SLI:
docker exec rds-codecollection bash -c "ro /app/codecollection/codebundles/rds-mysql-conn-count/sli.robot && ls -R /robot_logs"
Manual curl Works:
By doing manual curl we do get results from the promethues the difference is that we manually encoded url and prarams:
Code Changes We made:
optional_headers
related part from it Because withoptional_headers
we get this error: