Skip to content

Commit 96b1610

Browse files
committed
feat(sentry-api): sentry stats period is configurable
1 parent f528da9 commit 96b1610

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

commitlint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const scope = [
66
"task",
77
"validator",
88
"metrics",
9-
"panic"
9+
"panic",
10+
"sentry-api"
1011
];
1112

1213
module.exports = {

controller/sentry/tests/test_sentry_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def test_client_get_stats(mock_request: MagicMock):
120120
"groupBy": ["category", "outcome"],
121121
"interval": "1h",
122122
"project": sentry_id,
123-
"statsPeriod": "7d",
123+
"statsPeriod": settings.SENTRY_STATS_PERIOD,
124124
"category": "transaction",
125125
},
126126
)

controller/sentry/webservices/sentry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def get_stats(self, sentry_id: str) -> dict:
140140
"groupBy": ["category", "outcome"],
141141
"interval": "1h",
142142
"project": sentry_id,
143-
"statsPeriod": "7d",
143+
"statsPeriod": settings.SENTRY_STATS_PERIOD,
144144
"category": "transaction",
145145
}
146146
response = self.__call("GET", url, params=params)

controller/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@
306306

307307
SENTRY_API_TOKEN = os.getenv("SENTRY_API_TOKEN", "TEST")
308308
SENTRY_ORGANIZATION_SLUG = os.getenv("SENTRY_ORGANIZATION_SLUG")
309+
SENTRY_STATS_PERIOD = os.getenv("SENTRY_STATS_PERIOD", "30d")
309310

310311
DEFAULT_SPIKE_DETECTION_PARAM = {
311312
"lag": int(os.getenv("SPIKE_DETECTION_LAG", "48")),

0 commit comments

Comments
 (0)