You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 3, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,18 @@ All additional events will be descendents of this transaction.
77
77
There is currently no provision to manage additional Transaction events, or to handle a non-HTTP Request
78
78
based process. We hope to address those issues in a future release.
79
79
80
+
#### Customizing Transaction Context
81
+
82
+
While the `RecordTransaction` middleware sets supported APM contexts when the transaction is created, you may wish to customize the contexts based on the completed request/response. This can be done by extending the `RecordTransaction` middleware and overriding context methods as described in the [customizing transactions](docs/customizing_transactions.md) documentation.
83
+
84
+
#### Excluding Requests
85
+
86
+
You can exclude requests from being sent to APM by using an `except` list of URI patterns. For example, you may wish to avoid sending requests for the (DebugBar)[https://github.com/barryvdh/laravel-debugbar] resources during development or testing.
87
+
88
+
Add the desired URI patterns to the `except` key in the `elastic-apm` configuration. Note that you must publish the file as described in the [configuration docs](docs/configuration.md).
89
+
90
+
If you have extended the `RecordTransaction` middleware, as described in the [customizing transactions](docs/customizing_transactions.md) documentation, you may set the `except` list class member there.
91
+
80
92
### Span Events
81
93
82
94
Spans occur within a Transaction. Spans represent events within the Transaction. Queries made through Laravel's
@@ -102,7 +114,7 @@ Refer to the [configuration docs](docs/configuration.md) for more information.
102
114
103
115
### HTTP Client Customization
104
116
105
-
It is no longer possible to provide HTTP client options through the APM PHP Agent configuration. If you need to customize the HTTP client, you must implement and configure a suitable client object and properly register it with the Laravel service container. See the "HTTP Client Configuation" section of the [configuration docs](docs/configuration.md).
117
+
It is no longer possible to provide HTTP client options through the APM PHP Agent configuration. If you need to customize the HTTP client, you must implement and configure a suitable client object and provide it to the `AgentBuilder`. See the "HTTP Client Configuration" section of the [configuration docs](docs/configuration.md).
Copy file name to clipboardExpand all lines: docs/breaking_changes.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
1
# Breaking Changes
2
2
3
-
## 7.x
3
+
## 7.1.0
4
+
5
+
1. Removed the ability to bind "ElasticApm*" objects into the container to set on the AgentBuilder. Configuring the AgentBuilder is now done by binding an implementation into the container which the ElasticApmServiceProvider will resolve and use.
6
+
7
+
## 7.0.0
4
8
5
9
1. The [Elastic APM PHP Agent](https://github.com/nipwaayoni/elastic-apm-php-agent) minimum version has been updated.
6
10
2. It is no longer recommended to call `Agent::send()` in `Exceptions\Handler::report()`. This will likely result in duplicate reporting of exceptions.
Once published, open the `config/elastic-apm.php` file and review the various settings.
26
26
27
-
## HTTP Client Configuration
27
+
## Customizing Agent Creation
28
28
29
-
If you need to customize the HTTP client, you must create a [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible implementation and bind it in the Laravel service container. For now, we will use a GuzzleHttp adapter from the PHP-HTTP project.
29
+
The `Agent` object used to manage APM events is created using the provided `AgentBuilder` class. You can control many aspects of the `Agent` creation by binding your own implementation into the service container. Some helpful examples are shown below. For more details, refer to the [Elastic APM PHP Agent](https://github.com/nipwaayoni/elastic-apm-php-agent/blob/master/docs/agent.md) documentation.
30
+
31
+
### Binding an AgentBuilder
32
+
33
+
Bind your implementation as a singleton in the service container:
34
+
35
+
```php
36
+
$this->app->bind(AgentBuilder::class, function () {
37
+
$builder = new AgentBuilder();
38
+
39
+
// configure the builder
40
+
41
+
return $builder;
42
+
});
43
+
```
44
+
45
+
Note that the `ElasticApmServiceProvider` will always call the `AgentBuilder::withConfig()` and `AgentBuilder::withEnvData()` methods. You must use the provided `elastic-apm` configuration options to influence those settings.
46
+
47
+
### HTTP Client Configuration
48
+
49
+
If you need to customize the HTTP client, you must create a [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible implementation and provide it to the `AgentBuilder. For now, we will use a GuzzleHttp adapter from the PHP-HTTP project.
The following example demonstrates how to create a GuzzleHttp client that will not verify server certificates. Once you create the client, bind it in the service container under the `ElasticApmHttpClient` abstract.
55
+
The following example demonstrates how to create a GuzzleHttp client that will not verify server certificates.
36
56
37
57
```php
38
-
$this->app->bind('ElasticApmHttpClient', function () {
39
-
// Create the configured client
58
+
$this->app->bind(AgentBuilder::class, function () {
59
+
$builder = new AgentBuilder();
60
+
40
61
$client = new \GuzzleHttp\Client([
41
62
'verify' => false,
42
63
// other client options
43
64
]);
44
65
45
66
// Wrap the client object in the adapter and return it
If the service container has a binding for `ElasticApmHttpClient`, the concrete implementation will be retrieved and passed into the `Agent`.
73
+
### APM Transaction Hooks
74
+
75
+
You can hook the APM HTTP request/response process to examine the data to be sent to APM and the response after sending. This may be helpful in troubleshooting issues.
76
+
77
+
```php
78
+
$this->app->bind(AgentBuilder::class, function () {
0 commit comments