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
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ Refer to the [configuration docs](docs/configuration.md) for more information.
114
114
115
115
### HTTP Client Customization
116
116
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 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.
Copy file name to clipboardExpand all lines: docs/configuration.md
+42-13Lines changed: 42 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,38 +26,67 @@ Once published, open the `config/elastic-apm.php` file and review the various se
26
26
27
27
## Customizing Agent Creation
28
28
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
+
29
47
### HTTP Client Configuration
30
48
31
-
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.
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.
38
56
39
57
```php
40
-
$this->app->bind('ElasticApmHttpClient', function () {
41
-
// Create the configured client
58
+
$this->app->bind(AgentBuilder::class, function () {
59
+
$builder = new AgentBuilder();
60
+
42
61
$client = new \GuzzleHttp\Client([
43
62
'verify' => false,
44
63
// other client options
45
64
]);
46
65
47
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
54
74
55
-
### Other Agent Services
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.
56
76
57
-
ElasticApmEventFactory
58
-
ElasticApmTransactionStore
59
-
ElasticApmRequestFactory
60
-
ElasticApmStreamFactory
77
+
```php
78
+
$this->app->bind(AgentBuilder::class, function () {
0 commit comments