@ddd-ts-kit/tracing 0.83.4 → 0.84.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.fr.md +7 -7
- package/README.md +6 -6
- package/dist/node/init-tracing.js +1 -1
- package/package.json +7 -7
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:582c2a4a48eecd3d -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/tracing
|
|
5
5
|
|
|
@@ -54,7 +54,7 @@ builder.bind(PaymentGateway).toClass(StripePaymentGateway, [StripeClient]).as('e
|
|
|
54
54
|
## Mise en place
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
|
-
// platform/tracing.ts : importé avant tout le reste
|
|
57
|
+
// platform/observability/tracing.ts : importé avant tout le reste
|
|
58
58
|
import { initTracing } from '@ddd-ts-kit/tracing/node';
|
|
59
59
|
|
|
60
60
|
export const tracing = initTracing({ serviceName: 'clinic-api' });
|
|
@@ -62,7 +62,7 @@ export const tracing = initTracing({ serviceName: 'clinic-api' });
|
|
|
62
62
|
|
|
63
63
|
```ts
|
|
64
64
|
// main.ts
|
|
65
|
-
import { tracing } from '@/platform/tracing'; // premier import, voir « Ordre de chargement »
|
|
65
|
+
import { tracing } from '@/platform/observability/tracing'; // premier import, voir « Ordre de chargement »
|
|
66
66
|
import { createApplication, kernelModule } from '@ddd-ts-kit/di';
|
|
67
67
|
import { traceApplication, tracedPublisher, tracedRoutes } from '@ddd-ts-kit/tracing';
|
|
68
68
|
|
|
@@ -110,7 +110,7 @@ L'auto-instrumentation modifie `http` et les pilotes de base de données au mome
|
|
|
110
110
|
chargés, donc `initTracing` doit s'être exécuté avant. Dans un module ES, les imports statiques
|
|
111
111
|
sont évalués avant la première instruction du fichier : gardez l'appel dans son propre module et
|
|
112
112
|
importez ce module en premier (comme ci-dessus), ou préchargez-le avec
|
|
113
|
-
`node --import ./dist/platform/tracing.js`. Les *packages* publiés en modules ES ont aussi besoin
|
|
113
|
+
`node --import ./dist/platform/observability/tracing.js`. Les *packages* publiés en modules ES ont aussi besoin
|
|
114
114
|
du *hook* de chargement `@opentelemetry/instrumentation`.
|
|
115
115
|
|
|
116
116
|
## À quoi ressemble une trace
|
|
@@ -276,9 +276,9 @@ Les deux dernières lignes sont pour une application dont le module du noyau ne
|
|
|
276
276
|
noyau place autour de chaque liaison, et la portée d'exécution est transmise par le module, si
|
|
277
277
|
bien que le *hook* `decorate` n'ajoute rien (envelopper deux fois une instance est sans effet).
|
|
278
278
|
Un projet généré par la CLI n'a aucune des deux lignes : il appelle `traceApplication()` une fois
|
|
279
|
-
dans `src/platform/lay-foundations.ts`, `tracedRoutes()` dans
|
|
280
|
-
`src/platform/auth/http-boundary.ts`, `tracedPublisher(...)` dans
|
|
281
|
-
`src/platform/compose-application.ts`, et `initTracing` dans `src/platform/tracing.ts`. La règle
|
|
279
|
+
dans `src/platform/composition/lay-foundations.ts`, `tracedRoutes()` dans
|
|
280
|
+
`src/platform/auth/authentication/http-boundary.ts`, `tracedPublisher(...)` dans
|
|
281
|
+
`src/platform/composition/compose-application.ts`, et `initTracing` dans `src/platform/observability/tracing.ts`. La règle
|
|
282
282
|
`tracing/platform-only` garde ces imports dans le répertoire de la plateforme, `main.ts` et
|
|
283
283
|
`apps/`.
|
|
284
284
|
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ builder.bind(PaymentGateway).toClass(StripePaymentGateway, [StripeClient]).as('e
|
|
|
51
51
|
## Setup
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
|
-
// platform/tracing.ts: imported before everything else
|
|
54
|
+
// platform/observability/tracing.ts: imported before everything else
|
|
55
55
|
import { initTracing } from '@ddd-ts-kit/tracing/node';
|
|
56
56
|
|
|
57
57
|
export const tracing = initTracing({ serviceName: 'clinic-api' });
|
|
@@ -59,7 +59,7 @@ export const tracing = initTracing({ serviceName: 'clinic-api' });
|
|
|
59
59
|
|
|
60
60
|
```ts
|
|
61
61
|
// main.ts
|
|
62
|
-
import { tracing } from '@/platform/tracing'; // first import, see "Load order"
|
|
62
|
+
import { tracing } from '@/platform/observability/tracing'; // first import, see "Load order"
|
|
63
63
|
import { createApplication, kernelModule } from '@ddd-ts-kit/di';
|
|
64
64
|
import { traceApplication, tracedPublisher, tracedRoutes } from '@ddd-ts-kit/tracing';
|
|
65
65
|
|
|
@@ -106,7 +106,7 @@ either nothing is exported. Open `http://127.0.0.1:16686` and search the service
|
|
|
106
106
|
Auto-instrumentation patches `http` and the database drivers when they are loaded, so
|
|
107
107
|
`initTracing` must have run before. In an ES module the static imports are evaluated before the
|
|
108
108
|
first statement of the file: keep the call in its own module and import that module first (as
|
|
109
|
-
above), or preload it with `node --import ./dist/platform/tracing.js`. Packages published as ES
|
|
109
|
+
above), or preload it with `node --import ./dist/platform/observability/tracing.js`. Packages published as ES
|
|
110
110
|
modules also need the `@opentelemetry/instrumentation` loader hook.
|
|
111
111
|
|
|
112
112
|
## What a trace looks like
|
|
@@ -263,9 +263,9 @@ The last two lines are for an application whose kernel module is given no `instr
|
|
|
263
263
|
With it, `traceBindings()` is already the `binding` member the kernel module puts around every
|
|
264
264
|
binding and the execution scope is handed over by the module, so the `decorate` hook adds
|
|
265
265
|
nothing (wrapping an instance twice is a no-op). A project generated by the CLI has neither line: it calls
|
|
266
|
-
`traceApplication()` once in `src/platform/lay-foundations.ts`, `tracedRoutes()` in
|
|
267
|
-
`src/platform/auth/http-boundary.ts`, `tracedPublisher(...)` in
|
|
268
|
-
`src/platform/compose-application.ts`, and `initTracing` in `src/platform/tracing.ts`. The
|
|
266
|
+
`traceApplication()` once in `src/platform/composition/lay-foundations.ts`, `tracedRoutes()` in
|
|
267
|
+
`src/platform/auth/authentication/http-boundary.ts`, `tracedPublisher(...)` in
|
|
268
|
+
`src/platform/composition/compose-application.ts`, and `initTracing` in `src/platform/observability/tracing.ts`. The
|
|
269
269
|
rule `tracing/platform-only` keeps these imports in the platform directory, `main.ts` and
|
|
270
270
|
`apps/`.
|
|
271
271
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* loaded, otherwise auto-instrumentation registers too late and those modules stay
|
|
6
6
|
* unpatched. Make it the very first statement of `main.ts`. In an ES module, static
|
|
7
7
|
* imports are evaluated before the first statement, so there the call goes in a file of
|
|
8
|
-
* its own (`platform/tracing.ts`) that `main.ts` imports first, or that is preloaded
|
|
8
|
+
* its own (`platform/observability/tracing.ts`) that `main.ts` imports first, or that is preloaded
|
|
9
9
|
* with `node --import`. Packages published as ES modules additionally need the
|
|
10
10
|
* `@opentelemetry/instrumentation` loader hook; CommonJS packages and Node built-ins
|
|
11
11
|
* do not.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/tracing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.0",
|
|
4
4
|
"description": "Non-invasive OpenTelemetry tracing: adapters are wrapped at the composition root, the domain never knows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ddd-ts-kit/kernel": "0.
|
|
48
|
+
"@ddd-ts-kit/kernel": "0.84.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@ddd-ts-kit/audit": "0.
|
|
77
|
-
"@ddd-ts-kit/di": "0.
|
|
78
|
-
"@ddd-ts-kit/events": "0.
|
|
79
|
-
"@ddd-ts-kit/http": "0.
|
|
80
|
-
"@ddd-ts-kit/scheduling": "0.
|
|
76
|
+
"@ddd-ts-kit/audit": "0.84.0",
|
|
77
|
+
"@ddd-ts-kit/di": "0.84.0",
|
|
78
|
+
"@ddd-ts-kit/events": "0.84.0",
|
|
79
|
+
"@ddd-ts-kit/http": "0.84.0",
|
|
80
|
+
"@ddd-ts-kit/scheduling": "0.84.0",
|
|
81
81
|
"@opentelemetry/api": "^1.9.1",
|
|
82
82
|
"@opentelemetry/auto-instrumentations-node": "latest",
|
|
83
83
|
"@opentelemetry/context-async-hooks": "^2.0.0",
|