Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 8dea15d

Browse files
committed
Trace and span ids are now random instead of timestamps
1 parent 248b99a commit 8dea15d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
0.5.1:
2+
* Trace and span ids are now random instead of timestamps
3+
14
0.5.0:
25
* Introduce getEnvConfig
36
* [Highlevel.IO] Auto-tag root spans with a thread id

lightstep-haskell.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 2.4
22

33
name: lightstep-haskell
4-
version: 0.5.0
4+
version: 0.5.1
55
synopsis: LightStep OpenTracing client library
66
description: LightStep OpenTracing client library. Uses GRPC transport via proto-lens.
77
category: Tools
@@ -83,6 +83,7 @@ library
8383
, proto-lens >= 0.5.1.0
8484
, proto-lens-protobuf-types >= 0.5.0.0
8585
, proto-lens-runtime >= 0.5.0.0
86+
, random
8687
, safe-exceptions
8788
, stm
8889
, text

src/LightStep/LowLevel.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import Paths_lightstep_haskell (version)
2424
import Proto.Collector
2525
import Proto.Collector_Fields
2626
import Proto.Google.Protobuf.Timestamp_Fields
27+
import System.Random
2728
import System.Timeout
2829

2930
data LightStepClient
@@ -123,9 +124,8 @@ startSpan :: T.Text -> IO Span
123124
startSpan op = do
124125
inc 1 startedSpanCountVar
125126
nanosSinceEpoch <- getTime <$> now
126-
-- FIXME: make those ids randomer
127-
let sid = fromIntegral nanosSinceEpoch
128-
tid = fromIntegral nanosSinceEpoch
127+
sid <- randomIO
128+
let tid = sid
129129
pure $
130130
defMessage
131131
& operationName .~ op

0 commit comments

Comments
 (0)