Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06ac7aa

Browse files
authored
Improve Tracer API docs (open-telemetry#87)
1 parent c1b117d commit 06ac7aa

File tree

1 file changed

+28
-26
lines changed
  • packages/opentelemetry-types/src/trace

1 file changed

+28
-26
lines changed

packages/opentelemetry-types/src/trace/tracer.ts

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,24 @@ import { SpanContext } from './span_context';
2525
* @todo: Move into module of its own
2626
*/
2727
export interface SpanOptions {
28-
/**
29-
* The SpanKind of a span
30-
*/
28+
/** The SpanKind of a span */
3129
kind?: SpanKind;
32-
33-
/**
34-
* A spans attributes
35-
*/
30+
/** A spans attributes */
3631
attributes?: Attributes;
37-
38-
/**
39-
* Indicates that events are being recorded for a span
40-
*/
32+
/** Indicates that events are being recorded for a span */
4133
isRecordingEvents?: boolean;
42-
43-
/**
44-
* The parent span
45-
*/
34+
/** The parent span */
4635
parent?: Span | SpanContext;
47-
48-
/**
49-
* The start timestamp of a span
50-
*/
36+
/** The start timestamp of a span */
5137
startTime?: number;
5238
}
5339

5440
/**
55-
* Tracer provides an interface for creating spans and propagating context in-process.
41+
* Tracer provides an interface for creating {@link Span}s and propagating
42+
* context in-process.
43+
*
44+
* Users may choose to use manual or automatic Context propagation. Because of
45+
* that this class offers APIs to facilitate both usages.
5646
*/
5747
export interface Tracer {
5848
/**
@@ -66,12 +56,12 @@ export interface Tracer {
6656
getCurrentSpan(): Span;
6757

6858
/**
69-
*
59+
* Starts a new {@link Span}.
7060
* @param name The name of the span
7161
* @param [options] SpanOptions used for span creation
7262
* @returns Span The newly created span
7363
*/
74-
start(name: string, options?: SpanOptions): Span;
64+
startSpan(name: string, options?: SpanOptions): Span;
7565

7666
/**
7767
* Executes the function given by fn within the context provided by Span
@@ -91,20 +81,32 @@ export interface Tracer {
9181
*
9282
* @todo: Pending API discussion. Revisit if Span or SpanData should be passed
9383
* in here once this is sorted out.
94-
* @param span
84+
* @param span Span Data to be reported to all exporters.
9585
*/
9686
recordSpanData(span: Span): void;
9787

9888
/**
99-
* Returns the binary format interface which can serialize/deserialize Spans.
89+
* Returns the {@link BinaryFormat} interface which can serialize/deserialize
90+
* Spans.
91+
*
92+
* If no tracer implementation is provided, this defaults to the W3C Trace
93+
* Context binary format ({@link BinaryFormat}). For more details see
94+
* <a href="https://w3c.github.io/trace-context-binary/">W3C Trace Context
95+
* binary protocol</a>.
96+
*
10097
* @todo: Change return type once BinaryFormat is available
10198
*/
10299
getBinaryFormat(): unknown;
103100

104101
/**
105-
* Returns the HTTP text format interface which can inject/extract Spans.
102+
* Returns the {@link HttpTextFormat} interface which can inject/extract
103+
* Spans.
104+
*
105+
* If no tracer implementation is provided, this defaults to the W3C Trace
106+
* Context HTTP text format ({@link HttpTraceContext}). For more details see
107+
* <a href="https://w3c.github.io/trace-context/">W3C Trace Context</a>.
106108
*
107109
* @todo: Change return type once HttpTextFormat is available
108110
*/
109-
getHttpTextFormat: unknown;
111+
getHttpTextFormat(): unknown;
110112
}

0 commit comments

Comments
 (0)