Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix numeric labels #19

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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