Skip to content

Commit

Permalink
fixing some build errors (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc authored Oct 2, 2024
1 parent 4e8d9bd commit c06f8c6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Command;
namespace OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Command;

use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\StatusCode;
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/CakePHP/src/Hooks/Cake/Http/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function instrument(): void
$route = $this->getRouteTemplate($request);
$span = \OpenTelemetry\API\Trace\Span::fromContext($scope->context());

if($route && $this->isRoot()) {
if ($route && $this->isRoot()) {
$span->setAttribute(TraceAttributes::HTTP_ROUTE, $route);
}
if ($exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@
'skipLog' => [],
'log' => true,
'trace' => true,
'ignoredDeprecationPaths' => [],
'ignoredDeprecationPaths' => [
'/src/I18n/I18n.php',
],
],

/*
Expand Down
2 changes: 2 additions & 0 deletions src/Instrumentation/Laravel/src/Watchers/LogWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

use Illuminate\Contracts\Foundation\Application;
use Illuminate\Log\Events\MessageLogged;
use Illuminate\Log\LogManager;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Logs\LogRecord;
use OpenTelemetry\API\Logs\Map\Psr3;

class LogWatcher extends Watcher
{
private LogManager $logger;
public function __construct(
private CachedInstrumentation $instrumentation,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private function createMemoryCacheAdapter(): CacheInterface

protected function checkKey(string $key):string
{
if(empty($key)) {
if (empty($key)) {
throw new \InvalidArgumentException('cache key is empty');
}

Expand All @@ -213,11 +213,11 @@ protected function checkKey(string $key):string

protected function getTTL(DateInterval|int|null $ttl):?int
{
if($ttl instanceof DateInterval) {
if ($ttl instanceof DateInterval) {
return ((new DateTime())->add($ttl)->getTimeStamp() - time());
}

if((is_int($ttl) && $ttl > 0)) {
if ((is_int($ttl) && $ttl > 0)) {
return $ttl;
}

Expand All @@ -226,7 +226,7 @@ protected function getTTL(DateInterval|int|null $ttl):?int

protected function fromIterable(iterable $data): array
{
if(is_array($data)) {
if (is_array($data)) {
return $data;
}

Expand All @@ -235,8 +235,8 @@ protected function fromIterable(iterable $data): array

protected function checkReturn(array $booleans): bool
{
foreach($booleans as $boolean) {
if(!(bool) $boolean) {
foreach ($booleans as $boolean) {
if (!(bool) $boolean) {
return false;
}
}
Expand All @@ -248,8 +248,8 @@ public function get(string $key, mixed $default = null): mixed
{
$key = $this->checkKey($key);

if(isset($this->data[$key])) {
if($this->data[$key]['ttl'] === null || $this->data[$key]['ttl'] > time()) {
if (isset($this->data[$key])) {
if ($this->data[$key]['ttl'] === null || $this->data[$key]['ttl'] > time()) {
return $this->data[$key]['content'];
}

Expand All @@ -263,7 +263,7 @@ public function set(string $key, mixed $value, null|int|\DateInterval $ttl = nul
{
$ttl = $this->getTTL($ttl);

if($ttl !== null) {
if ($ttl !== null) {
$ttl = (time() + $ttl);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private function createMemoryCacheAdapter(): CacheItemPoolInterface

protected function checkKey(string $key):string
{
if(empty($key)) {
if (empty($key)) {
throw new \InvalidArgumentException('cache key is empty');
}

Expand Down

0 comments on commit c06f8c6

Please sign in to comment.