Skip to content

Commit

Permalink
Merge pull request #19 from Yleisradio/fix-numeric-labels
Browse files Browse the repository at this point in the history
Fix numeric labels
  • Loading branch information
eerohele authored Nov 27, 2024
2 parents eafd09e + c010ded commit 64da77d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ So, add these to your project.clj dependencies:

```clojure
[co.elastic.apm/apm-agent-api "AGENT_VERSION"]
[clojure-elastic-apm "0.13.0"]
[clojure-elastic-apm "0.13.1"]
```

Note, in the agent configuration, the `elastic.apm.application_packages` option should be the top level namespace in your
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject clojure-elastic-apm "0.13.0"
(defproject clojure-elastic-apm "0.13.1"
:description "Clojure wrapper for Elastic APM Java Agent"
:url "https://github.com/Yleisradio/clojure-elastic-apm"
:license {:name "Eclipse Public License"
Expand Down
5 changes: 4 additions & 1 deletion src/clojure_elastic_apm/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
(.setLabel span-or-tx (name k) (str v)))

(defn set-label [^Span span-or-tx k v]
(.setLabel span-or-tx (name k) (str v)))
(cond
(number? v) (.setLabel span-or-tx (name k) ^Number v)
(boolean? v) (.setLabel span-or-tx (name k) ^boolean v)
:else (.setLabel span-or-tx (name k) (str v))))

(defn set-name [^Span span-or-tx name]
(.setName span-or-tx name))
Expand Down
2 changes: 1 addition & 1 deletion test/clojure_elastic_apm/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(let [tx-details (es-find-first-document (str "(processor.event:transaction%20AND%20transaction.id:" @transaction-id ")"))]
(is (= "TestTransaction" (get-in tx-details [:transaction :name])))
(is (= "1" (get-in tx-details [:labels :t1])))
(is (= "2" (get-in tx-details [:labels :t2])))
(is (= 2 (get-in tx-details [:numeric_labels :t2])))
(is (= "true" (get-in tx-details [:labels :t3])))
(is (= "Label 4" (get-in tx-details [:labels :t4])))
(is (= "test-result" (get-in tx-details [:transaction :result])))
Expand Down

0 comments on commit 64da77d

Please sign in to comment.