Skip to content

body property added for sent and consumed message stats #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ClientMonitoringExtension.php
Original file line number Diff line number Diff line change
@@ -43,7 +43,8 @@ public function onPostSend(PostSend $context): void
$context->getTransportMessage()->getMessageId(),
$context->getTransportMessage()->getCorrelationId(),
$context->getTransportMessage()->getHeaders(),
$context->getTransportMessage()->getProperties()
$context->getTransportMessage()->getProperties(),
$context->getTransportMessage()->getBody()
);

$this->safeCall(function () use ($stats) {
12 changes: 12 additions & 0 deletions ConsumedMessageStats.php
Original file line number Diff line number Diff line change
@@ -51,6 +51,11 @@ class ConsumedMessageStats implements Stats
*/
protected $properties;

/**
* @var string
*/
protected $body;

/**
* @var bool;
*/
@@ -100,6 +105,7 @@ public function __construct(
?string $correlationId,
array $headers,
array $properties,
string $body,
bool $redelivered,
string $status,
string $errorClass = null,
@@ -117,6 +123,7 @@ public function __construct(
$this->correlationId = $correlationId;
$this->headers = $headers;
$this->properties = $properties;
$this->body = $body;
$this->redelivered = $redelivered;
$this->status = $status;

@@ -168,6 +175,11 @@ public function getProperties(): array
return $this->properties;
}

public function getBody(): string
{
return $this->body;
}

public function isRedelivered(): bool
{
return $this->redelivered;
2 changes: 2 additions & 0 deletions ConsumerMonitoringExtension.php
Original file line number Diff line number Diff line change
@@ -174,6 +174,7 @@ public function onProcessorException(ProcessorException $context): void
$context->getMessage()->getCorrelationId(),
$context->getMessage()->getHeaders(),
$context->getMessage()->getProperties(),
$context->getMessage()->getBody(),
$context->getMessage()->isRedelivered(),
ConsumedMessageStats::STATUS_FAILED,
get_class($context->getException()),
@@ -256,6 +257,7 @@ public function onResult(MessageResult $context): void
$context->getMessage()->getCorrelationId(),
$context->getMessage()->getHeaders(),
$context->getMessage()->getProperties(),
$context->getMessage()->getBody(),
$context->getMessage()->isRedelivered(),
$status
);
14 changes: 13 additions & 1 deletion SentMessageStats.php
Original file line number Diff line number Diff line change
@@ -41,14 +41,20 @@ class SentMessageStats implements Stats
*/
protected $properties;

/**
* @var string
*/
protected $body;

public function __construct(
int $timestampMs,
string $destination,
bool $isTopic,
?string $messageId,
?string $correlationId,
array $headers,
array $properties
array $properties,
string $body
) {
$this->timestampMs = $timestampMs;
$this->destination = $destination;
@@ -57,6 +63,7 @@ public function __construct(
$this->correlationId = $correlationId;
$this->headers = $headers;
$this->properties = $properties;
$this->body = $body;
}

public function getTimestampMs(): int
@@ -93,4 +100,9 @@ public function getProperties(): array
{
return $this->properties;
}

public function getBody(): string
{
return $this->body;
}
}