Skip to content

Commit 9c8a9d0

Browse files
Add span-process-id, span-thread-id.
* tracing-core/span.dylan (<span>): Add constant slots for span-process-id, span-thread-id. * tracing-core/library.dylan (module tracing-core): Use threads. Get current-process-id from system's operating-system module. Export span-process-id and span-thread-id. * documentation/source/index.rst (span-process-id, span-thread-id): Document.
1 parent 8eb77b2 commit 9c8a9d0

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

documentation/source/index.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,13 @@ Spans
343343
:parameter span: An instance of :class:`<span>`.
344344
:value id: An instance of ``<object>``.
345345

346+
.. generic-function:: span-process-id
347+
348+
:signature: span-process-id (span) => (process-id)
349+
350+
:parameter span: An instance of :class:`<span>`.
351+
:value process-id: An instance of :drm:`<integer>`.
352+
346353
.. generic-function:: span-start-time
347354

348355
Returns the time that the span was created.
@@ -390,6 +397,13 @@ Spans
390397

391398
* :gf:`span-stop`
392399

400+
.. generic-function:: span-thread-id
401+
402+
:signature: span-thread-id (span) => (thread-id)
403+
404+
:parameter span: An instance of :class:`<span>`.
405+
:value thread-id: An instance of :drm:`<integer>`.
406+
393407
.. generic-function:: span-trace-id
394408

395409
Return the trace-id for a span.

tracing-core/library.dylan

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ define module tracing-core
1414
use dylan;
1515
use common-dylan;
1616
use date, import: { current-timestamp };
17+
use operating-system, import: { current-process-id };
1718
use finalization;
1819
use plists;
1920
use simple-random;
2021
use simple-timers;
22+
use threads;
2123

2224
export trace-push,
2325
trace-add-data,
@@ -31,6 +33,8 @@ define module tracing-core
3133
span-id,
3234
span-trace-id,
3335
span-parent-id,
36+
span-process-id,
37+
span-thread-id,
3438
span-description,
3539
span-start-time,
3640
span-duration,

tracing-core/span.dylan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ define class <span> (<object>)
1212
required-init-keyword: trace-id:;
1313
constant slot span-parent-id :: false-or(<unique-id>) = #f,
1414
init-keyword: parent-id:;
15+
constant slot span-process-id :: <integer> = current-process-id();
16+
constant slot span-thread-id :: <integer> = current-thread-id();
1517
constant slot span-description :: <string>,
1618
required-init-keyword: description:;
1719
slot span-annotations :: false-or(<span-annotation-vector>) = #f;

0 commit comments

Comments
 (0)