Skip to content

Commit bf057e1

Browse files
committed
Addressed review comments
1 parent 46e5fc3 commit bf057e1

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

src/Exporter/Instana/composer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "instana/opentelemetry-exporter-instana",
3-
"description": "Instana exporter for OpenTelemetry PHP.",
2+
"name": "open-telemetry/opentelemetry-exporter-instana",
3+
"description": "Instana exporter implementation for OpenTelemetry PHP.",
44
"type": "library",
55
"support": {
66
"issues": "https://www.ibm.com/support/pages/instana-support",
@@ -21,22 +21,22 @@
2121
]
2222
},
2323
"require-dev": {
24-
"friendsofphp/php-cs-fixer": "^3",
25-
"phan/phan": "^5.0",
26-
"phpstan/phpstan": "^1.1",
27-
"phpstan/phpstan-phpunit": "^1.0",
28-
"psalm/plugin-phpunit": "^0.19.2",
29-
"open-telemetry/sdk": "^1.0",
30-
"phpunit/phpunit": "^9.5",
31-
"vimeo/psalm": "^4|^5|^6",
32-
"symfony/http-client": "^5.4|^6.0",
33-
"guzzlehttp/promises": "^1.5|^2",
34-
"php-http/message-factory": "^1.0",
35-
"nyholm/psr7": "^1.5"
24+
"friendsofphp/php-cs-fixer": "^3",
25+
"phan/phan": "^5.0",
26+
"phpstan/phpstan": "^1.1",
27+
"phpstan/phpstan-phpunit": "^1.0",
28+
"psalm/plugin-phpunit": "^0.19.2",
29+
"open-telemetry/sdk": "^1.0",
30+
"phpunit/phpunit": "^9.5",
31+
"vimeo/psalm": "^4|^5|^6",
32+
"symfony/http-client": "^5.4|^6.0",
33+
"guzzlehttp/promises": "^1.5|^2",
34+
"php-http/message-factory": "^1.0",
35+
"nyholm/psr7": "^1.5"
3636
},
3737
"autoload-dev": {
3838
"psr-4": {
39-
"OpenTelemetry\\Tests\\Exporter\\Instana\\": "tests/"
39+
"OpenTelemetry\\Tests\\Exporter\\Instana\\": "tests/"
4040
}
4141
},
4242
"extra": {
@@ -50,4 +50,4 @@
5050
"tbachert/spi": true
5151
}
5252
}
53-
}
53+
}

src/Exporter/Instana/src/InstanaTransport.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
class InstanaTransport implements TransportInterface
2929
{
3030
use LogsMessagesTrait;
31-
3231
const CONTENT_TYPE = 'application/json';
33-
const ATTEMPTS = 3;
3432

3533
private Client $client;
3634
private ?string $agent_uuid = null;
@@ -47,7 +45,9 @@ class InstanaTransport implements TransportInterface
4745
public function __construct(
4846
private readonly string $endpoint,
4947
// @phpstan-ignore property.onlyWritten
50-
private readonly float $timeout = 0.0
48+
private readonly float $timeout = 0.0,
49+
50+
private readonly int $attempts
5151
) {
5252
$this->headers += ['Content-Type' => self::CONTENT_TYPE];
5353
if ($timeout > 0.0) {
@@ -129,7 +129,7 @@ public function forceFlush(?CancellationInterface $cancellation = null): bool
129129

130130
private function announce()
131131
{
132-
for ($attempt = 0; $attempt < self::ATTEMPTS && !$this->performAnnounce(); $attempt++) {
132+
for ($attempt = 0; $attempt < $this->attempts && !$this->performAnnounce(); $attempt++) {
133133
self::logDebug('Discovery request failed, attempt ' . (string) $attempt);
134134
sleep(5);
135135
}
@@ -202,7 +202,7 @@ private function performAnnounce(): bool
202202
}
203203

204204
// Phase 3) Wait for the agent ready signal.
205-
for ($retry = 0; $retry < 5; $retry++) {
205+
for ($retry = 0; $retry < 2; $retry++) {
206206
if ($retry) {
207207
self::logDebug('Agent not yet ready, attempt ' . (string) $retry);
208208
}

src/Exporter/Instana/src/SpanExporterFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ public function create(): SpanExporterInterface
2727

2828
$endpoint = $host . ':' . $port;
2929
$timeout = 10; //s
30+
$attempts = 1;
3031

31-
$transport = new InstanaTransport($endpoint, $timeout);
32+
$transport = new InstanaTransport($endpoint, $timeout, $attempts);
3233

3334
$uuid = $transport->getUuid();
3435
$pid = $transport->getPid();

src/Propagation/Instana/composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11

22
{
3-
"name": "open-telemetry/opentelemetry-exporter-instana",
4-
"description": "OpenTelemetry Instana exporter.",
5-
"keywords": ["opentelemetry", "otel", "open-telemetry", "exporter", "instana"],
3+
"name": "open-telemetry/opentelemetry-propagation-instana",
4+
"description": "OpenTelemetry Instana propagator.",
5+
"keywords": ["opentelemetry", "otel", "open-telemetry", "propagator", "instana"],
66
"type": "library",
77
"readme": "./README.md",
8+
"license": "Apache-2.0",
89
"minimum-stability": "dev",
910
"prefer-stable": true,
1011
"require": {
@@ -32,8 +33,7 @@
3233
"symfony/http-client": "^5.4|^6.0",
3334
"guzzlehttp/promises": "^1.5|^2",
3435
"php-http/message-factory": "^1.0",
35-
"nyholm/psr7": "^1.5",
36-
"open-telemetry/opentelemetry": "dev-main"
36+
"nyholm/psr7": "^1.5"
3737
},
3838
"config": {
3939
"allow-plugins": {

0 commit comments

Comments
 (0)