instana / otel-shop

OpenTelemetry Demo App
Apache License 2.0
17 stars 12 forks source link

php.WARNING: Uncaught User Notice: Class "OpenTelemetry\SDK\SystemClock " is deprecated and will be removed in a future release #270

Closed esara closed 2 years ago

esara commented 2 years ago

This is just a function of the alpha version of the opentelemetry php library, but unfortunately it throws exceptions for depracation warnings, which seems to break the ratings service

$ oc logs -f -n otel-shop otel-shop-ratings-566cb8d56b-d2sfg
[2022-05-24T11:26:56.923220+00:00] php.WARNING: Uncaught User Notice: Class "OpenTelemetry\SDK\SystemClock " is deprecated and will be removed in a future release. Please, use "OpenTelemetry\SDK\Common\Time\SystemClock" instead. {"exception":"[object] (ErrorException(code: 0): User Notice: Class \"OpenTelemetry\\SDK\\SystemClock \" is deprecated and will be removed in a future release. Please, use \"OpenTelemetry\\SDK\\Common\\Time\\SystemClock\" instead. at /var/www/html/vendor/open-telemetry/opentelemetry/src/SDK/Common/Dev/Compatibility/Util.php:51)\n[previous exception] [object] (ErrorException(code: 0): User Notice: Class \"OpenTelemetry\\SDK\\SystemClock \" is deprecated and will be removed in a future release. Please, use \"OpenTelemetry\\SDK\\Common\\Time\\SystemClock\" instead. at /var/www/html/vendor/open-telemetry/opentelemetry/src/SDK/Common/Dev/Compatibility/Util.php:51)"} []
$ oc get pods -n otel-shop otel-shop-ratings-566cb8d56b-d2sfg
NAME                                 READY   STATUS    RESTARTS   AGE
otel-shop-ratings-566cb8d56b-d2sfg   0/1     Running   0          46m

https://github.com/open-telemetry/opentelemetry-php/commit/99fba0d720785dfe9faba310e6e2e78fae9c075d

esara commented 2 years ago

fortunately, there an easy fix for this

$ git diff
diff --git a/ratings/html/index.php b/ratings/html/index.php
index 2b34782..11ad0d2 100644
--- a/ratings/html/index.php
+++ b/ratings/html/index.php
@@ -6,7 +6,7 @@ require __DIR__.'/vendor/autoload.php';

 use Instana\RobotShop\Ratings\Kernel;
 use Symfony\Component\HttpFoundation\Request;
-
+OpenTelemetry\SDK\Common\Dev\Compatibility\Util::setErrorLevel(0)
 $env = getenv('APP_ENV') ?: 'dev';
 $kernel = new Kernel($env, true);
 $request = Request::createFromGlobals();

$ oc get pods -n otel-shop otel-shop-ratings-5df6d88fb4-9f55j 
NAME                                 READY   STATUS    RESTARTS   AGE
otel-shop-ratings-5df6d88fb4-9f55j   1/1     Running   0          43s

would you like me to create a PR - while this is still in alpha, so the service comes up ready?