prometheus-api-client-python icon indicating copy to clipboard operation
prometheus-api-client-python copied to clipboard

Documentation Broken: `get_metric_aggregation` and `MetricRangeDataFrame`

Open miah0x41 opened this issue 1 year ago • 1 comments

The formatting of the documentation for the function get_metric_aggregation appears to be broken as ilustrated below:

image

The description for the parameter query contains a link, which I suspect is causing the issue but I am unable to build the documentation to verify myself.

I think these are the responsible lines: https://github.com/4n4nd/prometheus-api-client-python/blob/49362b07cb3bec835a8211d81becd5ed205ace18/prometheus_api_client/prometheus_connect.py#L466C1-L467C77

    :param query: (str) This is a PromQL query, a few examples can be found
          at https://prometheus.io/docs/prometheus/latest/querying/examples/

The link formatting for rst should be I believe:

    :param query: (str) This is a PromQL query, a few examples can be found
          at `https://prometheus.io/docs/prometheus/latest/querying/examples/ <https://prometheus.io/docs/prometheus/latest/querying/examples/>`_

Please note the use of single ` to surround the link text and link itself. Also the addition of <> to surround the link itself and followed by a trailing _.

I would be happy to make the necessary amendments but would need some guidance on how to build the docs.

miah0x41 avatar Dec 30 '23 13:12 miah0x41

Updated title to reflect another bug:

image

Link to documentation: here.

The key snippet of code is:

metric_data = prom.get_current_metric_value(metric_name='up', label_config=my_label_config)
metric_df = MetricRangeDataFrame(metric_data)

However MetricRangeDataFrame only works on ranges and therefore prom.get_current_metric_value is the wrong function, should be I think: get_metric_range_data (well possibly).

miah0x41 avatar Dec 30 '23 22:12 miah0x41