Complete the code to specify the data source type in a Grafana dashboard JSON.
{
"datasources": [
{
"name": "MyDataSource",
"type": "[1]"
}
]
}The correct data source type for monitoring microservices metrics in Grafana is prometheus.
Complete the code to set the panel type to display a time series graph in Grafana.
{
"panels": [
{
"type": "[1]",
"title": "Service Latency"
}
]
}The graph panel type is used to show time series data like latency over time.
Fix the error in the query expression to select the average response time metric.
{
"targets": [
{
"expr": "avg([1])"
}
]
}The Prometheus metric for response time is usually named response_time_seconds in seconds.
Fill both blanks to create a dashboard variable that filters by service name using a regex.
{
"templating": {
"list": [
{
"name": "service",
"query": "label_values([1], service)",
"regex": "/[2]/"
}
]
}
}The variable queries the http_requests_total metric and filters services starting with auth.
Fill all three blanks to define a panel that shows the 95th percentile latency for a service.
{
"panels": [
{
"title": "95th Percentile Latency",
"type": "graph",
"targets": [
{
"expr": "histogram_quantile([1], sum(rate([2][5m])) by (le, [3]))"
}
]
}
]
}The histogram_quantile(0.95, ...) function calculates the 95th percentile latency using the request_latency_seconds_bucket metric grouped by service.