Skip to content

Commit 64da77d

Browse files
authored
Merge pull request #19 from Yleisradio/fix-numeric-labels
Fix numeric labels
2 parents eafd09e + c010ded commit 64da77d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ So, add these to your project.clj dependencies:
2626

2727
```clojure
2828
[co.elastic.apm/apm-agent-api "AGENT_VERSION"]
29-
[clojure-elastic-apm "0.13.0"]
29+
[clojure-elastic-apm "0.13.1"]
3030
```
3131

3232
Note, in the agent configuration, the `elastic.apm.application_packages` option should be the top level namespace in your

Diff for: project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject clojure-elastic-apm "0.13.0"
1+
(defproject clojure-elastic-apm "0.13.1"
22
:description "Clojure wrapper for Elastic APM Java Agent"
33
:url "https://github.com/Yleisradio/clojure-elastic-apm"
44
:license {:name "Eclipse Public License"

Diff for: src/clojure_elastic_apm/core.clj

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
(.setLabel span-or-tx (name k) (str v)))
1515

1616
(defn set-label [^Span span-or-tx k v]
17-
(.setLabel span-or-tx (name k) (str v)))
17+
(cond
18+
(number? v) (.setLabel span-or-tx (name k) ^Number v)
19+
(boolean? v) (.setLabel span-or-tx (name k) ^boolean v)
20+
:else (.setLabel span-or-tx (name k) (str v))))
1821

1922
(defn set-name [^Span span-or-tx name]
2023
(.setName span-or-tx name))

Diff for: test/clojure_elastic_apm/core_test.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
(let [tx-details (es-find-first-document (str "(processor.event:transaction%20AND%20transaction.id:" @transaction-id ")"))]
3232
(is (= "TestTransaction" (get-in tx-details [:transaction :name])))
3333
(is (= "1" (get-in tx-details [:labels :t1])))
34-
(is (= "2" (get-in tx-details [:labels :t2])))
34+
(is (= 2 (get-in tx-details [:numeric_labels :t2])))
3535
(is (= "true" (get-in tx-details [:labels :t3])))
3636
(is (= "Label 4" (get-in tx-details [:labels :t4])))
3737
(is (= "test-result" (get-in tx-details [:transaction :result])))

0 commit comments

Comments
 (0)