Skip to content

Domain name parse error: unexpected identifier #256

Description

@rmalenko

I have got this error
full domain name au.edu in error message \\"au\\" i.e .edu is disappeared

File "./prometheus_query.py", line 35, in <module>
    metric_data = prom.custom_query(
  File "/usr/local/lib/python3.8/dist-packages/prometheus_api_client/prometheus_connect.py", line 355, in custom_query
    raise PrometheusApiClientException(
prometheus_api_client.exceptions.PrometheusApiClientException: HTTP Status Code 400 (b'{"status":"error","errorType":"bad_data","error":"invalid parameter \\"query\\": 1:70: parse error: unexpected identifier \\"aubg\\" in label matching, expected string"}')

my code is:

domain = "au.edu"

metric_data = prom.custom_query(
    query="avg_over_time(host_tracker_uptime_percent{job='donodeexporter', zone="f'{domain}'"}[30d])"
)
metric_df = MetricSnapshotDataFrame(metric_data)
print(metric_df.head())

If I provide domain name this code works

metric_data = prom.custom_query(
    query="avg_over_time(host_tracker_uptime_percent{job='donodeexporter', zone='au.edu'}[30d])"
)
metric_df = MetricSnapshotDataFrame(metric_data)
print(metric_df.head())
    instance             job                   zone     timestamp                                        value
0  prom.k.com  donodeexporter  au.edu 2022-11-03 11:44:08.178999808  99.921485

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions