<jupyter_start><jupyter_text>Prometheus workbookIn addition to the Python API, this library also provides several Magics to help integrate with [Jupyter](https://jupyter.org/) workbooks.<jupyter_code>%matplotlib inline
import prometheus_pandas.ipython.magic<jupyter_output><empty_output><jupyter_text>Instant queriesThe `%%prometheus_query` cell Magic allows evaluating instant query at a single point in time. Depending on the query, it may return a vector (`pd.Series`), matrix (`pd.DataFrame`), scalar (`np.float64`) or string (`str`). Usage```%%prometheus_query prometheus_url [-t|--time ] [-T|--timeout ] [output]    instant_query```<jupyter_code>%%prometheus_query http://localhost:9090
    rate(node_cpu_seconds_total{mode="user"}[1m])<jupyter_output><empty_output><jupyter_text>Range queriesThe `%%prometheus_query_range` cell Magic allows evaluating expression query over a range of time. It always returns a matrix (`pd.DataFrame`). Usage```%%prometheus_query_range prometheus_url start end step [-T|--timeout ] [output]    range_query```<jupyter_code>%%prometheus_query_range http://localhost:9090 2021-01-20T00:00:00Z 2021-01-21T00:00:00Z 1h
    rate(node_cpu_seconds_total{mode="user",cpu="0"}[1m])<jupyter_output><empty_output><jupyter_text>If the `output` parameter is provided then the results will be assigned to a variable of that name.<jupyter_code>%%prometheus_query_range http://localhost:9090 2021-01-20T00:00:00Z 2021-01-21T00:00:00Z 1m data
    sum by(mode) (rate(node_cpu_seconds_total{mode=~"user|system"}[1m]))
data.plot()<jupyter_output><empty_output><jupyter_text>The `%%prometheus_query_range_now` function is like `query_range` except that it's relative to the current time. It's useful for building real-time graphs.<jupyter_code>%%prometheus_query_range_now http://localhost:9090 12h 1m data
    sum by(mode) (rate(node_cpu_seconds_total{mode=~"user|system"}[1m]))
data.plot()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1263537906137184, 'fraction_numerical': 0.04332129963898917, 'mean_word_length': 7.940092165898617, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '187414', 'license': 'MIT', 'n_tokens_mistral': 722, 'n_tokens_neox': 642, 'n_words': 146, 'path': 'Prometheus.ipynb', 'repo_name': 'dcoles/prometheus_pd', 'size': '1939'}