Skip to content

Commit

Permalink
feat(flask) Added flask pack
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHammarstrand committed Oct 25, 2021
1 parent 5607281 commit 7588dbd
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 46 deletions.
29 changes: 29 additions & 0 deletions quickstarts/python/flask/alerts/HighMemoryUsage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Memory Usage

details: |+
This alert is triggered when Memory usage is above 90%
type: STATIC
nrql:
query: 'SELECT average(memoryUsedBytes/memoryTotalBytes) * 100 FROM SystemSample'

# Function used to aggregate the NRQL query value(s) for comparison to the terms.threshold (Default: SINGLE_VALUE)
valueFunction: SINGLE_VALUE

# List of Critical and Warning thresholds for the condition
terms:
- priority: CRITICAL
# Operator used to compare against the threshold.
operator: ABOVE
# Value that triggers a violation
threshold: 90
# Time in seconds; 120 - 3600
thresholdDuration: 300
# How many data points must be in violation for the duration
thresholdOccurrences: ALL

# Duration after which a violation automatically closes
# Time in seconds; 300 - 2592000 (Default: 86400 [1 day])
violationTimeLimitSeconds: 86400
---

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ details: |+
This alert is triggered when the Apdex score is below 0.5 for 5 minutes
type: STATIC
nrql:
query: "SELECT apdex(apm.service.apdex) as 'Apdex' FROM Metric WHERE appName like '%'"
query: "SELECT apdex(duration, t: 0.5) FROM Transaction WHERE appName like '%'"

# Function used to aggregate the NRQL query value(s) for comparison to the terms.threshold (Default: SINGLE_VALUE)
valueFunction: SINGLE_VALUE
Expand All @@ -26,3 +26,4 @@ terms:
# Time in seconds; 300 - 2592000 (Default: 86400 [1 day])
violationTimeLimitSeconds: 86400
---

1 change: 1 addition & 0 deletions quickstarts/python/flask/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ logo: logo.svg
level: New Relic
authors:
- New Relic
- Emil Hammarstrand
title: flask
documentation:
- name: flask installation docs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
{
"name": "Python",
"description": "Python",
"name": "Flask",
"description": null,
"permissions": "PUBLIC_READ_WRITE",
"pages": [
{
"name": "Python App Overview",
"description": "Python App Overview",
"name": "Flask Overview",
"description": null,
"widgets": [
{
"visualization": {
"id": "viz.markdown"
},
"layout": {
"column": 1,
"row": 1,
"height": 1,
"width": 12
},
"title": "",
"rawConfiguration": {
"text": "## More details available on Application Monitoring (APM) page.\n\nDive deeper on transaction details, distributed tracing, related entities, anomalies, errors and more. [Open the Explorer.](https://onenr.io/0rVRVGaNWja)"
},
"linkedEntityGuids": null
},
{
"visualization": {
"id": "viz.markdown"
},
"layout": {
"column": 1,
"row": 2,
"row": 1,
"height": 3,
"width": 5
},
"title": "",
"rawConfiguration": {
"text": "\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/python/python/images/Transactions.png)\n"
"text": "\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/python/flask/images/Transactions.png)\n"
},
"linkedEntityGuids": null
},
Expand All @@ -44,7 +29,7 @@
},
"layout": {
"column": 6,
"row": 2,
"row": 1,
"height": 3,
"width": 7
},
Expand All @@ -54,7 +39,7 @@
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Avg duration (s)', percentile(duration, 90) as 'Slowest 10% (s)', percentage(count(*), WHERE error is false) AS 'Success rate' SINCE 1 WEEK AGO"
"query": "FROM Transaction SELECT count(*) as 'Total Transactions', average(duration) as 'Average/duration in sec', percentile(duration, 90) as 'Slowest 10%/duration', percentage(count(*), WHERE error is false) AS 'Success Rate' SINCE 1 week ago"
}
],
"thresholds": []
Expand All @@ -67,13 +52,13 @@
},
"layout": {
"column": 1,
"row": 5,
"row": 4,
"height": 3,
"width": 5
},
"title": "",
"rawConfiguration": {
"text": "![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/python/python/images/Errors.png)\n"
"text": "\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/python/flask/images/Errors.png)\n"
},
"linkedEntityGuids": null
},
Expand All @@ -83,7 +68,7 @@
},
"layout": {
"column": 6,
"row": 5,
"row": 4,
"height": 3,
"width": 7
},
Expand All @@ -93,7 +78,7 @@
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions (%)', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago"
"query": "FROM Transaction SELECT count(*) as 'Total Transactions',percentage(count(*), WHERE error IS true) as 'Failed Transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed Transactions' SINCE 1 week ago"
}
],
"thresholds": []
Expand All @@ -106,13 +91,13 @@
},
"layout": {
"column": 1,
"row": 8,
"row": 7,
"height": 3,
"width": 5
},
"title": "",
"rawConfiguration": {
"text": "![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/python/python/images/VM-metrics.png)\n"
"text": "\n![VM metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/python/flask/images/VM-metrics.png)\n"
},
"linkedEntityGuids": null
},
Expand All @@ -122,7 +107,7 @@
},
"layout": {
"column": 6,
"row": 8,
"row": 7,
"height": 3,
"width": 7
},
Expand All @@ -132,7 +117,7 @@
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization (%)', average(apm.service.memory.physical) as 'Average memory used (MB)' WHERE appName like '%' SINCE 1 week AGO"
"query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU Utilization ', average(apm.service.memory.physical) as 'Average Physical Memory' WHERE appName like '%' SINCE 1 WEEK AGO"
}
],
"thresholds": []
Expand All @@ -143,7 +128,7 @@
},
{
"name": "Errors",
"description": "Errors",
"description": null,
"widgets": [
{
"visualization": {
Expand All @@ -155,13 +140,13 @@
"height": 3,
"width": 8
},
"title": "Errors Overview",
"title": "Error Overview",
"rawConfiguration": {
"dataFormatters": [],
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions (%)', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago"
"query": "FROM Transaction SELECT count(*) as 'Total Transactions', percentage(count(*), WHERE error IS true) as 'Failed Transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed Transactions' SINCE 1 week ago"
}
],
"thresholds": []
Expand Down Expand Up @@ -191,7 +176,7 @@
}
]
},
"linkedEntityGuids": ["MjU5NDA4MnxWSVp8REFTSEJPQVJEfDIzODg4NjY"]
"linkedEntityGuids": ["MjU5NDA4MnxWSVp8REFTSEJPQVJEfDI2NjE5MTE"]
},
{
"visualization": {
Expand All @@ -201,7 +186,7 @@
"column": 1,
"row": 4,
"height": 3,
"width": 6
"width": 4
},
"title": "Transactions Errors Today Compared With 1 Week Ago",
"rawConfiguration": {
Expand All @@ -225,10 +210,10 @@
"id": "viz.billboard"
},
"layout": {
"column": 7,
"column": 5,
"row": 4,
"height": 3,
"width": 6
"width": 4
},
"title": "Latest Error",
"rawConfiguration": {
Expand All @@ -242,12 +227,36 @@
"thresholds": []
},
"linkedEntityGuids": null
},
{
"visualization": {
"id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.range-chart"
},
"layout": {
"column": 9,
"row": 4,
"height": 3,
"width": 4
},
"title": "Transaction Errors Day By Day",
"rawConfiguration": {
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM TransactionError SELECT count(*), percentage(count(*), WHERE error IS true) FACET dateOf(timestamp) SINCE 1 week ago"
}
],
"other": {
"visible": false
}
},
"linkedEntityGuids": null
}
]
},
{
"name": "VM Metrics",
"description": "VM Metrics",
"description": null,
"widgets": [
{
"visualization": {
Expand All @@ -265,7 +274,7 @@
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization (%)', average(apm.service.memory.physical) as 'Average memory used (MB)' WHERE appName like '%' SINCE 1 week AGO"
"query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU Utilization ', average(apm.service.memory.physical) as 'Average Physical Memory' WHERE appName like '%' SINCE 1 WEEK AGO"
}
],
"thresholds": []
Expand All @@ -290,7 +299,7 @@
"nrqlQueries": [
{
"accountId": 0,
"query": "SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName like '%' SINCE 30 minutes AGO TIMESERIES"
"query": "SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName like '%' SINCE 30 minutes ago TIMESERIES"
}
]
},
Expand Down Expand Up @@ -351,7 +360,7 @@
},
{
"name": "Transactions",
"description": "Transactions",
"description": null,
"widgets": [
{
"visualization": {
Expand All @@ -369,7 +378,7 @@
"nrqlQueries": [
{
"accountId": 0,
"query": "FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Avg duration (s)', percentile(duration, 90) as 'Slowest 10% (s)', percentage(count(*), WHERE error is false) AS 'Success rate' SINCE 1 WEEK AGO"
"query": "FROM Transaction SELECT count(*), average(duration) as 'Average/duration in sec', percentile(duration, 90) as 'Slowest 10%/duration', percentage(count(*), WHERE error is false) AS 'Success Rate' SINCE 1 WEEK AGO"
}
],
"thresholds": []
Expand Down Expand Up @@ -504,7 +513,7 @@
"visible": false
},
"yAxis": {
"label": "MS"
"label": "Seconds"
}
},
"linkedEntityGuids": null
Expand Down Expand Up @@ -532,6 +541,31 @@
}
},
"linkedEntityGuids": null
},
{
"visualization": {
"id": "viz.table"
},
"layout": {
"column": 1,
"row": 11,
"height": 3,
"width": 4
},
"title": "Transaction Duration Overview",
"rawConfiguration": {
"dataFormatters": [],
"facet": {
"showOtherSeries": false
},
"nrqlQueries": [
{
"accountId": 0,
"query": "SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName LIKE '%' FACET name"
}
]
},
"linkedEntityGuids": null
}
]
}
Expand Down
Binary file added quickstarts/python/flask/dashboards/flask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quickstarts/python/flask/dashboards/flask2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quickstarts/python/flask/dashboards/flask3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed quickstarts/python/flask/dashboards/python.png
Binary file not shown.
Binary file removed quickstarts/python/flask/dashboards/python02.png
Binary file not shown.
Binary file removed quickstarts/python/flask/dashboards/python03.png
Binary file not shown.
Binary file added quickstarts/python/flask/images/Errors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quickstarts/python/flask/images/Transactions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added quickstarts/python/flask/images/VM-metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7588dbd

Please sign in to comment.