{"action":"created","issue":{"url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/issues/9","repository_url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter","labels_url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/issues/9/comments","events_url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/issues/9/events","html_url":"https://github.com/jonnenauha/prometheus_varnish_exporter/issues/9","id":191001019,"number":9,"title":"Adding prefix to metrics","user":{"login":"daniyel","id":356247,"avatar_url":"https://avatars.githubusercontent.com/u/356247?v=3","gravatar_id":"","url":"https://api.github.com/users/daniyel","html_url":"https://github.com/daniyel","followers_url":"https://api.github.com/users/daniyel/followers","following_url":"https://api.github.com/users/daniyel/following{/other_user}","gists_url":"https://api.github.com/users/daniyel/gists{/gist_id}","starred_url":"https://api.github.com/users/daniyel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniyel/subscriptions","organizations_url":"https://api.github.com/users/daniyel/orgs","repos_url":"https://api.github.com/users/daniyel/repos","events_url":"https://api.github.com/users/daniyel/events{/privacy}","received_events_url":"https://api.github.com/users/daniyel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-22T13:19:15Z","updated_at":"2016-11-22T15:43:53Z","closed_at":null,"body":"Hi.\r\n\r\nIt would be nice to add custom prefix to metrics. We are running Varnish as a component for microservices and we need to prefix the metrics with the name of microservice, so we can assign the metrics to the dashboard. I do not know if this is already possible with this version of exporter? \r\nOr maybe we could define our own namespace in `prometheus.go`?\r\n\r\nExample:\r\n`prometheus_varnish_exporter -web.prefix=my_service|-web.namespace=my_service:varnish_`\r\n\r\nOutput:\r\n`my_service:varnish_main_busy_sleep 555`\r\n\r\nBest regards.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/issues/comments/262276010","html_url":"https://github.com/jonnenauha/prometheus_varnish_exporter/issues/9#issuecomment-262276010","issue_url":"https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/issues/9","id":262276010,"user":{"login":"jonnenauha","id":157519,"avatar_url":"https://avatars.githubusercontent.com/u/157519?v=3","gravatar_id":"","url":"https://api.github.com/users/jonnenauha","html_url":"https://github.com/jonnenauha","followers_url":"https://api.github.com/users/jonnenauha/followers","following_url":"https://api.github.com/users/jonnenauha/following{/other_user}","gists_url":"https://api.github.com/users/jonnenauha/gists{/gist_id}","starred_url":"https://api.github.com/users/jonnenauha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonnenauha/subscriptions","organizations_url":"https://api.github.com/users/jonnenauha/orgs","repos_url":"https://api.github.com/users/jonnenauha/repos","events_url":"https://api.github.com/users/jonnenauha/events{/privacy}","received_events_url":"https://api.github.com/users/jonnenauha/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T15:43:53Z","updated_at":"2016-11-22T15:43:53Z","body":"Yes, you could attach a unique label of your choosing for each `prom_varnish_exporter` instance when you start it.\r\n\r\nBut I believe this is a solved problem in Prometheus. In your prometheus servers config where you define the `prom_varnish_exporter` instances, you can attach labels to them. I have used this myself as I had two varnish instances and wanted one dashboard for each.\r\n\r\nI assume you are using the new(er) Prometheus that has this new `static_config`  section https://prometheus.io/docs/operating/configuration/#<static_config>\r\n\r\nI believe you can do it with this config [see example](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus.yml)\r\n\r\n```yml\r\nscrape_configs:\r\n\r\n  - job_name: 'prometheus dynamic stuff'\r\n\r\n    static_configs:\r\n      targets: \r\n        - 'first.varnish.exporter.com:9090'\r\n      labels:\r\n        cluster: dynamic_stuff\r\n\r\n  - job_name: 'prometheus static stuff'\r\n\r\n    static_configs:\r\n      targets: \r\n        - 'second.varnish.exporter.com:9090'\r\n      labels:\r\n        cluster: static_stuff\r\n      \r\n```\r\n\r\nI'm not exactly sure if the syntax is correct. The you can see my how to template your dashboard for \"static_stuff\" and \"dynamic_stuff\" with the \"cluster\" label https://github.com/jonnenauha/prometheus_varnish_exporter/issues/2#issuecomment-230533668 \r\n\r\n"}}
{"actor":{"display_login":"jonnenauha"}}