elastic / elastic/elastic-otel-php

Kubernetes (K8s) Zero-code Instrumentation for PHP: vanilla and then Elastic

Open
#97 1 comment 0 reactions 1 assignee Claimed by @SergeyKleyman View on GitHub
enhancement
Dominant language
Shell
Stars
15
Forks
9
Avg merge
1d 23h
Merged PRs (30d)
1

Description

# Implementation progress

## Done

### Verify that approach based on setting environment variables and mounted volume indeed works
Use the approach described at https://github.com/open-telemetry/opentelemetry-php/issues/932#issuecomment-2356402000 based on [`PHP_INI_SCAN_DIR` environment variable](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan) to inject EDOT for PHP

Test it on applications
- CLI
- PHP-FPM
- Apache + mod_php

### Verify the POC on Elastic APM Attacher

It's simpler to verify that the approach based on setting environment variables and mounted volume indeed works in k8s setup using our Elastic APM k8s Attacher instead of OpenTelemtry K8x operator because Elastic APM k8s Attacher is much easier to setup and make temporary changes just for this POC.

By following instructions at https://www.elastic.co/guide/en/apm/attacher/current/apm-attacher.html
- Add support for injecting EDOT PHP using [`PHP_INI_SCAN_DIR` environment variable](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan) to Elastic APM K8s Attacher
- Install modified Elastic APM K8s Attacher
- Verify that EDOT PHP automatically instruments test application and sends data to the backend

## In progress

### Extended implementation to OpenTelemetry Operator for Kubernetes

Follow steps at https://github.com/open-telemetry/opentelemetry-operator/blob/main/CONTRIBUTING.md#deployment-with-webhooks
I am currently at the step "[Using a private container registry](https://github.com/open-telemetry/opentelemetry-operator/blob/main/CONTRIBUTING.md#using-a-private-container-registry)" to deploy container with EDOT PHP files that updated OTel k8s operator can pull and inject into application container.

### Extended implementation to vanilla OTel PHP distribution using `auto_prepend_file` similar to
[WordPress instrumentation's approach](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/Wordpress)

### Contribute implementation upstream

Opened PR (https://github.com/open-telemetry/opentelemetry-operator/pull/3331) at https://github.com/open-telemetry/opentelemetry-operator/

- The reviewers asked to split the original PR into parts
- The PR (https://github.com/open-telemetry/opentelemetry-operator/pull/3409) with the first part of this feature (which is publishing the image) was recently merged.
- I started working on a PR for the next part

## TODO

### Publish docker image with EDOT that can be used with OTel K8s operator

### Update Elastic docs

On how to monitor PHP applications using OpenTelemetry Operator for Kubernetes + PHP

### Update instructions shipped with Kibana

On how to monitor PHP applications using OpenTelemetry Operator for Kubernetes + PHP

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.