Skip to content

Commit

Permalink
add UT on PinpointPerRequestPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
eeliu committed Nov 3, 2023
1 parent a8f42f2 commit 0a5da26
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ lib/pinpoint/test/test.php
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
test*.php
/test_*.php
1 change: 1 addition & 0 deletions lib/Pinpoint/Plugins/Common/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@
# key for support UT
# https://github.com/pinpoint-apm/pinpoint-c-agent/issues/534
define("PP_ROUTE_KEY", '__pinpoint__route');
define("UT", 'UT');
8 changes: 7 additions & 1 deletion lib/Pinpoint/Plugins/PinpointPerRequestPlugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

require_once __DIR__ . "/__init__.php";

use Pinpoint\Common\Logger;

class PinpointPerRequestPlugins
{
public $tid = null;
Expand Down Expand Up @@ -148,7 +150,11 @@ public function __destruct()
pinpoint_mark_as_error('Internal server error', __FILE__);
}
}

$urlTemplateUrl = pinpoint_get_context(PP_ROUTE_KEY);
if ($urlTemplateUrl != false && !empty($urlTemplateUrl)) {
pinpoint_add_clue(UT, $urlTemplateUrl);
Logger::Inst()->debug("add ut '$urlTemplateUrl'");
}
pinpoint_end_trace();
}

Expand Down
15 changes: 0 additions & 15 deletions test_logger.php

This file was deleted.

0 comments on commit 0a5da26

Please sign in to comment.