Support auto-instrumentation

Created on 14 March 2023, over 1 year ago

Problem/Motivation

There is now auto-instrumentation support for opentelemetry https://github.com/open-telemetry/opentelemetry-php-instrumentation

This makes it possible to add instrumentation hooks around core module code without having to add SDK code directly to Drupal core.

This module can provide generic hook implementations that would work on all Drupal sites.

Examples of what we can do:

  • DrupalKernel
  • Cache bins
  • KeyValue store
  • Renderer
  • Guzzle Client (?)
  • PDO layer

Basically enough useful information for tracing a typical Drupal app. Users can add their own custom tracing via custom modules.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia kim.pepper πŸ„β€β™‚οΈπŸ‡¦πŸ‡ΊSydney, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kim.pepper
  • Status changed to Needs work over 1 year ago
  • πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

    I've implemented a dummy plugin here https://git.drupalcode.org/project/opentelemetry/-/blob/1.0.x/src/Plugin... that just checks the requirements for now.
    The next step is to make it do the real work with auto-instrumentation.

  • First commit to issue fork.
  • πŸ‡³πŸ‡±Netherlands euphoric_mv

    Hello @Murz.

    I am currently implementing auto-instrumentation on one of our projects, it works fine, so I would like to create a fork and push it next week. I will push it without tests, so you can have just a picture of how it works. Once we agree on an approach, I will add some tests.

  • πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

    Good to know, thank you, will wait for your contribution to review! Wanted to do it by myself, but still very busy at work and have no time.

  • Hi @euphoric_mv, @Murz,

    Can you please let me know the implementation of Auto instrumentation with drupal 10, php 8.1.

    I have already enabled opentelemetry extension, what else is required for enabling auto instrumentation.

    Thanks!

  • πŸ‡³πŸ‡±Netherlands euphoric_mv

    Hi @sudhanjs

    Thank you for the reminder. I am working on a porting solution that I implemented in the project in this a contrib module. I will create PR and let you know guys to review it.

  • πŸ‡³πŸ‡±Netherlands euphoric_mv

    I'm trying to fork the project, but no success. Does anyone has the same problem?

  • Status changed to Active 10 months ago
  • πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

    In other issues, I see other folks have no problem with forking.
    @euphoric_mv, could you please describe more details about your problems with forking?

  • πŸ‡«πŸ‡·France andypost

    Used to hack a bit this auto-instrumentation but since OT 1.1 Fibers require to pass context...

    So would be great to unify approach about sharing data between module's service and static context for auto-instrumentation.

    There's workaround for Fibers in docs but having ZTS+ffi PHP only for tracing reasons IMO overkill

  • πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

    By the way, I got an issue with Fibers after updating to the new OpenTelemetry libraries (1.1+), because they conflict with Drupal Fibers, used in the Renderer service.

    So for now I just disabled them, and will investigate the issue later, here is the task: πŸ“Œ Make OpenTelemetry work with FiberBoundContextStorage Active

Production build 0.71.5 2024