-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from tinybirdco/add-5m
add 5m metrics
- Loading branch information
Showing
7 changed files
with
155 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ SQL > | |
[ | ||
map( | ||
'name', | ||
'errors_total', | ||
'mcp_errors_total', | ||
'type', | ||
'counter', | ||
'help', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
TOKEN "prometheus" READ | ||
|
||
NODE count_errors_node | ||
SQL > | ||
|
||
SELECT app_name, version, tool, count() errors | ||
FROM mcp_monitoring | ||
where datetime > now() - interval 5 minute | ||
group by app_name, version, tool | ||
|
||
|
||
|
||
NODE count_errors_metrics | ||
SQL > | ||
|
||
SELECT | ||
*, | ||
arrayJoin( | ||
[ | ||
map( | ||
'name', | ||
'mcp_errors_total_5m', | ||
'type', | ||
'counter', | ||
'help', | ||
'total of errors last 5 minutes', | ||
'value', | ||
toString(errors) | ||
) | ||
] | ||
) as metrics_errors | ||
FROM count_errors_node | ||
|
||
|
||
|
||
NODE count_errors_metrics_prom | ||
SQL > | ||
|
||
SELECT | ||
app_name, | ||
metrics_errors['name'] as name, | ||
metrics_errors['type'] as type, | ||
metrics_errors['help'] as help, | ||
toFloat64(metrics_errors['value']) as value, | ||
map('app_name', app_name, 'version', version, 'tool', tool) as labels | ||
FROM count_errors_metrics | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ SQL > | |
[ | ||
map( | ||
'name', | ||
'requests_total', | ||
'mcp_requests_total', | ||
'type', | ||
'counter', | ||
'help', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
TOKEN "prometheus" READ | ||
|
||
NODE count_requests_node | ||
SQL > | ||
|
||
SELECT app_name, version, tool, count() requests | ||
FROM mcp_monitoring | ||
where datetime > now() - interval 5 minute | ||
group by app_name, version, tool | ||
|
||
|
||
|
||
NODE count_requests_metrics | ||
SQL > | ||
|
||
SELECT | ||
*, | ||
arrayJoin( | ||
[ | ||
map( | ||
'name', | ||
'mcp_requests_total_5m', | ||
'type', | ||
'counter', | ||
'help', | ||
'total of requests last 5 minutes', | ||
'value', | ||
toString(requests) | ||
) | ||
] | ||
) as metrics_requests | ||
FROM count_requests_node | ||
|
||
|
||
|
||
NODE count_requests_metrics_prom | ||
SQL > | ||
|
||
SELECT | ||
app_name, | ||
metrics_requests['name'] as name, | ||
metrics_requests['type'] as type, | ||
metrics_requests['help'] as help, | ||
toFloat64(metrics_requests['value']) as value, | ||
map('app_name', app_name, 'version', version, 'tool', tool) as labels | ||
FROM count_requests_metrics | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
TOKEN "prometheus" READ | ||
|
||
NODE count_uniq_total_sessions | ||
SQL > | ||
|
||
SELECT app_name, version, 'all' as tool, uniq(session) total_sessions | ||
FROM mcp_monitoring | ||
where datetime > now() - interval 5 minute | ||
group by app_name, version, tool | ||
|
||
|
||
|
||
NODE count_uniq_total_sessions_metrics | ||
SQL > | ||
|
||
SELECT | ||
*, | ||
arrayJoin( | ||
[ | ||
map( | ||
'name', | ||
'mcp_uniq_total_sessions_5m', | ||
'type', | ||
'gauge', | ||
'help', | ||
'total of uniq sessions last 5 minutes', | ||
'value', | ||
toString(total_sessions) | ||
) | ||
] | ||
) as metrics_uniq_total_sessions | ||
FROM count_uniq_total_sessions | ||
|
||
|
||
|
||
NODE count_uniq_total_sessions_metrics_prom | ||
SQL > | ||
|
||
SELECT | ||
app_name, | ||
metrics_uniq_total_sessions['name'] as name, | ||
metrics_uniq_total_sessions['type'] as type, | ||
metrics_uniq_total_sessions['help'] as help, | ||
toFloat64(metrics_uniq_total_sessions['value']) as value, | ||
map('app_name', app_name, 'version', version, 'tool', tool) as labels | ||
FROM count_uniq_total_sessions_metrics | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters