https://github.com/dheid/sentry-http-interceptors
Sends tracing information about Apache HttpClient calls to Sentry
https://github.com/dheid/sentry-http-interceptors
apache devops http httpclient httpcomponents httpcomponents-client java monitor monitoring sentry trace tracing
Last synced: 6 months ago
JSON representation
Sends tracing information about Apache HttpClient calls to Sentry
- Host: GitHub
- URL: https://github.com/dheid/sentry-http-interceptors
- Owner: dheid
- License: lgpl-3.0
- Archived: true
- Created: 2022-11-25T19:33:09.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T20:23:35.000Z (about 1 year ago)
- Last Synced: 2025-06-01T14:42:38.780Z (9 months ago)
- Topics: apache, devops, http, httpclient, httpcomponents, httpcomponents-client, java, monitor, monitoring, sentry, trace, tracing
- Language: Java
- Homepage: https://www.daniel-heid.de/open-source-projekte/
- Size: 380 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# :flashlight: Sentry HTTP Interceptors
[](https://search.maven.org/search?q=g:%22org.drjekyll%22%20AND%20a:%22sentry-http-interceptors%22)
[](https://github.com/dheid/sentry-http-interceptors/actions/workflows/build.yml)
[](https://ko-fi.com/W7W3EER56)
Sends tracing information about Apache HttpClient calls to Sentry:
* Creates a http.client span that shows the HTTP method and the full target URL
* Adds a breadcrumb containing the HTTP URL, HTTP method and the HTTP response status code
* Includes Sentry trace and baggage headers to requests made with Apache HttpClient
* Supports version 4 and version 5 of Apache HttpClient
* Easy to use
* Well documented with Javadoc
## :wrench: Usage
You need to provide your Apache HTTP Client 4 or 5 dependency on your own like this. For example for Apache HttpClient 4:
Maven
```xml
org.apache.httpcomponents
httpclient
4.5.14
```
Groovy
```groovy
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
```
Kotlin
```kotlin
implementation("org.apache.httpcomponents:httpclient:4.5.14")
```
or Apache HttpClient 5:
```xml
org.apache.httpcomponents.client5
httpclient5
5.2.1
```
Groovy
```groovy
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
```
Kotlin
```kotlin
implementation("org.apache.httpcomponents.client5:httpclient5:5.2.1")
```
Then include the dependency
Maven
```xml
org.drjekyll
sentry-http-interceptors
6.28.0
```
Groovy
```groovy
implementation 'org.drjekyll:sentry-http-interceptors:6.28.0'
```
Kotlin
```kotlin
implementation("org.drjekyll:sentry-http-interceptors:6.28.0")
```
Run your build tool and add the interceptors like in the following example:
Apache Http Client 5:
```java
CloseableHttpClient client=HttpClientBuilder.create()
.addRequestInterceptorFirst(new SentryHttpRequestInterceptor(HubAdapter.getInstance()))
.addResponseInterceptorLast(new SentryHttpResponseInterceptor(HubAdapter.getInstance()))
.build();
```
Apache Http Client 4:
```java
CloseableHttpClient client=HttpClientBuilder.create()
.addInterceptorFirst(new SentryHttpRequestInterceptor(HubAdapter.getInstance()))
.addResponseInterceptorLast(new SentryHttpResponseInterceptor(HubAdapter.getInstance()))
.build();
```
After that the requests will be traced by Sentry, if Sentry is correctly configured in your
application.
## :sunglasses: Development
To build and locally install the library and run the tests, just call
mvn install
## :handshake: Contributing
Please read [the contribution document](CONTRIBUTING.md) for details on our code of conduct, and the
process for submitting pull requests to us.
## :notebook: Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see
the [tags on this repository](https://github.com/dheid/sentry-http-interceptors/tags).
## :scroll: License
This project is licensed under the LGPL License - see the [license](LICENSE) file for details.
## :loudspeaker: Release Notes
### >= 6.24.0-1
Added support for Apache HttpClient versions 4 and 5 simultaneously.
### >= 6.19.2
Using Apache HttpClient version 5 now. Java 11 is required.
### > 6.9.0
Upgrade dependencies
### 6.9.0
Use Sentry version number to let consumer find the correct version more easily
### 1.0.2
Dependency updates
### 1.0.1
First public version