Fix Custom Metrics Documentation

The documentation for custom metrics contained an error in the
Prometheus metrics example JSON, and was also somewhat unclear
as to how the labels worked.
This commit is contained in:
Solly Ross 2015-12-09 19:40:23 -05:00
parent d11dd29ecd
commit 89e656d2d8

View File

@ -61,19 +61,18 @@ Another sample config that collects only selected metrics:
{ {
"endpoint" : "http://localhost:8000/metrics", "endpoint" : "http://localhost:8000/metrics",
"metrics_config" : [ "metrics_config" : [
{ "scheduler_binding_latency",
"scheduler_binding_latency", "scheduler_e2e_scheduling_latency",
"scheduler_e2e_scheduling_latency", "scheduling_algorithm_latency"
"scheduling_algorithm_latency"
}
] ]
} }
``` ```
## Passing the configuration to cAdvisor ## Passing the configuration to cAdvisor
cAdvisor can discover any configurations for a container using Docker labels. Any label starting with ```io.cadvisor.metric``` is parsed as a cadvisor application-metric label. cAdvisor can discover any configurations for a container using Docker container labels. Any label starting with ```io.cadvisor.metric``` is parsed as a cadvisor application-metric label.
cAdvisor uses the value as an indicator of where the configuration can be found. cAdvisor uses the value as an indicator of where the configuration can be found. Labels of the form ```io.cadvisor.metric.prometheus-xyz``` indicate that the configuration points to a
Prometheus metrics endpoint.
The configuration file can either be part of the container image or can be added on at runtime with a volume. This makes sure that there is no connection between the host where the container is running and the application metrics configuration. A container is self-contained for its metric information. The configuration file can either be part of the container image or can be added on at runtime with a volume. This makes sure that there is no connection between the host where the container is running and the application metrics configuration. A container is self-contained for its metric information.
@ -88,6 +87,9 @@ Dockerfile (or runtime):
cAdvisor will then reach into the container image at runtime, process the config, and start collecting and exposing application metrics. cAdvisor will then reach into the container image at runtime, process the config, and start collecting and exposing application metrics.
Note that cAdvisor specifically looks at the container labels to extract this information. In Docker 1.8, containers don't inherit labels
from their images, and thus you must specify the label at runtime.
## API access to application-specific metrics ## API access to application-specific metrics
A new endpoint is added for collecting application-specific metrics for a particular container: A new endpoint is added for collecting application-specific metrics for a particular container: