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

Making endpoint configurable #2

Open
abhay40711cs opened this issue Sep 6, 2017 · 2 comments
Open

Making endpoint configurable #2

abhay40711cs opened this issue Sep 6, 2017 · 2 comments

Comments

@abhay40711cs
Copy link

Currently, the endpoints are by default /metrices ,
if possible can we change the endpoint configurable in order to have the flexibility to use existing default metrics (wrappers for prom-client)

@tobespc
Copy link
Contributor

tobespc commented Sep 6, 2017

@abhay40711cs yes, we can look at adding this

@james-wallis
Copy link
Contributor

@abhay40711cs Hi, I have been looking into adding the configurable endpoint feature into Prometheus.

IMO we should add an option to change the endpoint which by default is /metrics. In this way you would be able to change the endpoint by using the following code when you require appmetrics-prometheus:

var options = {
	endpoint: '/yourMetricEndpoint'
};
require('appmetrics-prometheus').attach(options);

If you do decide to add a custom endpoint you will need to tell Prometheus to scrape the new endpoint instead of /metrics.
This can be achieved by adding metrics_path: '/yourMetricEndpoint' to the prometheus.yml file.

Using our example on the readme, the prometheus.yml file would look like:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.
  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration:
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'YOUR JOB NAME'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    # Override the metrics path to scrape 
    metrics_path: '/yourMetricEndpoint'

    static_configs:
      - targets: ['IPADDRESS:PORT', 'IPADDRESS:PORT']

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