build Service Discovery Json
Builds a Prometheus-compatible service discovery JSON response.
This method generates a JSON array in the format expected by Prometheus HTTP service discovery. Each registered path is represented as a target with associated labels that Prometheus can use for scraping configuration.
The generated JSON includes:
targets: Array containing the proxy endpoint for each path
labels: Metadata about each target including:
__metrics_path__: The path to scrapeagentName: Names of agents serving this pathhostName: Hostnames of agents serving this pathCustom labels from agent path configuration
Example Output
[
{
"targets": ["proxy.example.com:8080"],
"labels": {
"__metrics_path__": "/app1_metrics",
"agentName": "agent-01",
"hostName": "internal.host.com",
"environment": "production",
"service": "web"
}
}
]Content copied to clipboard
Return
JsonArray containing service discovery information for all registered paths