Conversation
This adds a new wp_info metric that returns WordPress code and database versions. Versions are in the "version" and "db_version" labels. Issue: CodeAtCode#15
|
I opened this PR as draft because I fail to make it working, all seems good to me but the new metrics is not printed/returned. All others metrics are returned just fine and there is no error in the logs. I am not really sure how to tell the plugin it should load/enable this metric, I thought adding it to Also, I want to provide a JSON for updating the Grafana Dashboard (but I'd rather wait we agree on the metric first). |
|
In the end, it finally works fine (I obviously had some caching issue). Here is the JSON for a table Grafana panel to use in the Dashboard: {
"id": 36,
"type": "table",
"title": "Versions",
"targets": [
{
"refId": "A",
"editorMode": "code",
"expr": "topk(1, wp_info{host=\"$host\"})",
"legendFormat": "__auto",
"range": false,
"instant": true,
"exemplar": false,
"format": "table"
}
],
"options": {
"showHeader": true,
"footer": {
"show": false,
"reducer": [
"sum"
],
"fields": ""
}
},
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto",
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": []
},
"color": {
"mode": "thresholds"
}
},
"overrides": []
},
"pluginVersion": "9.3.1",
"transformations": [
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"job": true,
"instance": true,
"host": true,
"__name__": true,
"scheme": true,
"Value": true
},
"indexByName": {
"version": 0,
"db_version": 1,
"Time": 2,
"__name__": 3,
"host": 4,
"instance": 5,
"job": 6,
"scheme": 7,
"Value": 8
},
"renameByName": {
"__name__": "",
"db_version": "Database Version ",
"version": "WordPress Version "
}
}
}
]
}It adds "Versions" table panel looking as follows: The PromQL is |
|
I wonder if I should also return the exporter plugin's version? |
|
I think that is perfect as it is. |

Here is an implementation for new
wp_infometric to export WordPress code and database versions as talked in #15.