An open API service indexing awesome lists of open source software.

https://github.com/athenz/athenz-metric-prometheus


https://github.com/athenz/athenz-metric-prometheus

Last synced: 8 months ago
JSON representation

Awesome Lists containing this project

README

          

# Athenz metric for Prometheus
Athenz Yahoo Server metrics interface implementation for Prometheus

- [Usage](#usage)
- [Build](#build)
- [Integrate with Athenz](#integrate-with-athenz)
- [Note](#note)
- [For developer](#for-developer)
- [Test coverage](#test-coverage)
- [Performance test result](#performance-test-result)
- [Design concerns](#design-concerns)
- [example main for integration test](#example-main-for-integration-test)


## Usage


### Build
```bash
mvn clean package
ls ./target/athenz_metrics_prometheus-*.jar
```


### Integrate with Athenz
1. add `athenz_metrics_prometheus-*.jar` in Athenz server's classpath
1. overwrite existing system property
```properties
# ZMS server
athenz.zms.metric_factory_class=com.yahoo.athenz.common.metrics.impl.prometheus.PrometheusMetricFactory

# ZTS server
athenz.zts.metric_factory_class=com.yahoo.athenz.common.metrics.impl.prometheus.PrometheusMetricFactory
```
1. add system property for `PrometheusMetric`
```properties
# enable PrometheusMetric class
athenz.metrics.prometheus.enable=true
# export JVM metrics
athenz.metrics.prometheus.jvm.enable=true
# the Prometheus /metrics endpoint
athenz.metrics.prometheus.http_server.enable=true
athenz.metrics.prometheus.http_server.port=8181
# Prometheus metric prefix
athenz.metrics.prometheus.namespace=athenz_zms
# for dev. env. ONLY, record Athenz domain data as label
athenz.metrics.prometheus.label.request_domain_name.enable=false
athenz.metrics.prometheus.label.principal_domain_name.enable=false
# enable histogram for aggregatable calculation of quantiles
athenz.metrics.prometheus.histogram.enable=true
athenz.metrics.prometheus.histogram.buckets=0.005,0.01,0.025,0.05,0.075,0.1,0.25,0.5,0.75,1.0,2.5,5.0,7.5,10.0
```
1. verify setup: `curl localhost:8181/metrics`
1. add job in your Prometheus server
```yaml
scrape_configs:
- job_name: 'athenz-server'
scrape_interval: 10s
honor_labels: true
static_configs:
- targets: ['athenz.server.domain:8181']
```


## Note

1. The current implementation is based on specific [athenz version](./pom.xml#L31). As the athenz dependency is using the [provided scope](./pom.xml#L51), this class may throw error if non-compatible athenz JARs are included during runtime.


## For developer


### Test coverage
```bash
mvn clover:instrument clover:aggregate clover:clover clover:check
open ./target/site/clover/index.html
```


### Performance test result
- [performance.md](./doc/performance.md)


### Design concerns
- [design-concerns.md](./doc/design-concerns.md)


### example main for integration test
- [example-main.md](./doc/example-main.md)