-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathtest_cat.php
90 lines (77 loc) · 3.16 KB
/
test_cat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/*DESCRIPTION
Test that CAT works with guzzle 7.
*/
/*SKIPIF
<?php
require("skipif.inc");
if (!isset($_ENV["ACCOUNT_supportability"]) || !isset($_ENV["APP_supportability"])) {
die("skip: env vars required");
}
*/
/*INI
newrelic.distributed_tracing_enabled=0
newrelic.cross_application_tracer.enabled = true
*/
/*EXPECT
tracing endpoint reached
tracing endpoint reached
Customer-Header=found tracing endpoint reached
*/
/*EXPECT_RESPONSE_HEADERS
X-NewRelic-App-Data=??
X-NewRelic-App-Data=??
X-NewRelic-App-Data=??
*/
/*EXPECT_METRICS
[
"?? agent run id",
"?? timeframe start",
"?? timeframe stop",
[
[{"name":"External/127.0.0.1/all"}, [3, "??", "??", "??", "??", "??"]],
[{"name":"External/all"}, [3, "??", "??", "??", "??", "??"]],
[{"name":"External/allOther"}, [3, "??", "??", "??", "??", "??"]],
[{"name":"ExternalApp/127.0.0.1/ENV[ACCOUNT_supportability]#ENV[APP_supportability]/all"},
[3, "??", "??", "??", "??", "??"]],
[{"name":"ExternalTransaction/127.0.0.1/ENV[ACCOUNT_supportability]#ENV[APP_supportability]/WebTransaction/Custom/tracing"},
[3, "??", "??", "??", "??", "??"]],
[{"name":"ExternalTransaction/127.0.0.1/ENV[ACCOUNT_supportability]#ENV[APP_supportability]/WebTransaction/Custom/tracing",
"scope":"OtherTransaction/php__FILE__"}, [3, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
[3, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
]
]
*/
?>
<?php
require_once(realpath(dirname(__FILE__)) . '/../../../include/config.php');
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
require_guzzle(7);
/* Create URL. */
$url = "http://" . make_tracing_url(realpath(dirname(__FILE__)) . '/../../../include/tracing_endpoint.php');
/* Use guzzle 7 to make an http request. */
use GuzzleHttp\Client;
$client = new Client();
$response = $client->get($url);
echo $response->getBody();
$response = $client->get($url, [
'headers' => [
'zip' => 'zap']]);
echo $response->getBody();
$response = $client->get($url, [
'headers' => [
'zip' => 'zap',
CUSTOMER_HEADER => 'zap']]);
echo $response->getBody();