utilities: Various utility functions

format_metrics_instant_dataR Documentation

Various utility functions

Description

Utility functions, usually called within the package and not exported.

Usage

format_metrics_instant_data(x)

format_metrics_range_data(x)

format_metadata(x)

rename_metadata_data_frame(x)

rename_metrics_data_frame(x)

destring(x)

parse_timeout(timeout_val)

response_check(response)

metrics_check(metric)

Arguments

x

A data frame generated by Prometheus query

timeout_val

A timeout value assigned by user.

response

httr response object

metrics

Generated metrics object

Utility function for parsing metrics output

Formats metrics data from the current query

Utility function for parsing range metrics output

Formats metrics data passed by range query.

Utility function for parsing metadata output

Formats data passed by metadata query.

Utility function cleaning column names

As there is no clarity with respect to the returned columns the function:

  • Changes names of known columns like target.instance, target.job

  • Removes special characters from all columns

As there is no clarity with respect to the returned columns the function:

  • Changes names of known columns like name

  • Removes special characters from all columns

Utility function used to destring value column

The value columns should always contain numerical values, the function ensures that those are returned as of numeric type.

Utility function for parsing timeout argument parse_timeout

Fixes potentially problematic timeout argument.

Checking Prometheus Server response

Returns more meaningful error code

Check Metrics Object

Check if metrics objects contains data. If there is no data for time period referenced in the query this function will return an error.


glenn-m/promR documentation built on March 22, 2023, 8:49 p.m.