Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add openmetrics python parser to integration tests #3

Closed
hollodotme opened this issue Nov 19, 2018 · 0 comments
Closed

Add openmetrics python parser to integration tests #3

hollodotme opened this issue Nov 19, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@hollodotme
Copy link
Member

Expected Behavior

All produces metrics must be able to be parsed by the openmetrics python parser.

Actual Behavior

Metrics are only tested via unit tests.

Specifications

  • Package version: v0.2.0
  • PHP version: 7.2

Further comments

The following script is able to parse a file that contains exposed metrics.

Install prometheus_client and forked-path:

pip install prometheus_client forked-path

parseFile.py:

from prometheus_client.openmetrics.parser import text_string_to_metric_families
from path import path

metrics = path('/path/to/metrics.txt').bytes()

for family in text_string_to_metric_families(metrics):
  for sample in family.samples:
    print("Name: {0} Labels: {1} Value: {2} Timestamp: {3}".format(*sample))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant