Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

There should be a list with metric names that are requestable on the metric endpoint #1051

Open
tnolet opened this issue Oct 24, 2017 · 2 comments

Comments

@tnolet
Copy link
Contributor

tnolet commented Oct 24, 2017

The docs don't state what metrics are available on the metrics endpoint or directly on elasticsearch.
It's very unclear how to query them either using the REST endpoint /metrics or using direct queries to elasticsearch. Furthermore there seem to be three naming schemes:

  1. haproxy acronyms like "Tt" and "ft", see https://gist.github.com/ayosec/8112308
  2. hyphened full words, "response-time", see https://vamp.io/documentation/api/v0.9.5/api-metrics/
  3. camelCased full words, responseTime in the event tab in the UI.
@olafmol
Copy link
Member

olafmol commented Oct 31, 2017

+1

@tnolet
Copy link
Contributor Author

tnolet commented Nov 8, 2017

The mapping of the haproxy native names to, in this case camelCased names, is done in the metrics workflow. See snippet below. It also shows that per default, only rate and responseTime are inserted into the metrics stream. Our examples talk about a bunch of other metrics, i.e. scur in https://vamp.io/documentation/using-vamp/v0.9.5/events/#example-3

  type: application/javascript
  definition: |
    'use strict';

    let _ = require('highland');
    let vamp = require('vamp-node-client');

    let api = new vamp.Api();
    let logger = new vamp.Log();
    let metrics = new vamp.ElasticsearchMetrics(api);

    let window = 30; // seconds

    function publish(tags, metrics) {
      logger.log('metrics: [' + JSON.stringify(tags) + '] - ' + metrics);
      api.event(tags, metrics, 'metrics');
    }

    api.gateways().each(function (gateway) {

      metrics.average({ft: gateway.lookup_name}, 'Tt', window).each(function (response) {
        publish(['gateways:' + gateway.name, 'gateway', 'metrics:rate'], response.rate);
        publish(['gateways:' + gateway.name, 'gateway', 'metrics:responseTime'], response.average);
      });

      api.namify(gateway.routes).each(function (route) {
        metrics.average({ft: route.lookup_name}, 'Tt', window).each(function (response) {
          publish(['gateways:' + gateway.name, 'routes:' + route.name, 'route', 'metrics:rate'], response.rate);
          publish(['gateways:' + gateway.name, 'routes:' + route.name, 'route', 'metrics:responseTime'], response.average);
        });
      });
    });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants