opsgenie / opsgenie-configuration-backup

Backup your OpsGenie account's configuration and restore it later
https://opsgenie.com
Apache License 2.0
28 stars 26 forks source link

Order is unstable for some elements #33

Closed iainelder closed 4 years ago

iainelder commented 5 years ago

The order for some elements in the backup is not stable. The order of the list elements in the JSON changes even when the configuration in the application has not changed.

This makes git less effective as a change tracking tool because lots of non-functional changes are logged.

The backup should maintain the order of elements so that only functional changes show as diffs in the git repo.

I've seen the instability for the following objects:

For example, a user notification policy that sends an email and a mobile notification when an alert is assigned to them.

image

Between runs of the backup tool, I see diffs like this in my git repo. The contact methods have changed order in the backup, although nothing in the configuration has changed.

             "name": "Assigned Alert",
             "id": "62672266-57a2-4547-877c-7ca4aexample"
           },
-          "id": "c5785428-c6df-423f-bc38-2bcc2example",
+          "id": "3d88fcf8-c7cb-450e-831a-d34c4example",
           "sendAfter": {
             "timeAmount": 0,
             "timeUnit": "minutes"
           },
           "contact": {
-            "method": "email",
-            "to": "john@example.com"
+            "method": "mobile",
+            "to": "chaozu - Android 6.0.1 - v3.1.2"
           },
           "enabled": true
         },
@@ -241,14 +209,14 @@
             "name": "Assigned Alert",
             "id": "62672266-57a2-4547-877c-7ca4aexample"
           },
-          "id": "3d88fcf8-c7cb-450e-831a-d34c4example",
+          "id": "c5785428-c6df-423f-bc38-2bcc2example",
           "sendAfter": {
             "timeAmount": 0,
             "timeUnit": "minutes"
           },
           "contact": {
-            "method": "mobile",
-            "to": "chaozu - Android 6.0.1 - v3.1.2"
+            "method": "email",
+            "to": "john@example.com"
           },
           "enabled": true
         }

As another example, a scheduled maintenance is set to disable multiple integrations:

image

Bedtween runs of the backup tool, I see diffs like this. The IDs of the disabled integrations have changed order in the backup, although nothing in the configuration has changed.

     {
       "state": "disabled",
       "entity": {
-        "id": "52268d94-7418-46ad-8022-a564fexample",
+        "id": "f923033b-6409-4c7f-8ffa-ada5aexample",
         "type": "integration"
       }
     },
     {
       "state": "disabled",
       "entity": {
-        "id": "f923033b-6409-4c7f-8ffa-ada5aexample",
+        "id": "52268d94-7418-46ad-8022-a564fexample",
         "type": "integration"
       }
     }
iainelder commented 5 years ago

Opsgenie support has opened a support ticket with the engineering team about this. The internal reference number is ALX-4227.

EnverKESMEN commented 4 years ago

Hi @iainelder, thanks for the detailed feedback. With version 0.23.0, we started to sort JSON lists alphabetically by ID.