Skip to content

Commit

Permalink
Merge pull request #5715 from psiinon/network/conn-stats
Browse files Browse the repository at this point in the history
Network: Add connection stats
  • Loading branch information
thc202 authored Sep 6, 2024
2 parents 03b8697 + 12c89d3 commit d34392d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion addOns/callhome/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public boolean test(Entry<String, Long> 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.")
Expand Down
3 changes: 2 additions & 1 deletion addOns/network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d34392d

Please sign in to comment.