open-telemetry / opentelemetry-php

The OpenTelemetry PHP Library
https://opentelemetry.io/docs/instrumentation/php/
Apache License 2.0
691 stars 172 forks source link

Bring auto-instrumentation to OpenTelemetry K8s Operator #932

Open svrnm opened 1 year ago

svrnm commented 1 year ago

Is your feature request related to a problem?

With auto instrumentation for PHP being a thing, there is an opportunity to bring it to applications running in K8s clusters via the otel k8s operator automatically.

Describe the solution you'd like Similar to other languages it would be great to be able to turn on injection of auto instrumentation for PHP, e.g. create an Instrumentation resource that configures the auto instrumentation (copied from python):

apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
  name: demo-instrumentation
spec:
  exporter:
    endpoint: http://demo-collector:4318
  propagators:
    - tracecontext
    - baggage
  python:
    env:
      - name: OTEL_PHP_...
        value: ...

and add an annotation to deployments:

instrumentation.opentelemetry.io/inject-php: "true"

This would require the creation of an init container, similar to the existing ones:

https://github.com/open-telemetry/opentelemetry-operator/tree/main/autoinstrumentation

and a instrumentationphp.go at

https://github.com/open-telemetry/opentelemetry-operator/tree/main/pkg/instrumentation

cc @open-telemetry/operator-approvers

Additional context Existing injection for other languages: https://opentelemetry.io/docs/k8s-operator/automatic/

frzifus commented 1 year ago

Sounds like a great idea. :) Do you want to move this issue to the Operator repo?

svrnm commented 1 year ago

I raised it here because @bobstrecansky asked me so the PHP SIG can investigate & prioritize. Maybe both repos should have one issue and we link them?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 11 months ago

This issue has been automatically closed because it has not had recent activity, but it can be reopened. Thank you for your contributions.

cedricziel commented 7 months ago

I see value in injecting the extension, do you also want to inject the instrumentation code?

svrnm commented 7 months ago

I see value in injecting the extension, do you also want to inject the instrumentation code?

What ever makes an application emit telemetry automatically, so yes, if it is possible to inject that as well safely (e.g. Node.js is doing it that way)