Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sashengpeng committed Oct 9, 2020
1 parent 7acac7f commit 5af625a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
41 changes: 41 additions & 0 deletions src/Base/EApmEventBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,4 +738,45 @@ public static function registeredEventsClear(string $transactionId) : void
}
}
}

/**
* Set correlation id of per span
*
* @param int $correlationId
* @return void
*/
public function setCorrelationId(int $correlationId) : void
{
$this->setLabel("correlation_id", $correlationId);
}

/**
* Set user define labels context
*
* @param string $labelKey
* @param $labelValue
* @return void
*/
public function setLabel(string $labelKey, $labelValue) : void
{
$labelType = gettype($labelValue);
switch($labelType) {
case "boolean":
case "integer":
case "double":
case "NULL":
break;
case "string":
$this->checkContextFieldLength($labelValue, "");
break;
default:
return;
}

$this->setContext([
"tags" => [
$labelKey => $labelValue,
],
]);
}
}
41 changes: 0 additions & 41 deletions src/Events/EApmSpan.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,47 +303,6 @@ public function setMessageQueueSpanContext(string $messageBody) : void
$this->end();
}

/**
* Set correlation id of per span
*
* @param int $correlationId
* @return void
*/
public function setCorrelationId(int $correlationId) : void
{
$this->setLabel("correlation_id", $correlationId);
}

/**
* Set user define labels context
*
* @param string $labelKey
* @param $labelValue
* @return void
*/
public function setLabel(string $labelKey, $labelValue) : void
{
$labelType = gettype($labelValue);
switch($labelType) {
case "boolean":
case "integer":
case "double":
case "NULL":
break;
case "string":
$this->checkContextFieldLength($labelValue, "");
break;
default:
return;
}

$this->setContext([
"tags" => [
$labelKey => $labelValue,
],
]);
}

/**
* Json serialize span event object
* @link https://www.elastic.co/guide/en/apm/server/master/span-api.html
Expand Down

0 comments on commit 5af625a

Please sign in to comment.