CDAP Watchdog provides comprehensive metrics collection, querying, and logging services for the CDAP platform
—
REST-based metrics querying system providing HTTP endpoints for searching tags, querying time series data, and executing batch queries across the CDAP metrics storage system.
Main HTTP service for metrics querying with service discovery registration, providing the foundation for metrics REST API endpoints.
/**
* HTTP service for metrics querying with service discovery registration
* Manages lifecycle of metrics query endpoints and integrates with CDAP service discovery
*/
public class MetricsQueryService extends AbstractIdleService {
/**
* Starts the metrics query HTTP service
* @throws Exception if service startup fails
*/
protected void startUp() throws Exception;
/**
* Stops the metrics query HTTP service
* @throws Exception if service shutdown fails
*/
protected void shutDown() throws Exception;
}REST endpoint handler providing HTTP endpoints for metrics search and query operations.
/**
* REST endpoint handler for metrics operations
* Provides HTTP endpoints for searching tags/metrics and querying metrics data
*/
public class MetricsHandler extends AbstractHttpHandler {
// REST endpoints handled by this class:
// POST /v3/metrics/search - Search for tags or metrics
// POST /v3/metrics/query - Query metrics data (batch and single queries)
// GET /v3/metrics/processor/status - Get metrics processor status
}REST Endpoints:
POST /v3/metrics/search - Search for available tags or metricsPOST /v3/metrics/query - Execute metrics queries (supports both single and batch queries)GET /v3/metrics/processor/status - Get current metrics processor status/**
* Exception thrown when metrics REST API path parsing fails
* Indicates malformed or invalid request paths in metrics endpoints
*/
public class MetricsPathException extends Exception {
/**
* Create exception with error message
* @param message Description of the path parsing error
*/
public MetricsPathException(String message);
/**
* Create exception with error message and cause
* @param message Description of the path parsing error
* @param cause Underlying exception that caused this error
*/
public MetricsPathException(String message, Throwable cause);
}The metrics query API is primarily accessed through HTTP requests to the MetricsQueryService. The service provides REST endpoints for:
POST /v3/metrics/search to discover available tags and metricsPOST /v3/metrics/query to execute time series and aggregate queriesGET /v3/metrics/processor/status to check metrics processing statusExample HTTP Usage:
# Search for available metrics
curl -X POST "http://localhost:11015/v3/metrics/search" \
-H "Content-Type: application/json" \
-d '{"tags": ["namespace", "app"]}'
# Query metrics data
curl -X POST "http://localhost:11015/v3/metrics/query" \
-H "Content-Type: application/json" \
-d '{
"tags": {"namespace": "myNamespace", "app": "myApp"},
"metrics": ["system.cpu.usage"],
"timeRange": {"start": "now-1h", "end": "now"}
}'// Common query constants from internal MetricsQueryHelper
public static final String NAMESPACE_STRING = "namespace";
public static final String APP_STRING = "app";Install with Tessl CLI
npx tessl i tessl/maven-io-cdap-cdap--cdap-watchdog