Send serve_http spans to Prometheus as well. Revamp Grafana dashboard.

This commit is contained in:
Nigel Deakin
2017-10-25 12:58:08 +01:00
parent e72cd55a4a
commit 0ddb750eaa
4 changed files with 101 additions and 408 deletions

View File

@@ -110,6 +110,7 @@ func traceWrap(c *gin.Context) {
// If wireContext == nil, a root span will be created. // If wireContext == nil, a root span will be created.
// TODO we should add more tags? // TODO we should add more tags?
serverSpan := opentracing.StartSpan("serve_http", ext.RPCServerOption(wireContext), opentracing.Tag{Key: "path", Value: c.Request.URL.Path}) serverSpan := opentracing.StartSpan("serve_http", ext.RPCServerOption(wireContext), opentracing.Tag{Key: "path", Value: c.Request.URL.Path})
serverSpan.SetBaggageItem("fn_appname", c.Param(api.CApp))
defer serverSpan.Finish() defer serverSpan.Finish()
ctx := opentracing.ContextWithSpan(c.Request.Context(), serverSpan) ctx := opentracing.ContextWithSpan(c.Request.Context(), serverSpan)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 KiB

After

Width:  |  Height:  |  Size: 1007 KiB

View File

@@ -105,6 +105,7 @@ two main attributes: a name that describes the operation being performed (for ex
If the span is associated with a specific function invocation, the corresponding metric is given the labels `fn_app` and `fn_path` which are set to the application name and function path respectively. If the span is associated with a specific function invocation, the corresponding metric is given the labels `fn_app` and `fn_path` which are set to the application name and function path respectively.
A second example dashboard `fn_grafana_dashboard2.json` in this example's directory shows rate and duration data for some significant operations. A second example dashboard `fn_grafana_dashboard2.json` in this example's directory shows rate and duration data for some significant operations.
You can use the pulldown lists at the top of the dashboard to choose which tracing spans to examine.
<img src="../../docs/assets/GrafanaDashboard2.png" width="100%"> <img src="../../docs/assets/GrafanaDashboard2.png" width="100%">

View File

@@ -1,4 +1,34 @@
{ {
"__inputs": [
{
"name": "DS_PROMDS",
"label": "PromDS",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.6.0-beta3"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
}
],
"annotations": { "annotations": {
"list": [ "list": [
{ {
@@ -16,29 +46,32 @@
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"hideControls": false, "hideControls": false,
"id": 1, "id": null,
"links": [], "links": [],
"refresh": "30s", "refresh": "30s",
"rows": [ "rows": [
{ {
"collapse": false, "collapse": false,
"height": 267, "height": 297,
"panels": [ "panels": [
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "PromDS", "datasource": "${DS_PROMDS}",
"description": "", "description": "",
"fill": 1, "fill": 1,
"id": 20, "id": 44,
"legend": { "legend": {
"alignAsTable": true, "alignAsTable": true,
"avg": false, "avg": false,
"current": true, "current": true,
"hideEmpty": false,
"hideZero": false,
"max": false, "max": false,
"min": false, "min": false,
"rightSide": false,
"show": true, "show": true,
"total": false, "total": false,
"values": true "values": true
@@ -46,30 +79,34 @@
"lines": true, "lines": true,
"linewidth": 1, "linewidth": 1,
"links": [], "links": [],
"minSpan": 3,
"nullPointMode": "null", "nullPointMode": "null",
"percentage": false, "percentage": false,
"pointradius": 5, "pointradius": 5,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"repeat": "span_rate_name",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 3, "span": 6,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "rate(fn_span_agent_submit_duration_seconds_count[1m])", "expr": "rate(fn_span_[[span_rate_name]]_duration_seconds_count[1m])",
"format": "time_series", "format": "time_series",
"hide": false,
"instant": false,
"intervalFactor": 2, "intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})", "legendFormat": "{{fn_path}} ({{fn_appname}})",
"refId": "A", "refId": "A",
"step": 2 "step": 1
} }
], ],
"thresholds": [], "thresholds": [],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "agent_submit rate (1 min rolling avg)", "title": "[[span_rate_name]] rate (1 min rolling avg)",
"tooltip": { "tooltip": {
"shared": true, "shared": true,
"sort": 0, "sort": 0,
@@ -101,266 +138,33 @@
"show": true "show": true
} }
] ]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "PromDS",
"fill": 1,
"id": 17,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": false,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 3,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(fn_span_agent_submit_duration_seconds_sum[1m]) / rate(fn_span_agent_submit_duration_seconds_count[1m])\n\n\n\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})",
"refId": "A",
"step": 2
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "agent submit duration (1min rolling avg)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": "Seconds",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "PromDS",
"fill": 1,
"id": 21,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": false,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 3,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(fn_span_agent_get_slot_duration_seconds_sum[1m]) / rate(fn_span_agent_get_slot_duration_seconds_count[1m])\n\n\n\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})",
"refId": "A",
"step": 2
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "agent_get_slot duration (1min rolling avg)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": "Seconds",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "PromDS",
"fill": 1,
"id": 42,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 3,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(fn_span_agent_cold_exec_duration_seconds_sum[1m]) / rate(fn_span_agent_cold_exec_duration_seconds_count[1m])\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})",
"refId": "A",
"step": 2
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "agent_cold_exec duration (1min rolling avg)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": "Seconds",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
} }
], ],
"repeat": null, "repeat": null,
"repeatIteration": null, "repeatIteration": null,
"repeatRowId": null, "repeatRowId": null,
"showTitle": false, "showTitle": false,
"title": "Agent", "title": "Dashboard Row",
"titleSize": "h6" "titleSize": "h6"
}, },
{ {
"collapse": false, "collapse": false,
"height": 228, "height": 250,
"panels": [ "panels": [
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
"dashLength": 10, "dashLength": 10,
"dashes": false, "dashes": false,
"datasource": "PromDS", "datasource": "${DS_PROMDS}",
"fill": 1, "fill": 1,
"id": 43, "id": 45,
"legend": { "legend": {
"alignAsTable": true, "alignAsTable": true,
"avg": false, "avg": false,
"current": true, "current": true,
"max": false, "max": false,
"min": false, "min": false,
"rightSide": false,
"show": true, "show": true,
"total": false, "total": false,
"values": true "values": true
@@ -368,19 +172,21 @@
"lines": true, "lines": true,
"linewidth": 1, "linewidth": 1,
"links": [], "links": [],
"minSpan": 3,
"nullPointMode": "null", "nullPointMode": "null",
"percentage": false, "percentage": false,
"pointradius": 5, "pointradius": 5,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
"repeat": "span_duration_name",
"seriesOverrides": [], "seriesOverrides": [],
"spaceLength": 10, "spaceLength": 10,
"span": 4, "span": 3,
"stack": false, "stack": false,
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "rate(fn_span_docker_create_container_duration_seconds_sum[1m]) / rate(fn_span_docker_create_container_duration_seconds_count[1m])\n", "expr": "rate(fn_span_[[span_duration_name]]_duration_seconds_sum[1m]) / rate(fn_span_[[span_duration_name]]_duration_seconds_count[1m])\n\n\n\n",
"format": "time_series", "format": "time_series",
"intervalFactor": 2, "intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})", "legendFormat": "{{fn_path}} ({{fn_appname}})",
@@ -391,163 +197,7 @@
"thresholds": [], "thresholds": [],
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "docker_create_container duration (1min rolling average)", "title": "[[span_duration_name]] duration (1min rolling avg)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": "Seconds",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "PromDS",
"fill": 1,
"id": 33,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(fn_span_docker_start_container_duration_seconds_sum[1m]) / rate(fn_span_docker_start_container_duration_seconds_count[1m])\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})",
"refId": "A",
"step": 1
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "docker_start_container duration (1min rolling average)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": "Seconds",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "PromDS",
"fill": 1,
"id": 35,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(fn_span_docker_wait_container_duration_seconds_sum[1m]) / rate(fn_span_docker_start_container_duration_seconds_count[1m])\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{fn_path}} ({{fn_appname}})",
"refId": "A",
"step": 1
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "docker_wait_container duration (1min rolling average)",
"tooltip": { "tooltip": {
"shared": true, "shared": true,
"sort": 0, "sort": 0,
@@ -585,7 +235,7 @@
"repeatIteration": null, "repeatIteration": null,
"repeatRowId": null, "repeatRowId": null,
"showTitle": false, "showTitle": false,
"title": "Docker", "title": "Dashboard Row",
"titleSize": "h6" "titleSize": "h6"
} }
], ],
@@ -593,7 +243,48 @@
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
"list": [] "list": [
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMDS}",
"hide": 0,
"includeAll": false,
"label": "Choose spans to display rates",
"multi": true,
"name": "span_rate_name",
"options": [],
"query": "metrics(fn_span.*)",
"refresh": 2,
"regex": "fn_span_(.*)_duration_seconds_count",
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMDS}",
"hide": 0,
"includeAll": false,
"label": "Choose spans to display durations",
"multi": true,
"name": "span_duration_name",
"options": [],
"query": "metrics(fn_span.*)",
"refresh": 2,
"regex": "fn_span_(.*)_duration_seconds_count",
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
}, },
"time": { "time": {
"from": "now-5m", "from": "now-5m",
@@ -625,6 +316,6 @@
] ]
}, },
"timezone": "", "timezone": "",
"title": "Fn tracing span data", "title": "Fn tracing spans",
"version": 8 "version": 23
} }