TwiN / gatus

⛑ Automated developer-oriented status page
https://gatus.io
Apache License 2.0
6.36k stars 424 forks source link

Make MaximumNumberOfResults and MaximumNumberOfEvents configurable #466

Open skhokhlov opened 1 year ago

skhokhlov commented 1 year ago

Describe the feature request

Right now only 100 checks and 50 events are stored. If we have frequent checks, for instance with 10s internal, we will store results only for 16 last minutes which is not enough for retrospective analysis. It would be very great to configure the numbers.

Why do you personally want this feature to be implemented?

We would like to store old data. Currently, for this we have to do checks less frequently.

How long have you been using this project?

No response

Additional information

No response

BassSingh commented 1 year ago

I like this :)

mensinda commented 1 month ago

I also ran into this, and decided to work around this limitation manually. Turns out, increasing the hard coded values is relatively easy. For anyone else who runs into this limitation until #476 is merged:

diff --git a/storage/store/common/limits.go b/storage/store/common/limits.go
index 92007220..a5187bb8 100644
--- a/storage/store/common/limits.go
+++ b/storage/store/common/limits.go
@@ -2,8 +2,8 @@ package common

 const (
    // MaximumNumberOfResults is the maximum number of results that an endpoint can have
-   MaximumNumberOfResults = 100
+   MaximumNumberOfResults = 1000

    // MaximumNumberOfEvents is the maximum number of events that an endpoint can have
-   MaximumNumberOfEvents = 50
+   MaximumNumberOfEvents = 500
 )
diff --git a/web/app/src/components/EndpointGroup.vue b/web/app/src/components/EndpointGroup.vue
index dbc1fa63..aa801014 100644
--- a/web/app/src/components/EndpointGroup.vue
+++ b/web/app/src/components/EndpointGroup.vue
@@ -18,7 +18,7 @@
       <slot v-for="(endpoint, idx) in endpoints" :key="idx">
         <Endpoint
             :data="endpoint"
-            :maximumNumberOfResults="20"
+            :maximumNumberOfResults="40"
             @showTooltip="showTooltip"
             @toggleShowAverageResponseTime="toggleShowAverageResponseTime" :showAverageResponseTime="showAverageResponseTime"
         />
diff --git a/web/app/src/components/Pagination.vue b/web/app/src/components/Pagination.vue
index 3f909e1f..d88ab31d 100644
--- a/web/app/src/components/Pagination.vue
+++ b/web/app/src/components/Pagination.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="mt-3 flex">
     <div class="flex-1">
-      <button v-if="currentPage < 5" @click="nextPage" class="bg-gray-100 hover:bg-gray-200 text-gray-500 border border-gray-200 px-2 rounded font-mono dark:bg-gray-700 dark:text-gray-200 dark:border-gray-500 dark:hover:bg-gray-600">&lt;</button>
+      <button v-if="currentPage < 25" @click="nextPage" class="bg-gray-100 hover:bg-gray-200 text-gray-500 border border-gray-200 px-2 rounded font-mono dark:bg-gray-700 dark:text-gray-200 dark:border-gray-500 dark:hover:bg-gray-600">&lt;</button>
     </div>
     <div class="flex-1 text-right">
       <button v-if="currentPage > 1" @click="previousPage" class="bg-gray-100 hover:bg-gray-200 text-gray-500 border border-gray-200 px-2 rounded font-mono dark:bg-gray-700 dark:text-gray-200 dark:border-gray-500 dark:hover:bg-gray-600">&gt;</button>
diff --git a/web/app/src/views/Details.vue b/web/app/src/views/Details.vue
index 18706475..41894380 100644
--- a/web/app/src/views/Details.vue
+++ b/web/app/src/views/Details.vue
@@ -9,7 +9,7 @@
       <hr class="mb-4"/>
       <Endpoint
           :data="endpointStatus"
-          :maximumNumberOfResults="20"
+          :maximumNumberOfResults="40"
           @showTooltip="showTooltip"
           @toggleShowAverageResponseTime="toggleShowAverageResponseTime"
           :showAverageResponseTime="showAverageResponseTime"
@@ -112,7 +112,7 @@ export default {
   methods: {
     fetchData() {
       //console.log("[Details][fetchData] Fetching data");
-      fetch(`${this.serverUrl}/api/v1/endpoints/${this.$route.params.key}/statuses?page=${this.currentPage}`, {credentials: 'include'})
+      fetch(`${this.serverUrl}/api/v1/endpoints/${this.$route.params.key}/statuses?page=${this.currentPage}&pageSize=40`, {credentials: 'include'})
       .then(response => {
         if (response.status === 200) {
           response.json().then(data => {
diff --git a/web/app/src/views/Home.vue b/web/app/src/views/Home.vue
index 21b95d55..dfae7957 100644
--- a/web/app/src/views/Home.vue
+++ b/web/app/src/views/Home.vue
@@ -32,7 +32,7 @@ export default {
   emits: ['showTooltip', 'toggleShowAverageResponseTime'],
   methods: {
     fetchData() {
-      fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=${this.currentPage}`, {credentials: 'include'})
+      fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=${this.currentPage}&pageSize=40`, {credentials: 'include'})
       .then(response => {
         this.retrievedData = true;
         if (response.status === 200) {

After applying the patch:

cd web/app
npm install
npm run build
cd ..
docker build .