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
@@ -44,11 +44,11 @@ To set up tracing of Workflows and Activities, use our `opentelemetry-intercepto
44
44
45
45
```typescript
46
46
telemetryOptions: {
47
-
metrics: {
48
-
prometheus: { bindAddress: '0.0.0.0:9464' },
49
-
},
50
-
logging: { forward: { level: 'DEBUG' } },
47
+
metrics: {
48
+
prometheus: { bindAddress: '0.0.0.0:9464' },
51
49
},
50
+
logging: { forward: { level: 'DEBUG' } },
51
+
},
52
52
```
53
53
54
54
## Set up tracing {/* #tracing */}
@@ -96,7 +96,7 @@ To extend the default ([Trace Context](https://github.com/open-telemetry/opentel
96
96
97
97
Similarly, you can customize the OpenTelemetry `NodeSDK` propagators by following the instructions in the [Initialize the SDK](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node#initialize-the-sdk) section of the `README.md` file.
98
98
99
-
## Log from a Workflow{/* #logging */}
99
+
## Set up Logging{/* #logging */}
100
100
101
101
Logging enables you to record critical information during code execution.
102
102
Loggers create an audit trail and capture information about your Workflow's operation.
// The following block is optional, but generally desired.
245
253
// It allows capturing log messages emitted by the underlying Temporal Core SDK (native code).
246
254
// The Telemetry Filter String determine the desired verboseness of messages emitted by the
@@ -254,120 +262,8 @@ Runtime.install({
254
262
});
255
263
```
256
264
257
-
{/* FIXME(JWH): Everything below this point must be revisited and moved to a distinct section (Sinks). */}
258
-
259
-
### Implementing custom Logging-like features based on Workflow Sinks
260
-
261
-
Sinks enable one-way export of logs, metrics, and traces from the Workflow isolate to the Node.js environment.
262
-
263
-
{/*
264
-
Workflows in Temporal may be replayed from the beginning of their history when resumed. In order for Temporal to recreate the exact state Workflow code was in, the code is required to be fully deterministic. To prevent breaking determinism, in the TypeScript SDK, Workflow code runs in an isolated execution environment and may not use any of the Node.js APIs or communicate directly with the outside world. */}
265
-
266
-
Sinks are written as objects with methods.
267
-
Similar to Activities, they are declared in the Worker and then proxied in Workflow code, and it helps to share types between both.
268
-
269
-
#### Comparing Sinks and Activities
270
-
271
-
Sinks are similar to Activities in that they are both registered on the Worker and proxied into the Workflow.
272
-
However, they differ from Activities in important ways:
273
-
274
-
- A sink function doesn't return any value back to the Workflow and cannot be awaited.
275
-
- A sink call isn't recorded in the Event History of a Workflow Execution (no timeouts or retries).
276
-
- A sink function _always_ runs on the same Worker that runs the Workflow Execution it's called from.
277
-
278
-
#### Declare the sink interface
279
-
280
-
Explicitly declaring a sink's interface is optional but is useful for ensuring type safety in subsequent steps:
### How to provide a custom logger {/* #custom-logger */}
368
266
369
-
Useacustomloggerforlogging.
370
-
371
267
#### Logging in Workers and Clients
372
268
373
269
The Worker comes with a default logger, which defaults to log any messages with level `INFO` and higher to `STDERR` using `console.error`.
@@ -405,14 +301,26 @@ logger.error('go');
405
301
A common logging use case is logging to a file to be picked up by a collector like the [Datadog Agent](https://docs.datadoghq.com/logs/log_collection/nodejs/?tab=winston30).
Workflows in Temporal may be replayed from the beginning of their history when resumed. In order for Temporal to recreate the exact state Workflow code was in, the code is required to be fully deterministic. To prevent breaking determinism, in the TypeScript SDK, Workflow code runs in an isolated execution environment and may not use any of the Node.js APIs or communicate directly with the outside world. */}
0 commit comments