@xylabs/telemetry-exporter 5.0.84 → 5.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -57
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/telemetry-exporter**
|
|
@@ -23,11 +25,15 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Classes
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
| Class | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [XyConsoleSpanExporter](#classes/XyConsoleSpanExporter) | A console span exporter that formats spans with color-coded durations using chalk. Spans are filtered by a configurable log level based on their duration. |
|
|
27
31
|
|
|
28
32
|
## Functions
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
| Function | Description |
|
|
35
|
+
| ------ | ------ |
|
|
36
|
+
| [spanDurationInMillis](#functions/spanDurationInMillis) | Calculates the duration of a span in milliseconds from its high-resolution time tuple. |
|
|
31
37
|
|
|
32
38
|
### classes
|
|
33
39
|
|
|
@@ -49,18 +55,15 @@ Spans are filtered by a configurable log level based on their duration.
|
|
|
49
55
|
### Constructor
|
|
50
56
|
|
|
51
57
|
```ts
|
|
52
|
-
new XyConsoleSpanExporter(logLevel
|
|
58
|
+
new XyConsoleSpanExporter(logLevel?: number, logger?: Logger): XyConsoleSpanExporter;
|
|
53
59
|
```
|
|
54
60
|
|
|
55
61
|
### Parameters
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`number`
|
|
60
|
-
|
|
61
|
-
#### logger?
|
|
62
|
-
|
|
63
|
-
`Logger` = `console`
|
|
63
|
+
| Parameter | Type | Default value |
|
|
64
|
+
| ------ | ------ | ------ |
|
|
65
|
+
| `logLevel` | `number` | `0` |
|
|
66
|
+
| `logger` | `Logger` | `console` |
|
|
64
67
|
|
|
65
68
|
### Returns
|
|
66
69
|
|
|
@@ -74,31 +77,11 @@ ConsoleSpanExporter.constructor
|
|
|
74
77
|
|
|
75
78
|
## Properties
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
readonly
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Duration thresholds (in ms) that map to increasing log levels.
|
|
84
|
-
|
|
85
|
-
***
|
|
86
|
-
|
|
87
|
-
### logLevelToChalkColor
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
readonly static logLevelToChalkColor: ChalkInstance[];
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Chalk color functions corresponding to each log level.
|
|
94
|
-
|
|
95
|
-
***
|
|
96
|
-
|
|
97
|
-
### logger
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
logger: Logger;
|
|
101
|
-
```
|
|
80
|
+
| Property | Modifier | Type | Description |
|
|
81
|
+
| ------ | ------ | ------ | ------ |
|
|
82
|
+
| <a id="durationtologlevel"></a> `durationToLogLevel` | `readonly` | `number`[] | Duration thresholds (in ms) that map to increasing log levels. |
|
|
83
|
+
| <a id="logleveltochalkcolor"></a> `logLevelToChalkColor` | `readonly` | `ChalkInstance`[] | Chalk color functions corresponding to each log level. |
|
|
84
|
+
| <a id="logger"></a> `logger` | `public` | `Logger` | - |
|
|
102
85
|
|
|
103
86
|
## Accessors
|
|
104
87
|
|
|
@@ -121,16 +104,16 @@ The minimum log level required for a span to be exported.
|
|
|
121
104
|
### export()
|
|
122
105
|
|
|
123
106
|
```ts
|
|
124
|
-
export(spans): void;
|
|
107
|
+
export(spans: ReadableSpan[]): void;
|
|
125
108
|
```
|
|
126
109
|
|
|
127
110
|
Export spans.
|
|
128
111
|
|
|
129
112
|
### Parameters
|
|
130
113
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`ReadableSpan`[]
|
|
114
|
+
| Parameter | Type | Description |
|
|
115
|
+
| ------ | ------ | ------ |
|
|
116
|
+
| `spans` | `ReadableSpan`[] | - |
|
|
134
117
|
|
|
135
118
|
### Returns
|
|
136
119
|
|
|
@@ -147,18 +130,16 @@ ConsoleSpanExporter.export
|
|
|
147
130
|
### logColor()
|
|
148
131
|
|
|
149
132
|
```ts
|
|
150
|
-
logColor(level): ChalkInstance;
|
|
133
|
+
logColor(level: number): ChalkInstance;
|
|
151
134
|
```
|
|
152
135
|
|
|
153
136
|
Returns the chalk color function for the given log level.
|
|
154
137
|
|
|
155
138
|
### Parameters
|
|
156
139
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
`number`
|
|
160
|
-
|
|
161
|
-
The log level index.
|
|
140
|
+
| Parameter | Type | Description |
|
|
141
|
+
| ------ | ------ | ------ |
|
|
142
|
+
| `level` | `number` | The log level index. |
|
|
162
143
|
|
|
163
144
|
### Returns
|
|
164
145
|
|
|
@@ -171,18 +152,16 @@ A chalk color function.
|
|
|
171
152
|
### spanLevel()
|
|
172
153
|
|
|
173
154
|
```ts
|
|
174
|
-
spanLevel(span): number;
|
|
155
|
+
spanLevel(span: ReadableSpan): number;
|
|
175
156
|
```
|
|
176
157
|
|
|
177
158
|
Determines the log level of a span based on its duration.
|
|
178
159
|
|
|
179
160
|
### Parameters
|
|
180
161
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`ReadableSpan`
|
|
184
|
-
|
|
185
|
-
The span to evaluate.
|
|
162
|
+
| Parameter | Type | Description |
|
|
163
|
+
| ------ | ------ | ------ |
|
|
164
|
+
| `span` | `ReadableSpan` | The span to evaluate. |
|
|
186
165
|
|
|
187
166
|
### Returns
|
|
188
167
|
|
|
@@ -199,18 +178,16 @@ The numeric log level (index into durationToLogLevel).
|
|
|
199
178
|
***
|
|
200
179
|
|
|
201
180
|
```ts
|
|
202
|
-
function spanDurationInMillis(span): number;
|
|
181
|
+
function spanDurationInMillis(span: ReadableSpan): number;
|
|
203
182
|
```
|
|
204
183
|
|
|
205
184
|
Calculates the duration of a span in milliseconds from its high-resolution time tuple.
|
|
206
185
|
|
|
207
186
|
## Parameters
|
|
208
187
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`ReadableSpan`
|
|
212
|
-
|
|
213
|
-
The span to measure.
|
|
188
|
+
| Parameter | Type | Description |
|
|
189
|
+
| ------ | ------ | ------ |
|
|
190
|
+
| `span` | `ReadableSpan` | The span to measure. |
|
|
214
191
|
|
|
215
192
|
## Returns
|
|
216
193
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/telemetry-exporter",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.87",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hex",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@opentelemetry/sdk-trace-base": "^2.6.0",
|
|
46
|
-
"@xylabs/logger": "~5.0.
|
|
46
|
+
"@xylabs/logger": "~5.0.87",
|
|
47
47
|
"chalk": "~5.6.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@opentelemetry/api": "^1.9.0",
|
|
51
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
52
|
-
"@xylabs/tsconfig": "~7.4.
|
|
51
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.24",
|
|
52
|
+
"@xylabs/tsconfig": "~7.4.24",
|
|
53
53
|
"typescript": "~5.9.3",
|
|
54
|
-
"vitest": "^4.0
|
|
54
|
+
"vitest": "^4.1.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@opentelemetry/api": "^1"
|