elastic / elastic/apm-agent-nodejs

apm nodejs agent cannot cp: can't stat '/autoinstrumentation/.'

Open
#4,727 0 comments 0 reactions 0 assignees View on GitHub
community triage
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

**Describe the bug**

From [Elastic migrate from apm attacher to EDOT](https://www.elastic.co/docs/reference/opentelemetry/use-cases/kubernetes/instrumenting-applications#migrate-from-the-elastic-apm-attacher-for-kubernetes), it was mentioned that using the original APM agent for Node.js should still work. However, after following the guide, the pod is initializing but encountering an error 'cp: can't stat '/autoinstrumentation/.': No such file or directory'. It appears that the APM agent for Node.js is missing the expected autoinstrumentation directory.

**To Reproduce**

Steps to reproduce the behavior:
1. Applied the Instrumentation config
```yaml
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: elastic-apm-instrumentation
namespace: system
spec:
exporter:
endpoint: http://opentelemetry-kube-stack-daemon-collector.opentelemetry.svc.cluster.local:4318
java:
image: docker.elastic.co/observability/apm-agent-java:1.53.0
env:
- name: ELASTIC_APM_SERVER_URL
value: "xxx"
- name: ELASTIC_APM_API_KEY
value: "xxx"
- name: ELASTIC_APM_ENVIRONMENT
value: "STAGING"
- name: ELASTIC_APM_LOG_SENDING
value: "true"
- name: ELASTIC_APM_LOG_LEVEL
value: "info"
nodejs:
image: docker.elastic.co/observability/apm-agent-nodejs:4.13.0
env:
- name: ELASTIC_APM_SERVER_URL
value: "xxx"
- name: ELASTIC_APM_API_KEY
value: "xxx"
- name: ELASTIC_APM_CAPTURE_BODY
value: "all"
- name: ELASTIC_APM_LOG_LEVEL
value: "trace"
```
2. add annotation: instrumentation.opentelemetry.io/inject-nodejs: "system/elastic-apm-instrumentation"
3. pod initing get error "cp: can't stat '/autoinstrumentation/.': No such file or directory"

**Expected behavior**

It can see log in APM

**Environment (please complete the following information)**

- OS: Linux/ AWS EKS
- Node.js version: 20
- APM Server version: 8.18.0
- Agent version: 4.13.0

**How are you starting the agent? (please tick one of the boxes)**

K8s auto-instrumentation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.