Skip to content

appsec: improvements in metrics#3850

Draft
cataphract wants to merge 9 commits intomasterfrom
glopes/metrics-improv
Draft

appsec: improvements in metrics#3850
cataphract wants to merge 9 commits intomasterfrom
glopes/metrics-improv

Conversation

@cataphract
Copy link
Copy Markdown
Contributor

Description

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

cataphract and others added 9 commits April 29, 2026 15:32
… for bundled rules

- report_diagnostics_errors now takes rc_path as Option<&rc::RcPath> and an
  explicit action tag, so both the init path (action:init) and the update path
  (action:update) submit the waf.config_errors metric.
- The init path passes None for rc_path and constructs a synthetic
  ParsedConfigKey{product:"bundled_rules", config_id:"bundled_rules"} so
  diagnostic telemetry logs are also emitted for errors in the bundled rules.
- The init-path TelemetryLogsCollector is reused as the service's
  logs_collector so those logs are flushed on the first request.
- Integration test @order(21) verifies the metric (action:init,
  event_rules_version:9.9.9) and the diagnostic log
  (rc::bundled_rules::diagnostic) in a single drain loop, since
  drainTelemetry is destructive.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces rasp.c/h with duration_acc.c/h to accumulate both WAF and RASP
round-trip times measured by the extension. Sends them in request_shutdown
(now 6 args). Rust helper emits waf.duration, waf.duration_ext, and
rasp.duration_ext as DDSketch distributions, and _dd.appsec.waf.duration_ext
as a span metric. Adds integration tests with a Groovy DDSketch protobuf
decoder to cross-check span metric values against distribution bins.
…sql_injection

Adds rule_variant as a new optional field in the request_exec protocol
(msgpack map key "rule_variant", sent only when non-empty). The PHP
extension parses an optional third argument to push_addresses() and
packs it when present.

FilesystemIntegration passes "request" for SSRF pre-hooks. PDO and
Mysqli integrations rename "sqli" to "sql_injection" for consistency
with other tracers.

In the Rust helper, WafRunType::RaspRule becomes a struct variant
{ rule_type, rule_variant: Option<String> }. The rasp_per_rule HashMap
is keyed on (rule_type, rule_variant); the rule_variant tag is emitted
only when non-empty (the sidecar rejects tags ending with a bare colon).

Also adds event_rules_version to the three RASP per-rule metrics
(rasp.rule.eval, rasp.rule.match, rasp.timeout).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Apr 30, 2026

Benchmarks [ appsec ]

Benchmark execution time: 2026-04-30 17:01:00

Comparing candidate commit db09024 in PR branch glopes/metrics-improv with baseline commit c2e7eae in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Apr 30, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-04-30 17:37:57

Comparing candidate commit db09024 in PR branch glopes/metrics-improv with baseline commit c2e7eae in branch master.

Found 0 performance improvements and 5 performance regressions! Performance is the same for 188 metrics, 1 unstable metrics.

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟥 execution_time [+2.393µs; +3.027µs] or [+2.344%; +2.966%]

scenario:PHPRedisBench/benchRedisOverhead

  • 🟥 execution_time [+35.468µs; +50.355µs] or [+3.759%; +5.336%]

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • 🟥 execution_time [+54.008ns; +135.392ns] or [+3.801%; +9.530%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2

  • 🟥 execution_time [+54.101ns; +135.099ns] or [+3.742%; +9.345%]

scenario:SamplingRuleMatchingBench/benchRegexMatching4

  • 🟥 execution_time [+90.031ns; +175.769ns] or [+6.324%; +12.347%]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant