Opentelemetry not working in drupal 9

Created on 28 July 2023, 11 months ago
Updated 10 October 2023, 9 months ago

Queries:

We are unable to use module(Install) Opentelemetry in drupal 9 and showing the error attached in the screenshot.

Problem 1
- drupal/opentelemetry 1.0.0-alpha1 requires drupal/core ^10 -> found drupal/core[10.0.0, ..., 10.1.1] but the package is fixed to 9.5.9 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- drupal/opentelemetry[1.0.0-alpha2, ..., 1.0.0-alpha6] require open-telemetry/sdk ^1.0.0beta5 -> found open-telemetry/sdk[dev-main, 1.0.0beta5, ..., 1.0.x-dev (alias of dev-main)] but it does not match your minimum-stability.
- Root composer.json requires drupal/opentelemetry ^1.0@alpha -> satisfiable by drupal/opentelemetry[1.0.0-alpha1, ..., 1.0.0-alpha6].

Problem 2
- Root composer.json requires drupal/opentelemetry 1.0@alpha, found drupal/opentelemetry[dev-1.0.x, 1.0.0-alpha1,
..., 1.0.x-dev (alias of dev-1.0.x)] but it does not match the constraint.

💬 Support request
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @sudhanjs
  • 🇦🇲Armenia Murz Yerevan, Armenia

    Seems this is because your composer is configured to restrict unstable versions (like alpha), try to do this:

    composer config minimum-stability dev
    composer config prefer-stable true

    and repeat the installation, hope it should help.

  • Hi Murz, Thanks for the quick response, We have tried with the commands provided and still the same error persist.

    Root composer.json requires drupal/opentelemetry 1.0@alpha, found drupal/opentelemetry[dev-1.0.x, 1.0.0-alpha1,
    ..., 1.0.x-dev (alias of dev-1.0.x)] but it does not match the constraint.

    Currently im trying to use the module in version DRUPAL 9.5.10 and PHP 8.1

    Is there any other constrains that restrict or block the module from download ?

    Also please let me know after installing the module where the data that are tracked by opentelemetry will be getting saved. Will it be inside our Drupal site DB or telemetry backend services like Jaeger, Zipkin, Prometheus, etc.

  • Status changed to Postponed: needs info 11 months ago
  • 🇦🇲Armenia Murz Yerevan, Armenia

    I've tested on DRUPAL 9.5.10 and PHP 8.1 and for me it installs well, here are the commands:

    $ composer create-project drupal/recommended-project:9.5.10 my_site_name_dir
    $ cd my_site_name_dir/
    $ composer config minimum-stability dev
    $ composer config prefer-stable true
    $ composer require 'drupal/opentelemetry:^1.0@alpha'
    

    So seems there is a problem on your setup.

    Also please let me know after installing the module where the data that are tracked by opentelemetry will be getting saved. Will it be inside our Drupal site DB or telemetry backend services like Jaeger, Zipkin, Prometheus, etc.

    You have to have an OpenTelemetry collector instance to get the telemetry traces, like Grafana Tempo, Jaeger Zipkin.

    You can try to use ddev project with my Grafana extension: https://github.com/MurzNN/ddev-grafana - see "Local configuration quick start" chapter here https://git.drupalcode.org/project/opentelemetry/-/blob/1.0.x/README.md

  • Hi @Murz,

    While enabling the module i am facing the below error, Any solution for resolving it?

    Uncaught PHP Exception Error: "Class "OpenTelemetry\\API\\Common\\Log\\LoggerHolder" not found" at /opt/drupal/web/modules/contrib/opentelemetry/src/OpentelemetryTracerService.php line 122.

  • 🇦🇲Armenia Murz Yerevan, Armenia

    @sudhanjs Seems that the opentelemetry base package is not installed.
    Please check that the https://packagist.org/packages/open-telemetry/api package is installed in your project.
    It should be installed automatically with composer require 'drupal/opentelemetry:^1.0@alpha'
    If not, try to install it (and others) manually:

    composer require google/protobuf open-telemetry/sdk open-telemetry/exporter-otlp open-telemetry/opentelemetry-propagation-traceresponse
    
  • Hi @Murz

    While installing i can able to witness that the following packages are getting installed properly:
    - Installing php-http/discovery (1.19.1): Extracting archive
    - Installing symfony/polyfill-php82 (v1.28.0): Extracting archive
    - Installing open-telemetry/sem-conv (1.0.0beta4): Extracting archive
    - Installing open-telemetry/context (1.0.0beta5): Extracting archive
    - Installing open-telemetry/api (1.0.0beta12): Extracting archive
    - Installing open-telemetry/sdk (1.0.0beta16): Extracting archive
    - Installing open-telemetry/opentelemetry-propagation-traceresponse (0.0.1): Extracting archive
    - Installing google/protobuf (v3.24.2): Extracting archive
    - Installing open-telemetry/gen-otlp-protobuf (1.0.0beta6): Extracting archive
    - Installing open-telemetry/exporter-otlp (1.0.0beta13): Extracting archive
    - Installing drupal/opentelemetry (1.0.0-alpha6): Extracting archive

    But when i try to enable the module facing the below issue :
    Uncaught PHP Exception Error: "Class "OpenTelemetry\\API\\Common\\Log\\LoggerHolder" not found" at /opt/drupal/web/modules/contrib/opentelemetry/src/OpentelemetryTracerService.php line 122

    Is there any other check i should do while installing or enabling? or any solution?

  • Hi @Murz,

    I have installed the opentelemetry module and when i try to enable the module with export protocol as grpc i am receiving the error below:

    Uncaught PHP Exception RuntimeException: "Transport factory not defined for protocol: grpc" at /opt/drupal/vendor/open-telemetry/sdk/Registry.php line 162, referer: http://localhost:81/admin/config/development/opentelemetry
    [Fri Sep 01 09:22:55.014327 2023] [php:notice] [pid 45] [client 172.21.0.1:52326] RuntimeException: Transport factory not defined for protocol: grpc in /opt/drupal/vendor/open-telemetry/sdk/Registry.php on line 162 #0 /opt/drupal/vendor/open-telemetry/exporter-otlp/SpanExporterFactory.php(53): OpenTelemetry\\SDK\\Registry::transportFactory('grpc')\n#1 /opt/drupal/vendor/open-telemetry/exporter-otlp/SpanExporterFactory.php(36): OpenTelemetry\\Contrib\\Otlp\\SpanExporterFactory->buildTransport()\n#2 /opt/drupal/web/modules/contrib/opentelemetry/src/OpenTelemetrySpanExporterFactory.php(67): OpenTelemetry\\Contrib\\Otlp\\SpanExporterFactory->create()\n#3 [internal function]: Drupal\\opentelemetry\\OpenTelemetrySpanExporterFactory->create()\n#4 /opt/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(255): call_user_func_array(Array, Array)\n#5 /opt/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\\Component\\DependencyInjection\\Container->createService(Array, 'OpenTelemetry\\\\C...')\n#6 /opt/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(440): Drupal\\Component\\DependencyInjection\\Container->get('OpenTelemetry\\\\C...', 1)\n#7 /opt/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(237):

    Any solution or fix for this issue?

  • 🇦🇲Armenia Murz Yerevan, Armenia

    For GRPC you should have the "ext-grpc" PHP extension enabled, and install the transport via:

    composer require open-telemetry/transport-grpc
    

    It should resolve the issue.

    If this is not possible, try to use the HTTP endpoint.

    I will provide a separate submodule to handle this dependency in next versions.

  • 🇦🇲Armenia Murz Yerevan, Armenia

    I found out the source of the error: "Class "OpenTelemetry\\API\\Common\\Log\\LoggerHolder" not found" - it's because opentelemetry-php in the 1.0.0beta10 release made a breaking change. More details and the fix are in the issue 📌 Upgrade opentelemetry-php dependencies to 1.0.0RC1 Fixed .

  • Status changed to Closed: duplicate 9 months ago
  • 🇦🇲Armenia Murz Yerevan, Armenia

    The fix is merged, closing the issue.

Production build 0.69.0 2024