Skip to content

Commit 37e37cf

Browse files
committed
feat: add auto-instrumentation support for Deno
This commit adds support for auto-instrumentation in Deno, when using Deno 2.1.5 or higher and Deno was invoked with `--unstable-otel`. Deno support is disabled by default and must be explicitly enabled with `--enable-deno-instrumentation`.
1 parent 27e7271 commit 37e37cf

32 files changed

+1577
-11
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: 'enhancement'
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: 'auto-instrumentation'
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Add support for auto-instrumentation of Deno applications"
9+
10+
# One or more tracking issues related to the change
11+
issues: [3613]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: |
17+
Deno auto-instrumentation is disabled by default and must be enabled with the `--enable-deno-instrumentation` flag.
18+
OpenTelemetry support in Deno is experimental and requires Deno 2.1.5 or later, and passing of the `--unstable-otel` flag to the workload.

.github/workflows/publish-test-e2e-images.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ jobs:
5353
with:
5454
path: nodejs
5555
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
56+
deno:
57+
uses: ./.github/workflows/reusable-publish-test-e2e-images.yaml
58+
with:
59+
path: deno
60+
platforms: linux/arm64,linux/amd64
5661
metrics-basic-auth:
5762
uses: ./.github/workflows/reusable-publish-test-e2e-images.yaml
5863
with:

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ add-image-targetallocator:
190190

191191
.PHONY: add-instrumentation-params
192192
add-instrumentation-params:
193+
@$(MAKE) add-operator-arg OPERATOR_ARG=--enable-deno-instrumentation=true
193194
@$(MAKE) add-operator-arg OPERATOR_ARG=--enable-go-instrumentation=true
194195

195196
.PHONY: add-multi-instrumentation-params

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ kubectl patch serviceaccount <service-account-name> -p '{"imagePullSecrets": [{"
224224

225225
### OpenTelemetry auto-instrumentation injection
226226

227-
The operator can inject and configure OpenTelemetry auto-instrumentation libraries. Currently Apache HTTPD, DotNet, Go, Java, Nginx, NodeJS and Python are supported.
227+
The operator can inject and configure OpenTelemetry auto-instrumentation libraries. Currently Apache HTTPD, Deno, DotNet, Go, Java, Nginx, NodeJS and Python are supported.
228228

229229
To use auto-instrumentation, configure an `Instrumentation` resource with the configuration for the SDK and instrumentation.
230230

@@ -335,6 +335,14 @@ securityContext:
335335
runAsUser: 0
336336
```
337337
338+
Deno:
339+
340+
```bash
341+
instrumentation.opentelemetry.io/inject-deno: "true"
342+
```
343+
344+
OpenTelemetry in Deno is unstable, so workloads must be run with the `--unstable-otel` flag to enable OpenTelemetry support.
345+
338346
Apache HTTPD:
339347

340348
```bash
@@ -595,6 +603,7 @@ Language support can be disabled by passing the flag with a value of `false`.
595603
| Python | `enable-python-instrumentation` | `true` |
596604
| DotNet | `enable-dotnet-instrumentation` | `true` |
597605
| ApacheHttpD | `enable-apache-httpd-instrumentation` | `true` |
606+
| Deno | `enable-deno-instrumentation` | `false` |
598607
| Go | `enable-go-instrumentation` | `false` |
599608
| Nginx | `enable-nginx-instrumentation` | `false` |
600609

apis/v1alpha1/instrumentation_types.go

+13
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ type InstrumentationSpec struct {
5757
// +optional
5858
NodeJS NodeJS `json:"nodejs,omitempty"`
5959

60+
// Deno defines configuration for Deno auto-instrumentation.
61+
// +optional
62+
Deno Deno `json:"deno,omitempty"`
63+
6064
// Python defines configuration for python auto-instrumentation.
6165
// +optional
6266
Python Python `json:"python,omitempty"`
@@ -218,6 +222,15 @@ type NodeJS struct {
218222
Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"`
219223
}
220224

225+
// Deno defines Deno SDK and instrumentation configuration.
226+
type Deno struct {
227+
// Env defines deno specific env vars. There are four layers for env vars' definitions and
228+
// the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`.
229+
// If the former var had been defined, then the other vars would be ignored.
230+
// +optional
231+
Env []corev1.EnvVar `json:"env,omitempty"`
232+
}
233+
221234
// Python defines Python SDK and instrumentation configuration.
222235
type Python struct {
223236
// Image is a container image with Python SDK and auto-instrumentation.

apis/v1alpha1/zz_generated.deepcopy.go

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-01-13T10:35:38Z"
102+
createdAt: "2025-01-15T17:23:44Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

bundle/community/manifests/opentelemetry.io_instrumentations.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,75 @@ spec:
341341
useLabelsForResourceAttributes:
342342
type: boolean
343343
type: object
344+
deno:
345+
properties:
346+
env:
347+
items:
348+
properties:
349+
name:
350+
type: string
351+
value:
352+
type: string
353+
valueFrom:
354+
properties:
355+
configMapKeyRef:
356+
properties:
357+
key:
358+
type: string
359+
name:
360+
default: ""
361+
type: string
362+
optional:
363+
type: boolean
364+
required:
365+
- key
366+
type: object
367+
x-kubernetes-map-type: atomic
368+
fieldRef:
369+
properties:
370+
apiVersion:
371+
type: string
372+
fieldPath:
373+
type: string
374+
required:
375+
- fieldPath
376+
type: object
377+
x-kubernetes-map-type: atomic
378+
resourceFieldRef:
379+
properties:
380+
containerName:
381+
type: string
382+
divisor:
383+
anyOf:
384+
- type: integer
385+
- type: string
386+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
387+
x-kubernetes-int-or-string: true
388+
resource:
389+
type: string
390+
required:
391+
- resource
392+
type: object
393+
x-kubernetes-map-type: atomic
394+
secretKeyRef:
395+
properties:
396+
key:
397+
type: string
398+
name:
399+
default: ""
400+
type: string
401+
optional:
402+
type: boolean
403+
required:
404+
- key
405+
type: object
406+
x-kubernetes-map-type: atomic
407+
type: object
408+
required:
409+
- name
410+
type: object
411+
type: array
412+
type: object
344413
dotnet:
345414
properties:
346415
env:

bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-01-13T10:35:38Z"
102+
createdAt: "2025-01-15T17:23:47Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
@@ -479,6 +479,7 @@ spec:
479479
- --zap-time-encoding=rfc3339nano
480480
- --enable-nginx-instrumentation=true
481481
- --enable-go-instrumentation=true
482+
- --enable-deno-instrumentation=true
482483
- --openshift-create-dashboard=true
483484
- --feature-gates=+operator.observability.prometheus
484485
- --enable-cr-metrics=true

bundle/openshift/manifests/opentelemetry.io_instrumentations.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,75 @@ spec:
341341
useLabelsForResourceAttributes:
342342
type: boolean
343343
type: object
344+
deno:
345+
properties:
346+
env:
347+
items:
348+
properties:
349+
name:
350+
type: string
351+
value:
352+
type: string
353+
valueFrom:
354+
properties:
355+
configMapKeyRef:
356+
properties:
357+
key:
358+
type: string
359+
name:
360+
default: ""
361+
type: string
362+
optional:
363+
type: boolean
364+
required:
365+
- key
366+
type: object
367+
x-kubernetes-map-type: atomic
368+
fieldRef:
369+
properties:
370+
apiVersion:
371+
type: string
372+
fieldPath:
373+
type: string
374+
required:
375+
- fieldPath
376+
type: object
377+
x-kubernetes-map-type: atomic
378+
resourceFieldRef:
379+
properties:
380+
containerName:
381+
type: string
382+
divisor:
383+
anyOf:
384+
- type: integer
385+
- type: string
386+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
387+
x-kubernetes-int-or-string: true
388+
resource:
389+
type: string
390+
required:
391+
- resource
392+
type: object
393+
x-kubernetes-map-type: atomic
394+
secretKeyRef:
395+
properties:
396+
key:
397+
type: string
398+
name:
399+
default: ""
400+
type: string
401+
optional:
402+
type: boolean
403+
required:
404+
- key
405+
type: object
406+
x-kubernetes-map-type: atomic
407+
type: object
408+
required:
409+
- name
410+
type: object
411+
type: array
412+
type: object
344413
dotnet:
345414
properties:
346415
env:

config/crd/bases/opentelemetry.io_instrumentations.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,75 @@ spec:
339339
useLabelsForResourceAttributes:
340340
type: boolean
341341
type: object
342+
deno:
343+
properties:
344+
env:
345+
items:
346+
properties:
347+
name:
348+
type: string
349+
value:
350+
type: string
351+
valueFrom:
352+
properties:
353+
configMapKeyRef:
354+
properties:
355+
key:
356+
type: string
357+
name:
358+
default: ""
359+
type: string
360+
optional:
361+
type: boolean
362+
required:
363+
- key
364+
type: object
365+
x-kubernetes-map-type: atomic
366+
fieldRef:
367+
properties:
368+
apiVersion:
369+
type: string
370+
fieldPath:
371+
type: string
372+
required:
373+
- fieldPath
374+
type: object
375+
x-kubernetes-map-type: atomic
376+
resourceFieldRef:
377+
properties:
378+
containerName:
379+
type: string
380+
divisor:
381+
anyOf:
382+
- type: integer
383+
- type: string
384+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
385+
x-kubernetes-int-or-string: true
386+
resource:
387+
type: string
388+
required:
389+
- resource
390+
type: object
391+
x-kubernetes-map-type: atomic
392+
secretKeyRef:
393+
properties:
394+
key:
395+
type: string
396+
name:
397+
default: ""
398+
type: string
399+
optional:
400+
type: boolean
401+
required:
402+
- key
403+
type: object
404+
x-kubernetes-map-type: atomic
405+
type: object
406+
required:
407+
- name
408+
type: object
409+
type: array
410+
type: object
342411
dotnet:
343412
properties:
344413
env:

config/overlays/openshift/manager-patch.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- --zap-time-encoding=rfc3339nano
88
- --enable-nginx-instrumentation=true
99
- '--enable-go-instrumentation=true'
10+
- '--enable-deno-instrumentation=true'
1011
- '--openshift-create-dashboard=true'
1112
- '--feature-gates=+operator.observability.prometheus'
1213
- '--enable-cr-metrics=true'

0 commit comments

Comments
 (0)