Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring auto-instrumentation to OpenTelemetry K8s Operator #932

Open
svrnm opened this issue Mar 1, 2023 · 8 comments · May be fixed by open-telemetry/opentelemetry-operator#3331
Open

Bring auto-instrumentation to OpenTelemetry K8s Operator #932

svrnm opened this issue Mar 1, 2023 · 8 comments · May be fixed by open-telemetry/opentelemetry-operator#3331
Labels
pinned Will not be removed by stalebot

Comments

@svrnm
Copy link
Member

svrnm commented Mar 1, 2023

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
Copy link
Member

frzifus commented Mar 3, 2023

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

@svrnm
Copy link
Member Author

svrnm commented Mar 6, 2023

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
Copy link

stale bot commented Jun 18, 2023

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 stale bot added the stale This issue didn't have recent activity label Jun 18, 2023
@stale
Copy link

stale bot commented Aug 12, 2023

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

@stale stale bot closed this as completed Aug 12, 2023
@brettmc brettmc added pinned Will not be removed by stalebot and removed stale This issue didn't have recent activity labels Aug 13, 2023
@brettmc brettmc reopened this Aug 13, 2023
@cedricziel
Copy link
Contributor

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

@svrnm
Copy link
Member Author

svrnm commented Nov 28, 2023

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)

@SergeyKleyman
Copy link

I would like to investigate technical feasibility of this feature. The current plan is use PHP_INI_SCAN_DIR environment variable - by mounting the volume with the extension binaries (I am not sure if automatic detection of target OS distro is possible - it seems .NET support manual config) and PHP .ini file pointing the extension binary and finally setting PHP_INI_SCAN_DIR so it contains the directory for that mounted volume. I assume instrumentations will need to be packaged into the same container together with binaries for the supported target OS distros.

I am not 100% sure how to automatically load instrumentations without requiring to modify application's composer.json - maybe something similar to WordPress instrumentation's approach with auto_prepend_file can be used?

If there is anybody thinking about starting or already started working on it - I will be glad to cooperate.

@brettmc
Copy link
Collaborator

brettmc commented Sep 18, 2024

I would like to investigate technical feasibility of this feature.

This is something I could get excited about, and would love to pitch in and help if I can. Regarding loading instrumentations, I think that auto_prepend_file is a sensible first attempt, and I'm also supportive of updating any part of opentelemetry-php to enable this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Will not be removed by stalebot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants