Skip to content

Commit

Permalink
fixup! snake case all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Jan 28, 2025
1 parent 5233136 commit a5a064e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/spootnik/reporter/alert.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
(let [t (Instant/now)]
(cond-> {:startsAt (str t)
:endsAt (str (.plusMillis t (* delay-after-ms)))
:labels (into {:alertname (csk/->snake_case_string name)}
(map (juxt csk/->snake_case_string identity))
:labels (into {:alertname (csk/->snake_case name)}
(map (fn [[k v]] [(csk/->snake_case k) v]))
labels)}

(seq annotations)
(assoc :annotations
(into {}
(map (juxt csk/->snake_case_string identity))
(map (fn [[k v]] [(csk/->snake_case k) v]))
annotations))

generator-url
Expand Down
5 changes: 3 additions & 2 deletions test/spootnik/reporter/alert_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
(deftest test-alert-format
(is (match? {:labels {:alertname "yolo"}}
(a/alert->payload {:name "yolo"})))
(is (match? {:labels {:alertname "yolo", :baz "bazz"}}
(is (match? {:labels {:alertname "yolo", :baz "bazz"
:key_format "format"}}
(a/alert->payload {:name "yolo"
:labels {:baz "bazz"}})))
:labels {:baz "bazz" :key-format "format"}})))
(is (match? {:labels {:alertname "yolo", :baz "bazz"},
:annotations {:foo "bar"}}
(a/alert->payload {:name "yolo"
Expand Down

0 comments on commit a5a064e

Please sign in to comment.