@sincpro/client-framework 2.5.0 → 2.6.0
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
CHANGED
|
@@ -618,6 +618,22 @@ configureProcess({
|
|
|
618
618
|
none) every root run starts its own trace, as without the option.
|
|
619
619
|
- **Off by default.** `openTelemetryTracer(tracer)` behaves as it always has.
|
|
620
620
|
|
|
621
|
+
### A failure's detail: in the trace, or in the error tracker
|
|
622
|
+
|
|
623
|
+
A failed run's span carries its exception — an `exception` event with its type, message and stack
|
|
624
|
+
— and its message as the status. Where errors go to an error tracker with their trace id
|
|
625
|
+
(GlitchTip, through `sentryReporter`), keep the detail there:
|
|
626
|
+
|
|
627
|
+
```ts
|
|
628
|
+
openTelemetryTracer(provider.getTracer("forge-web"), { recordExceptions: false });
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
The failed span still says what failed — `error.type`, `sincpro.outcome`, `sincpro.fault` and an
|
|
632
|
+
ERROR status —, and the error tracker holds the message and the stack under its access rules, not
|
|
633
|
+
every backend that stores traces: in an ERP a failure's message can name a customer or an amount.
|
|
634
|
+
OpenTelemetry, too, moves away from exceptions as span events (2026). Default `true`: a span keeps
|
|
635
|
+
its exception, as it always has.
|
|
636
|
+
|
|
621
637
|
### Logging
|
|
622
638
|
|
|
623
639
|
The application layer imports no logger. Two are predefined, for the code around the use cases:
|
|
@@ -18,6 +18,18 @@ export type OpenTelemetryTracerOptions = {
|
|
|
18
18
|
* does (`ZoneContextManager`) has a root run start under the span active where it is executed.
|
|
19
19
|
*/
|
|
20
20
|
readonly adoptActiveSpan?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A failed run's span carries its exception — an `exception` event with its type, message and
|
|
23
|
+
* stack — and its message as the status. Default `true`, as always.
|
|
24
|
+
*
|
|
25
|
+
* `false` keeps a failed span to what the run sets (`error.type`, `sincpro.outcome`,
|
|
26
|
+
* `sincpro.fault`) and an ERROR status, without the message or the stack. Recommended where
|
|
27
|
+
* errors go to an error tracker with their trace id (GlitchTip, through `sentryReporter`): the
|
|
28
|
+
* detail lives there, under its access rules, and not in every backend that stores traces — in
|
|
29
|
+
* an ERP the message of a failure can name a customer or an amount. OpenTelemetry, too, moves
|
|
30
|
+
* away from exceptions as span events (2026).
|
|
31
|
+
*/
|
|
32
|
+
readonly recordExceptions?: boolean;
|
|
21
33
|
};
|
|
22
34
|
/**
|
|
23
35
|
* The `Tracer` port over OpenTelemetry's API: every use case a span of whatever provider the
|
|
@@ -43,4 +55,4 @@ export type OpenTelemetryTracerOptions = {
|
|
|
43
55
|
* when the application asks (`adoptActiveSpan`). A span nothing records (a sampler said no, no
|
|
44
56
|
* provider registered) answers no ids — so no `traceparent` claims a trace that does not exist.
|
|
45
57
|
*/
|
|
46
|
-
export declare function openTelemetryTracer(tracer: OtelTracer, { adoptActiveSpan }?: OpenTelemetryTracerOptions): Tracer;
|
|
58
|
+
export declare function openTelemetryTracer(tracer: OtelTracer, { adoptActiveSpan, recordExceptions }?: OpenTelemetryTracerOptions): Tracer;
|
|
@@ -23,7 +23,7 @@ import { context as otelContext, isSpanContextValid, ROOT_CONTEXT, SpanKind, Spa
|
|
|
23
23
|
* when the application asks (`adoptActiveSpan`). A span nothing records (a sampler said no, no
|
|
24
24
|
* provider registered) answers no ids — so no `traceparent` claims a trace that does not exist.
|
|
25
25
|
*/
|
|
26
|
-
export function openTelemetryTracer(tracer, { adoptActiveSpan = false } = {}) {
|
|
26
|
+
export function openTelemetryTracer(tracer, { adoptActiveSpan = false, recordExceptions = true } = {}) {
|
|
27
27
|
return {
|
|
28
28
|
start(name, options) {
|
|
29
29
|
const span = tracer.startSpan(name, {
|
|
@@ -39,7 +39,7 @@ export function openTelemetryTracer(tracer, { adoptActiveSpan = false } = {}) {
|
|
|
39
39
|
sampled: valid && (own.traceFlags & TraceFlags.SAMPLED) === TraceFlags.SAMPLED,
|
|
40
40
|
...(state ? { state } : {}),
|
|
41
41
|
set: (attributes) => void span.setAttributes(attributes),
|
|
42
|
-
end: (outcome, error) => close(span, outcome, error),
|
|
42
|
+
end: (outcome, error) => close(span, outcome, recordExceptions ? error : undefined),
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
45
|
};
|
|
@@ -63,7 +63,8 @@ function parentContextOf(parent, adoptActiveSpan) {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* How the use case ended, said the way OpenTelemetry reads it: `failed` is an error — with its
|
|
66
|
-
* exception on the span where it was raised, the only one handed it
|
|
66
|
+
* exception on the span where it was raised, the only one handed it, unless the application keeps
|
|
67
|
+
* the detail out of its traces (`recordExceptions: false`: no error is handed over) —; `refused` and `aborted`
|
|
67
68
|
* are expected answers, never an error, the way the backend leaves a refusal out of its error
|
|
68
69
|
* rate. `sincpro.outcome` (`ok` or the failure's kind), `sincpro.fault` and `error.type` are set
|
|
69
70
|
* by the run before it ends.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/client-framework",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "The client side of sincpro_framework, for every platform: Feature and ApplicationService traced and reported by default, applications made of domains, and the typed client generated from a service's contract. No React, no DOM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|