Jimdo / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
281 stars 213 forks source link

In memory impl #36

Closed krukru closed 7 years ago

krukru commented 7 years ago

This is an implementation for the InMemory storage adapter, it is basically a rework of the APC adapter.

I found it useful for gauges combined with the pushgateway when I don't really need to persist the data.

bracki commented 7 years ago

Nice. I'll give it a try. Seems to pass the tests. I'll get back to it next week.

bracki commented 7 years ago

@krukru Do you mind adding an example to the README?

krukru commented 7 years ago

Agreed. I'll do some cleanup and add instructions to the readme soon

On Mar 15, 2017 10:34 AM, "Bradley Weston" notifications@github.com wrote:

@bweston92 commented on this pull request.

In src/Prometheus/Storage/InMemory.php https://github.com/Jimdo/prometheus_client_php/pull/36#discussion_r106119419 :

  • {
  • $result = [];
  • foreach ($metrics as $metric) {
  • $metaData = $metric['meta'];
  • $data = array(
  • 'name' => $metaData['name'],
  • 'help' => $metaData['help'],
  • 'type' => $metaData['type'],
  • 'labelNames' => $metaData['labelNames'],
  • );
  • foreach ($metric['samples'] as $key => $value) {
  • $parts = explode(':', $key);
  • $labelValues = $parts[2];
  • $data['samples'][] = array(
  • 'name' => $metaData['name'],
  • 'labelNames' => array(),

Line 12 you're constructing arrays differently. Maybe keep some consistency?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Jimdo/prometheus_client_php/pull/36#pullrequestreview-27025694, or mute the thread https://github.com/notifications/unsubscribe-auth/AJmyNn-IwCNlKDdjQbvYFDJ7wPz5Un3-ks5rl7CRgaJpZM4LY-l0 .

krukru commented 7 years ago

Will this be ok?