# LittleEndian vs BigEndian in go agent

**URL:** <https://discuss.elastic.co/t/littleendian-vs-bigendian-in-go-agent/200232>\
**Category:** APM\
**Tags:** go\
**Created:** [September 19, 2019, 2:28pm UTC](https://discuss.elastic.co/t/littleendian-vs-bigendian-in-go-agent/200232 "2019-09-19T14:28:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![euskadi31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/euskadi31/32/54510_2.png) [@euskadi31](https://discuss.elastic.co/u/euskadi31)\
**Post date:** [September 19, 2019, 2:28pm UTC](https://discuss.elastic.co/t/littleendian-vs-bigendian-in-go-agent/200232/1 "2019-09-19T14:28:51Z")

</div>

Hi,

is not it a problem to use LittleEndian and BigEndian on SpanID?

see:

- [https://github.com/elastic/apm-agent-go/blob/be583fe97a9551c2e19de7902b15086308b13cee/transaction.go#L69](https://github.com/elastic/apm-agent-go/blob/be583fe97a9551c2e19de7902b15086308b13cee/transaction.go#L69)

- [https://github.com/elastic/apm-agent-go/blob/master/span.go#L111](https://github.com/elastic/apm-agent-go/blob/master/span.go#L111)

- [https://github.com/elastic/apm-agent-go/blob/e510527b3a3b5be41fdea807e4b776931bd76689/sampler.go#L64](https://github.com/elastic/apm-agent-go/blob/e510527b3a3b5be41fdea807e4b776931bd76689/sampler.go#L64)

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [September 20, 2019, 3:49am UTC](https://discuss.elastic.co/t/littleendian-vs-bigendian-in-go-agent/200232/2 "2019-09-20T03:49:14Z")

</div>

Hi @euskadi31, welcome to the forum 🙂

Keen eyes! The difference in endianness is not a problem.

In the first two cases we're just generating some random bytes, and it's been a while, but I think this was just the most efficient way to do it. In the sampler we're just interested in knowing whether the span ID, when converted to a number, is less than a predetermined value. They don't need to be consistent with each other.

---

<div class="post-metadata">

**Author:** ![euskadi31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/euskadi31/32/54510_2.png) [@euskadi31](https://discuss.elastic.co/u/euskadi31)\
**Post date:** [September 20, 2019, 7:29am UTC](https://discuss.elastic.co/t/littleendian-vs-bigendian-in-go-agent/200232/3 "2019-09-20T07:29:48Z")

</div>

ok, Thank you for your explanation 🙂

---

<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:** [October 11, 2019, 3:29am UTC](https://discuss.elastic.co/t/littleendian-vs-bigendian-in-go-agent/200232/4 "2019-10-11T03:29:52Z")

</div>

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