diff --git a/addOns/callhome/CHANGELOG.md b/addOns/callhome/CHANGELOG.md index 19f0f780d85..e5fa0433e77 100644 --- a/addOns/callhome/CHANGELOG.md +++ b/addOns/callhome/CHANGELOG.md @@ -4,7 +4,8 @@ All notable changes to this add-on will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased - +### Added +- Network stats to telemetry. ## [0.13.0] - 2024-09-02 ### Added diff --git a/addOns/callhome/src/main/java/org/zaproxy/addon/callhome/ExtensionCallHome.java b/addOns/callhome/src/main/java/org/zaproxy/addon/callhome/ExtensionCallHome.java index e38585b75d8..5f1c63bc7c3 100644 --- a/addOns/callhome/src/main/java/org/zaproxy/addon/callhome/ExtensionCallHome.java +++ b/addOns/callhome/src/main/java/org/zaproxy/addon/callhome/ExtensionCallHome.java @@ -299,6 +299,7 @@ public boolean test(Entry t) { || key.startsWith("stats.fuzz.") || key.startsWith("stats.graphql.") || key.startsWith("stats.hud.") + || key.startsWith("stats.network.") || key.startsWith("stats.oast.") || key.startsWith("stats.openapi.") || key.startsWith("stats.quickstart.") diff --git a/addOns/network/CHANGELOG.md b/addOns/network/CHANGELOG.md index 0ea7c91fa8a..86eb0f2a62b 100644 --- a/addOns/network/CHANGELOG.md +++ b/addOns/network/CHANGELOG.md @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased - +### Added +- Send success/failure stats. ## [0.17.0] - 2024-09-02 ### Changed diff --git a/addOns/network/src/main/java/org/zaproxy/addon/network/internal/client/BaseHttpSender.java b/addOns/network/src/main/java/org/zaproxy/addon/network/internal/client/BaseHttpSender.java index b755ab8cfa1..ec561ecac5a 100644 --- a/addOns/network/src/main/java/org/zaproxy/addon/network/internal/client/BaseHttpSender.java +++ b/addOns/network/src/main/java/org/zaproxy/addon/network/internal/client/BaseHttpSender.java @@ -54,6 +54,7 @@ import org.zaproxy.zap.network.HttpSenderListener; import org.zaproxy.zap.users.User; import org.zaproxy.zap.utils.Pair; +import org.zaproxy.zap.utils.Stats; /** * The base implementation of {@link CloseableHttpSenderImpl}. @@ -410,7 +411,13 @@ private void sendRateLimited( if (ctx.getInitiator() != CHECK_FOR_UPDATES_INITIATOR) { rateLimiter.throttle(message, ctx.getInitiator()); } - sendImpl(ctx, requestCtx, requestConfig, message, responseBodyConsumer); + try { + sendImpl(ctx, requestCtx, requestConfig, message, responseBodyConsumer); + Stats.incCounter("stats.network.send.success"); + } catch (IOException e) { + Stats.incCounter("stats.network.send.failure"); + throw e; + } } protected abstract void sendImpl(