Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Truncate large webhook events #2742

Merged

Conversation

tevoinea
Copy link
Member

Summary of the Pull Request

What is this about?

Closes #2708

PR Checklist

  • Tests added/passed
  • Requires documentation to be updated

Info on Pull Request

What does this include?

  • New interface ITruncatable
  • Reports now implement ITrunctable
  • Events that contain Reports now implement ITrunctatable
  • If we fail to store an event in the DB because the size is too large and the event is ITruncatable, we truncate and try again.
  • Reports now also include a URL to the report. This will always be included regardless of truncation.
  • Did a little bit of Wrap fallible ORM functions in Try/Catch #2709 by wrapping the Orm.Replace in a try/catch
  • Tests

Validation Steps Performed

How does someone test & validate?

  • Create a webhook that is intentionally too large (>1MB)
  • It should be stored as truncated in the DB
  • Webhook should still be sent

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2023

Codecov Report

Merging #2742 (2b7db9a) into main (1726bed) will increase coverage by 0.64%.
The diff coverage is 57.73%.

@@            Coverage Diff             @@
##             main    #2742      +/-   ##
==========================================
+ Coverage   28.44%   29.08%   +0.64%     
==========================================
  Files         319      312       -7     
  Lines       38023    36500    -1523     
==========================================
- Hits        10815    10617     -198     
+ Misses      27208    25883    -1325     
Impacted Files Coverage Δ
...ApiService/ApiService/Functions/ValidateScriban.cs 0.00% <0.00%> (ø)
...Service/ApiService/onefuzzlib/WebhookOperations.cs 0.00% <0.00%> (ø)
src/ApiService/ApiService/OneFuzzTypes/Events.cs 80.80% <58.33%> (-1.64%) ⬇️
src/ApiService/ApiService/OneFuzzTypes/Model.cs 70.36% <63.46%> (-0.75%) ⬇️
src/ApiService/ApiService/onefuzzlib/orm/Orm.cs 65.29% <72.72%> (-0.58%) ⬇️
src/ApiService/ApiService/onefuzzlib/Reports.cs 58.33% <80.00%> (+1.19%) ⬆️
src/ApiService/ApiService/onefuzzlib/Utils.cs 57.69% <100.00%> (+7.69%) ⬆️
src/agent/onefuzz/src/env.rs 0.00% <0.00%> (-83.34%) ⬇️
src/agent/onefuzz/src/libfuzzer.rs 11.97% <0.00%> (-57.47%) ⬇️
src/agent/onefuzz/src/memory.rs 0.00% <0.00%> (-25.00%) ⬇️
... and 58 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tevoinea tevoinea marked this pull request as ready for review January 13, 2023 16:23
@tevoinea tevoinea requested review from chkeita and Porges and removed request for chkeita January 13, 2023 17:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing to store large Events in database
3 participants