Skip to content

Commit d34392d

Browse files
authored
Merge pull request #5715 from psiinon/network/conn-stats
Network: Add connection stats
2 parents 03b8697 + 12c89d3 commit d34392d

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

addOns/callhome/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ All notable changes to this add-on will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
## Unreleased
7-
7+
### Added
8+
- Network stats to telemetry.
89

910
## [0.13.0] - 2024-09-02
1011
### Added

addOns/callhome/src/main/java/org/zaproxy/addon/callhome/ExtensionCallHome.java

+1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public boolean test(Entry<String, Long> t) {
299299
|| key.startsWith("stats.fuzz.")
300300
|| key.startsWith("stats.graphql.")
301301
|| key.startsWith("stats.hud.")
302+
|| key.startsWith("stats.network.")
302303
|| key.startsWith("stats.oast.")
303304
|| key.startsWith("stats.openapi.")
304305
|| key.startsWith("stats.quickstart.")

addOns/network/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## Unreleased
8-
8+
### Added
9+
- Send success/failure stats.
910

1011
## [0.17.0] - 2024-09-02
1112
### Changed

addOns/network/src/main/java/org/zaproxy/addon/network/internal/client/BaseHttpSender.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import org.zaproxy.zap.network.HttpSenderListener;
5555
import org.zaproxy.zap.users.User;
5656
import org.zaproxy.zap.utils.Pair;
57+
import org.zaproxy.zap.utils.Stats;
5758

5859
/**
5960
* The base implementation of {@link CloseableHttpSenderImpl}.
@@ -410,7 +411,13 @@ private void sendRateLimited(
410411
if (ctx.getInitiator() != CHECK_FOR_UPDATES_INITIATOR) {
411412
rateLimiter.throttle(message, ctx.getInitiator());
412413
}
413-
sendImpl(ctx, requestCtx, requestConfig, message, responseBodyConsumer);
414+
try {
415+
sendImpl(ctx, requestCtx, requestConfig, message, responseBodyConsumer);
416+
Stats.incCounter("stats.network.send.success");
417+
} catch (IOException e) {
418+
Stats.incCounter("stats.network.send.failure");
419+
throw e;
420+
}
414421
}
415422

416423
protected abstract void sendImpl(

0 commit comments

Comments
 (0)