Giter VIP home page Giter VIP logo

exposition-text's People

Contributors

hollodotme avatar marclaporte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

exposition-text's Issues

Back port to PHP >= 7.1

Expected Behavior

The library also installs/works on PHP 7.1.

Actual Behavior

The library only installs/works on PHP >= 7.2

Specifications

  • Package version: v0.1.0

Further comments

Back porting to PHP 7.1 was originally requested via Twitter

/cc @s7anley

_total suffix for counters does not work for HELP and TYPE

Description

Counters add automatically _total suffix to metric itself, but it does not work for TYPE and HELP, so in fact you get descrepancy between metric definition and actual name. I think this commit must be reverted, people should be able to manage metric names without any magic in code: 78bc5df

Expected Behavior

# TYPE your_metric_name_total counter
# HELP your_metric_name_total A helpful description of your measurement.
your_metric_name_total 1.000000

Actual Behavior

As described in README (and really works this way):

# TYPE your_metric_name counter
# HELP your_metric_name A helpful description of your measurement.
your_metric_name_total 1.000000

Steps to Reproduce the Problem

Any of examples here: https://github.com/openmetrics-php/exposition-text/blob/master/examples/counters.php

Add openmetrics python parser to integration tests

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))

Remove dependency on psr/http-message

I don't think this package should rely on psr/http-message.
It should be the client responsibility to expose the metrics.
At most some recommendations/examples can be provided.

Most likely many of the clients already use a framework that uses the psr7, meaning they should just hook it up themselves - also this can bring in conflicts for frameworks using psr/http-message: ^2.0 dependency.

Or as in my case, I have to bring in an unwanted dependency because I just want to dump the metrics directly to a file.

What do you think?

8.1 Deprecation notice(s)

Expected Behavior

Should work on PHP 8.1+ :-)

Actual Behavior

Deprecated: Return type of OpenMetricsPhp\Exposition\Text\Collections\LabelCollection::getIterator(): iterable should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/openmetrics-php/exposition-text/src/Collections/LabelCollection.php on line 65

There are probably some more.

Steps to Reproduce the Problem

  1. Use lib with PHP 8.1
  2. do something with labels
  3. recognize deprecation warning

Specifications

  • Package version: 0.3.1
  • PHP version: 8.1.
  • Platform/OS: Docker
  • Subsystem: php:8.1-apache

Further comments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.