# Only string arguments allowed for span.addLabels()?

**URL:** <https://discuss.elastic.co/t/only-string-arguments-allowed-for-span-addlabels/270707>\
**Category:** APM\
**Tags:** rum\
**Created:** [April 20, 2021, 1:12pm UTC](https://discuss.elastic.co/t/only-string-arguments-allowed-for-span-addlabels/270707 "2021-04-20T13:12:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![randy\_a](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randy_a/32/85982_2.png) [@randy\_a](https://discuss.elastic.co/u/randy_a)\
**Post date:** [April 20, 2021, 1:12pm UTC](https://discuss.elastic.co/t/only-string-arguments-allowed-for-span-addlabels/270707/1 "2021-04-20T13:12:15Z")

</div>

Hi there,

After implementing Elastic RUM for the (Angular) front-end of our single-page-application I wanted to create some custom events to time some of our user clicks. According to the documentation you're able to pass any `string`, `boolean` or `number` with the use of `span.addLabels()`. Because these would be timed events I was interested in `number`.

 ![kibana_01](https://us1.discourse-cdn.com/elastic/original/3X/b/3/b34a647c7996d7b9ee60166e6249b0d54d69eaa8.png)

However, when trying to implement the `.addLabels()` method I noticed that only string arguments are allowed (see screenshots below). Is this correct or am I missing something obvious?

 ![kibana_02](https://us1.discourse-cdn.com/elastic/original/3X/9/6/96170734a724b2817ab2fb06edc2d76179cf973a.png)

 ![kibana_03](https://us1.discourse-cdn.com/elastic/original/3X/4/6/4639f3826acf168e040a314cacd2733495ace21e.png)

 ![kibana_04](https://us1.discourse-cdn.com/elastic/original/3X/f/a/fa7a4df35ab51ff012d223fa8f2f58d25564b4e8.png)

---

<div class="post-metadata">

**Author:** ![Hamidreza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamidreza/32/21369_2.png) [@Hamidreza](https://discuss.elastic.co/u/Hamidreza)\
**Post date:** [April 21, 2021, 8:16am UTC](https://discuss.elastic.co/t/only-string-arguments-allowed-for-span-addlabels/270707/2 "2021-04-21T08:16:27Z")

</div>

Hi @randy_a ,

The exported types for addLabels argument is incorrect.  
I have opened [this PR](https://github.com/elastic/apm-agent-rum-js/pull/1017) to fix it.

Thanks for reporting this issue,  
Hamid

---

<div class="post-metadata">

**Author:** ![randy\_a](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randy_a/32/85982_2.png) [@randy\_a](https://discuss.elastic.co/u/randy_a)\
**Post date:** [April 22, 2021, 7:53am UTC](https://discuss.elastic.co/t/only-string-arguments-allowed-for-span-addlabels/270707/3 "2021-04-22T07:53:19Z")

</div>

Thanks @Hamidreza , appreciate the fix!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 13, 2021, 3:53am UTC](https://discuss.elastic.co/t/only-string-arguments-allowed-for-span-addlabels/270707/4 "2021-05-13T03:53:51Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
