Skip to content

Commit

Permalink
chore: update latest versions (#3065)
Browse files Browse the repository at this point in the history
* chore: update latest versions

* tests: Latest Predis Version

* tests: Setup `test_integrations_predis_[1|latest]`

* fix: Replace object key by Predis Connection

---------

Co-authored-by: PROFeNoM <[email protected]>
Co-authored-by: Alexandre Choura <[email protected]>
  • Loading branch information
3 people authored Feb 4, 2025
1 parent c11372f commit f157156
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 15 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ TEST_INTEGRATIONS_70 := \
test_integrations_phpredis3 \
test_integrations_phpredis4 \
test_integrations_phpredis5 \
test_integrations_predis_latest \
test_integrations_predis_1 \
test_integrations_sqlsrv

TEST_WEB_70 := \
Expand Down Expand Up @@ -602,7 +602,7 @@ TEST_INTEGRATIONS_71 := \
test_integrations_phpredis3 \
test_integrations_phpredis4 \
test_integrations_phpredis5 \
test_integrations_predis_latest \
test_integrations_predis_1 \
test_integrations_sqlsrv \
test_opentracing_10

Expand Down Expand Up @@ -655,6 +655,7 @@ TEST_INTEGRATIONS_72 := \
test_integrations_phpredis3 \
test_integrations_phpredis4 \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_sqlsrv \
test_opentracing_10
Expand Down Expand Up @@ -714,6 +715,7 @@ TEST_INTEGRATIONS_73 :=\
test_integrations_phpredis3 \
test_integrations_phpredis4 \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_sqlsrv \
test_opentracing_10
Expand Down Expand Up @@ -774,6 +776,7 @@ TEST_INTEGRATIONS_74 := \
test_integrations_phpredis3 \
test_integrations_phpredis4 \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_roadrunner \
test_integrations_sqlsrv \
Expand Down Expand Up @@ -839,6 +842,7 @@ TEST_INTEGRATIONS_80 := \
test_integrations_guzzle_latest \
test_integrations_pcntl \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_sqlsrv \
test_integrations_swoole_5 \
Expand Down Expand Up @@ -892,6 +896,7 @@ TEST_INTEGRATIONS_81 := \
test_integrations_pdo \
test_integrations_elasticsearch7 \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_sqlsrv \
test_integrations_swoole_5 \
Expand Down Expand Up @@ -949,6 +954,7 @@ TEST_INTEGRATIONS_82 := \
test_integrations_elasticsearch7 \
test_integrations_elasticsearch_latest \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_frankenphp \
test_integrations_roadrunner \
Expand Down Expand Up @@ -1012,6 +1018,7 @@ TEST_INTEGRATIONS_83 := \
test_integrations_elasticsearch7 \
test_integrations_elasticsearch_latest \
test_integrations_phpredis5 \
test_integrations_predis_1 \
test_integrations_predis_latest \
test_integrations_frankenphp \
test_integrations_roadrunner \
Expand Down Expand Up @@ -1281,6 +1288,8 @@ test_integrations_phpredis5: global_test_run_dependencies
$(call run_tests_debug,tests/Integrations/PHPRedis/V5)
$(eval TEST_EXTRA_INI=)
$(eval TEST_EXTRA_ENV=)
test_integrations_predis_1: global_test_run_dependencies tests/Integrations/Predis/V1/composer.lock-php$(PHP_MAJOR_MINOR)
$(call run_tests_debug,tests/Integrations/Predis/V1)
test_integrations_predis_latest: global_test_run_dependencies tests/Integrations/Predis/Latest/composer.lock-php$(PHP_MAJOR_MINOR)
$(call run_tests_debug,tests/Integrations/Predis/Latest)
test_integrations_frankenphp: global_test_run_dependencies
Expand Down
10 changes: 5 additions & 5 deletions src/DDTrace/Integrations/Predis/PredisIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function init(): int
$span->name = 'Predis.Pipeline.executePipeline';
$span->resource = $span->name;
$span->type = Type::REDIS;
PredisIntegration::setMetaAndServiceFromConnection($this, $span);
PredisIntegration::setMetaAndServiceFromConnection($this->getClient(), $span);
if (\count($args) < 2) {
return;
}
Expand Down Expand Up @@ -161,8 +161,8 @@ public static function storeConnectionMetaAndService($predis, $args)
}
}

ObjectKVStore::put($predis, 'service', $service);
ObjectKVStore::put($predis, 'connection_meta', $tags);
ObjectKVStore::put($predis->getConnection(), 'service', $service);
ObjectKVStore::put($predis->getConnection(), 'connection_meta', $tags);
}

/**
Expand All @@ -175,12 +175,12 @@ public static function storeConnectionMetaAndService($predis, $args)
*/
public static function setMetaAndServiceFromConnection($predis, SpanData $span)
{
$span->service = ObjectKVStore::get($predis, 'service', PredisIntegration::DEFAULT_SERVICE_NAME);
$span->service = ObjectKVStore::get($predis->getConnection(), 'service', PredisIntegration::DEFAULT_SERVICE_NAME);
$span->meta[Tag::SPAN_KIND] = 'client';
$span->meta[Tag::COMPONENT] = PredisIntegration::NAME;
$span->meta[Tag::DB_SYSTEM] = PredisIntegration::SYSTEM;

foreach (ObjectKVStore::get($predis, 'connection_meta', []) as $tag => $value) {
foreach (ObjectKVStore::get($predis->getConnection(), 'connection_meta', []) as $tag => $value) {
$span->meta[$tag] = $value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Frameworks/Laravel/Latest/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "11.39.1",
"laravel/framework": "11.41.3",
"laravel/tinker": "^2.9"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion tests/Frameworks/Laravel/Octane/Latest/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"require": {
"php": "^8.2",
"laravel/framework": "^11.0",
"laravel/octane": "2.6.0",
"laravel/octane": "2.6.1",
"laravel/tinker": "^2.9"
},
"require-dev": {
Expand Down
6 changes: 3 additions & 3 deletions tests/Frameworks/Symfony/Latest/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"symfony/dotenv": "*",
"symfony/flex": "^2",
"symfony/form": "*",
"symfony/framework-bundle": "7.2.2",
"symfony/messenger": "7.2.1",
"symfony/framework-bundle": "7.2.3",
"symfony/messenger": "7.2.3",
"symfony/monolog-bundle": "^3.10",
"symfony/property-access": "*",
"symfony/property-info": "*",
Expand Down Expand Up @@ -93,4 +93,4 @@
"require-dev": {
"symfony/maker-bundle": "^1.49"
}
}
}
2 changes: 1 addition & 1 deletion tests/Integrations/GoogleSpanner/Latest/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"google/cloud-spanner": "1.92.0"
"google/cloud-spanner": "1.92.1"
},
"provide": {
"ext-grpc": "*"
Expand Down
4 changes: 3 additions & 1 deletion tests/Integrations/Predis/Latest/PredisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function testPredisClusterConnect()
$connectionString = "tcp://{$this->host}";

$traces = $this->isolateTracer(function () use ($connectionString) {
$client = new \Predis\Client([$connectionString, $connectionString, $connectionString]);
$client = new \Predis\Client([$connectionString, $connectionString, $connectionString], ['cluster' => 'redis']);
$client->connect();
});

Expand Down Expand Up @@ -251,6 +251,8 @@ public function testPredisPipeline()
Tag::COMPONENT => 'predis',
Tag::DB_SYSTEM => 'redis',
'redis.pipeline_length' => '2',
Tag::TARGET_HOST => $this->host,
Tag::TARGET_PORT => $this->port,
];

$this->assertFlameGraph($traces, [
Expand Down
2 changes: 1 addition & 1 deletion tests/Integrations/Predis/Latest/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"predis/predis": "1.1.10"
"predis/predis": "2.3.0"
}
}
13 changes: 13 additions & 0 deletions tests/Integrations/Predis/V1/PredisTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace DDTrace\Tests\Integrations\Predis\V1;

use DDTrace\Tag;
use DDTrace\Tests\Common\IntegrationTestCase;
use DDTrace\Tests\Common\SpanAssertion;
use Predis\Configuration\Options;

class PredisTest extends \DDTrace\Tests\Integrations\Predis\Latest\PredisTest
{
//
}
5 changes: 5 additions & 0 deletions tests/Integrations/Predis/V1/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"predis/predis": "^1"
}
}

0 comments on commit f157156

Please sign in to comment.