You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-12Lines changed: 26 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,71 +20,80 @@ The current options are:
20
20
### Span Exporters
21
21
22
22
#### CollectorExporter
23
+
23
24
The CollectorExporter requires a Uri of the opentelemetry-collector instance's trace collector.
24
-
```
25
+
26
+
```dart
25
27
import 'package:opentelemetry/sdk.dart' as otel_sdk;
26
28
27
29
final exporter = otel_sdk.CollectorExporter(Uri.parse('https://my-collector.com/v1/traces'));
28
30
```
29
31
30
32
#### ConsoleExporter
33
+
31
34
The ConsoleExporter has no requirements, and has no configuration options.
32
-
```
35
+
36
+
```dart
33
37
import 'package:opentelemetry/sdk.dart' as otel_sdk;
34
38
35
39
final exporter = otel_sdk.ConsoleExporter();
36
40
```
37
41
38
42
### Span Processors
39
43
40
-
Next, you will need a at least one span processor. A span processor is responsible for collectoring the spans you create and feeding them to the exporter.
44
+
Next, you will need at least one span processor. A span processor is responsible for collecting the spans you create and feeding them to the exporter.
41
45
The current options are:
42
46
43
47
| SpanProcessor | Description |
44
48
| -------- | ----------- |
45
49
|[BatchSpanProcessor](#batchspanprocessor)| Batches spans to be exported on a configured time interval. |
46
50
|[SimpleSpanProcessor](#simplespanprocessor)| Executes the provided exporter immediately upon closing the span. |
47
51
48
-
49
52
#### BatchSpanProcessor
53
+
50
54
BatchSpanProcessors collect up to 2048 spans per interval, and executes the provided exporter on a timer.
51
55
| Option | Description | Default |
52
56
| ------ | ----------- | ------- |
53
57
| maxExportBatchSize | At most, how many spans are processed per batch. | 512 |
54
58
| scheduledDelay | How long to collect spans before processing them. | 5000 ms |
55
-
```
59
+
60
+
```dart
56
61
import 'package:opentelemetry/sdk.dart' as otel_sdk;
57
62
58
63
final exporter = otel_sdk.ConsoleExporter();
59
64
final processor = otel_sdk.BatchSpanProcessor(exporter, scheduledDelay: 10000);
60
65
```
61
66
62
67
#### SimpleSpanProcessor
68
+
63
69
A SimpleSpanProcessor has no configuration options, and executes the exporter when each span is closed.
64
-
```
70
+
71
+
```dart
65
72
import 'package:opentelemetry/sdk.dart' as otel_sdk;
66
73
67
74
final exporter = otel_sdk.ConsoleExporter();
68
75
final processor = otel_sdk.SimpleSpanProcessor(exporter);
69
76
```
70
77
71
78
### Tracer Provider
79
+
72
80
A trace provider registers your span processors, and is responsible for managing any tracers.
73
81
| Option | Description | Default |
74
82
| ------ | ----------- | ------- |
75
83
| processors | A list of SpanProcessors to register. | A [SimpleSpanProcessor](#simplespanprocessor) configured with a [ConsoleExporter](#consoleexporter). |
76
-
```
84
+
85
+
```dart
77
86
import 'package:opentelemetry/sdk.dart' as otel_sdk;
78
87
79
88
final exporter = otel_sdk.CollectorExporter(Uri.parse('https://my-collector.com/v1/traces'));
80
-
final processor = otel_sdk.BatchSpanProcesor(exporter);
89
+
final processor = otel_sdk.BatchSpanProcessor(exporter);
81
90
82
91
// Send spans to a collector every 5 seconds
83
92
final provider = otel_sdk.TracerProvider([processor]);
84
93
85
94
// Optionally, multiple processors can be registered
0 commit comments