Skip to content

Commit 50b3598

Browse files
committed
[Operator] Add docs for instrumenting Deno
1 parent 3fd0bb5 commit 50b3598

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

content/en/docs/kubernetes/operator/automatic.md

+71-1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,67 @@ spec:
180180
181181
For more details, see [.NET Auto Instrumentation docs](/docs/zero-code/net/).
182182
183+
### Deno
184+
185+
The following command creates a basic Instrumentation resource that is
186+
configured for instrumenting Deno services.
187+
188+
```bash
189+
kubectl apply -f - <<EOF
190+
apiVersion: opentelemetry.io/v1alpha1
191+
kind: Instrumentation
192+
metadata:
193+
name: demo-instrumentation
194+
spec:
195+
env:
196+
- name: OTEL_DENO
197+
value: 'true'
198+
exporter:
199+
endpoint: http://demo-collector:4318
200+
propagators:
201+
- tracecontext
202+
- baggage
203+
sampler:
204+
type: parentbased_traceidratio
205+
argument: '1'
206+
EOF
207+
```
208+
209+
Deno processes automatically export telemetry data to the configured endpoint
210+
when they are started with the `OTEL_DENO=true` environment variable. Therefore,
211+
the example specifies this environment variable in the `env` field of the
212+
Instrumentation resource, so it is set for all services that have env vars
213+
injected with this Instrumentation resource.
214+
215+
By default, the Instrumentation resource that auto-instruments Deno services
216+
uses `otlp` with the `http/proto` protocol. This means that the configured
217+
endpoint must be able to receive OTLP over `http/proto`. Therefore, the example
218+
uses `http://demo-collector:4318`, which connects to the `http/proto` port of
219+
the `otlpreceiver` of the Collector created in the previous step.
220+
221+
{{% alert title="Note" color="info" %}}
222+
223+
Deno's OpenTelemetry integration is not yet stable. As a result all workloads
224+
that want to be instrumented with Deno must have the `--unstable-otel` flag set
225+
when starting the Deno process.
226+
227+
{{% /alert %}}
228+
229+
#### Configuring console.log capturing in Deno
230+
231+
By default, the Deno OpenTelemetry integration captures `console.log` output as
232+
logs, while still printing the logs to stdout / stderr. There are two other
233+
behaviours that can be configured:
234+
235+
- `OTEL_DENO_CONSOLE=replace`: capture `console.log` output as logs and do not
236+
print to stdout / stderr.
237+
- `OTEL_DENO_CONSOLE=ignore`: do not capture `console.log` output as logs.
238+
239+
#### Learn more {#deno-learn-more}
240+
241+
For more details, see
242+
[Deno's documentation on the OpenTelemetry integration](https://docs.deno.com/runtime/fundamentals/open_telemetry/).
243+
183244
### Java
184245

185246
The following command creates a basic Instrumentation resource that is
@@ -483,6 +544,7 @@ done by updating your service’s `spec.template.metadata.annotations` to includ
483544
a language-specific annotation:
484545

485546
- .NET: `instrumentation.opentelemetry.io/inject-dotnet: "true"`
547+
- Deno: `instrumentation.opentelemetry.io/inject-sdk: "true"`
486548
- Go: `instrumentation.opentelemetry.io/inject-go: "true"`
487549
- Java: `instrumentation.opentelemetry.io/inject-java: "true"`
488550
- Node.js: `instrumentation.opentelemetry.io/inject-nodejs: "true"`
@@ -684,13 +746,21 @@ Here are a few things to check for:
684746
- **Is the auto-instrumentation for the right language?** For example, when
685747
instrumenting a Python application, make sure that the annotation doesn't
686748
incorrectly say `instrumentation.opentelemetry.io/inject-java: "true"`
687-
instead.
749+
instead.
688750
- **Is the auto-instrumentation annotation in the correct location?** When
689751
defining a `Deployment`, annotations can be added in one of two locations:
690752
`spec.metadata.annotations`, and `spec.template.metadata.annotations`. The
691753
auto-instrumentation annotation needs to be added to
692754
`spec.template.metadata.annotations`, otherwise it won’t work.
693755

756+
{{% alert title="Note" color="info" %}}
757+
758+
Note that unlike other auto-instrumentation, the Deno auto-instrumentation uses
759+
the `instrumentation.opentelemetry.io/inject-sdk: "true"` annotation, not an
760+
annotation that contains the string `deno`.
761+
762+
{{% /alert %}}
763+
694764
### Was the auto-instrumentation endpoint configured correctly?
695765

696766
The `spec.exporter.endpoint` attribute of the `Instrumentation` resource defines

0 commit comments

Comments
 (0)