Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: raskasa/metrics-okhttp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: dropwizard/metrics-okhttp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 1,981 additions and 787 deletions.
  1. +8 −0 .editorconfig
  2. +0 −10 .github/dependabot.yml
  3. +15 −7 .github/workflows/java.yml
  4. +0 −5 .gitignore
  5. BIN .mvn/wrapper/maven-wrapper.jar
  6. +18 −0 .mvn/wrapper/maven-wrapper.properties
  7. +10 −0 CHANGELOG.md
  8. +11 −1 CONTRIBUTING.md
  9. +15 −7 README.md
  10. +1 −1 metrics-okhttp/pom.xml
  11. +0 −54 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/ConnectionRequestCounter.java
  12. +0 −34 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/ConnectionTimingAnalyzer.java
  13. +258 −0 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/InstrumentedEventListener.java
  14. +19 −4 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/InstrumentedInterceptor.java
  15. +132 −251 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/InstrumentedOkHttpClient.java
  16. +9 −12 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/InstrumentedOkHttpClients.java
  17. +0 −148 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/WrappedEventListener.java
  18. +0 −28 metrics-okhttp/src/main/java/com/raskasa/metrics/okhttp/WrappedEventListenerFactory.java
  19. +393 −182 metrics-okhttp/src/test/java/com/raskasa/metrics/okhttp/InstrumentedOkHttpClientTest.java
  20. +12 −13 metrics-okhttp/src/test/java/com/raskasa/metrics/okhttp/InstrumentedOkHttpClientsTest.java
  21. +481 −0 metrics-okhttp/src/test/java/okhttp3/RecordingEventListener.java
  22. +308 −0 mvnw
  23. +205 −0 mvnw.cmd
  24. +46 −12 pom.xml
  25. +10 −0 renovate.json
  26. +12 −2 sample/pom.xml
  27. +18 −16 sample/src/main/java/com/raskasa/metrics/okhttp/sample/App.java
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
insert_final_newline = true

[*{.java,xml}]
indent_style = space
indent_size = 2
10 changes: 0 additions & 10 deletions .github/dependabot.yml

This file was deleted.

22 changes: 15 additions & 7 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
name: Java CI
on: [push]
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
Build-Project:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Configure JDK
uses: actions/setup-java@v2
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4
with:
distribution: 'adopt'
java-version: 11
distribution: 'zulu'
java-version: '21'
cache: 'maven'
- name: Run Maven Build
run: mvn package
run: ./mvnw -B -V -ntp package
- name: Publish Snapshots and JavaDocs
if: github.event_name != 'pull_request'
env:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
run: mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
run: ./mvnw -B -V -ntp clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -22,9 +22,4 @@ classes

obj

.idea
target
*.ipr
*.iml
*.iws
.DS_Store
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Change Log
==========

## Version 0.5.0

_2021-10-08_

* __`EventListener`-based metrics.__ Users now have access to metrics recorded
through OkHttp's new API for tracking metrics and monitoring HTTP requests’
size and duration.
* Updated OkHttp dependency to 3.14.9.
* Updated Dropwizard Metrics dependency to 4.2.3.

## Version 0.4.0

_2017-11-10_
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -5,4 +5,14 @@ If you would like to contribute code to Metrics Integration for OkHttp you can
do so through GitHub by forking the repository and sending a pull request.

When submitting code, please make every effort to follow existing conventions
and style in order to keep the code as readable as possible.
and style in order to keep the code as readable as possible. A concrete step
you can take is to ensure you're running the following before submitting a PR:

```bash
$ cd metrics-okhttp
$ mvn clean package
```

This should run successfully. Additionally, this runs an automated source code
formatter. So, ensure any formatting changes that occur after running the above
commands are added to the changes in the PR.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -48,6 +48,19 @@ OkHttpClient client = InstrumentedOkHttpClients.create(registry, rawClient, "cus
An instrumented OkHttp HTTP client provides the following metrics:

```
okhttp3.EventListener.calls-duration
okhttp3.EventListener.calls-end
okhttp3.EventListener.calls-failed
okhttp3.EventListener.calls-start
okhttp3.EventListener.connections-acquired
okhttp3.EventListener.connections-duration
okhttp3.EventListener.connections-end
okhttp3.EventListener.connections-failed
okhttp3.EventListener.connections-released
okhttp3.EventListener.connections-start
okhttp3.EventListener.dns-duration
okhttp3.EventListener.dns-end
okhttp3.EventListener.dns-start
okhttp3.OkHttpClient.cache-request-count
okhttp3.OkHttpClient.cache-hit-count
okhttp3.OkHttpClient.cache-network-count
@@ -65,11 +78,6 @@ okhttp3.OkHttpClient.network-requests-completed
okhttp3.OkHttpClient.network-requests-duration
okhttp3.OkHttpClient.network-requests-running
okhttp3.OkHttpClient.network-requests-submitted
okhttp3.OkHttpClient.connection-requests
okhttp3.OkHttpClient.connection-failed
okhttp3.OkHttpClient.connection-acquired
okhttp3.OkHttpClient.connection-released
okhttp3.OkHttpClient.connection-setup
```

If you provide a custom name for the instrumented client (i.e. `custom-name`),
@@ -95,14 +103,14 @@ Download [the latest jar][metrics-okhttp] or depend on Maven:
<dependency>
<groupId>com.raskasa.metrics</groupId>
<artifactId>metrics-okhttp</artifactId>
<version>0.4.0</version>
<version>0.5.0</version>
</dependency>
```

or Gradle:

```groovy
compile 'com.raskasa.metrics:metrics-okhttp:0.4.0'
compile 'com.raskasa.metrics:metrics-okhttp:0.5.0'
```

Snapshots of the development version are available in
2 changes: 1 addition & 1 deletion metrics-okhttp/pom.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>metrics-okhttp-parent</artifactId>
<groupId>com.raskasa.metrics</groupId>
<groupId>io.dropwizard.metrics.okhttp</groupId>
<version>0.5.0-SNAPSHOT</version>
</parent>

This file was deleted.

This file was deleted.

Loading