Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Grafana on top of the database #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ services:
interval: 5s
timeout: 10s
retries: 10

grafana:
image: grafana/grafana:10.0.1
ports:
- "3000:3000"
networks:
- "sample-network"
volumes:
- ./ops/grafana/datasources.yml:/etc/grafana/provisioning/datasources/postgres.yaml
- ./ops/grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/masstransit.yaml
- ./ops/grafana/dashboards:/dashboards
- ./ops/grafana/grafana.ini:/etc/grafana/grafana.ini
networks:
sample-network:
driver: bridge
22 changes: 22 additions & 0 deletions ops/grafana/dashboards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: 1

providers:
# <string> an unique provider name
- name: "MassTransit"
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string, required> name of the dashboard folder. Required
folder: ""
# <string, required> provider type. Required
type: file
# <bool> disable dashboard deletion
disableDeletion: true
# <bool> enable dashboard editing
# editable: true
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
# allowUiUpdates: false
options:
# <string, required> path to dashboard files on disk. Required
path: /dashboards
137 changes: 137 additions & 0 deletions ops/grafana/dashboards/mt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 1,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "postgres",
"uid": "PA942B37CCFAF5A81"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "10.0.1",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "PA942B37CCFAF5A81"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT * FROM transport.queue_message_counts;",
"refId": "A",
"sql": {
"columns": [
{
"name": "COUNT",
"parameters": [
{
"name": "\"MigrationId\"",
"type": "functionParameter"
}
],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "ef_migration_history"
}
],
"title": "Panel Title",
"type": "table"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "MassTransit DB Transport",
"uid": "ec546f8f-b8d3-454c-8013-c36402d8bb75",
"version": 1,
"weekStart": ""
}
22 changes: 22 additions & 0 deletions ops/grafana/datasources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# config file version
apiVersion: 1

# list of data sources that should be deleted from the database
deleteDatasources:
- name: postgres
orgId: 1

# list of data sources to insert/update depending
# what's available in the database
datasources:
- name: postgres
type: postgres
url: postgres:5432
user: postgres
secureJsonData:
password: 'Password12!'
isDefault: true
jsonData:
database: sample
sslmode: 'disable'
postgresVersion: 1000
Loading