Skip to content

Commit

Permalink
Optimize config
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia committed Aug 22, 2023
1 parent 162bc68 commit 046456f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/tracer/publish/opentracing.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
'kafka' => [
'topic' => 'zipkin',
'bootstrap_servers' => '127.0.0.1:9092',
'brokers' => null,
'acks' => -1,
'connect_timeout' => 1,
'send_timeout' => 1,
Expand Down
12 changes: 3 additions & 9 deletions src/tracer/src/Adapter/Reporter/Kafka.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,15 @@ public function report(array $spans): void
private function createProducer(array $options): Producer
{
$options = array_replace([
'bootstrap_servers' => null,
'brokers' => null,
'bootstrap_servers' => '127.0.0.1:9092',
'acks' => -1,
'connect_timeout' => 1,
'send_timeout' => 1,
], $options);
$config = new ProducerConfig();

if (! empty($options['bootstrap_servers'])) {
$config->setBootstrapServer($options['bootstrap_servers']);
$config->setUpdateBrokers(true);
}
if (! empty($options['brokers'])) {
$config->setBrokers($options['brokers']);
}
$config->setBootstrapServer($options['bootstrap_servers']);
$config->setUpdateBrokers(true);
if (is_int($options['acks'])) {
$config->setAcks($options['acks']);
}
Expand Down

0 comments on commit 046456f

Please sign in to comment.