diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2018-12-13 16:30:45 +0100 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2019-01-02 19:43:06 +0100 |
commit | 168faf7d248ab89aac15e298ca9f49760f6f61c5 (patch) | |
tree | 4b185abe808c6fa25ac45752ff4fbc5ebcbf376b | |
parent | a042e070ea2a734e5f0c4c873c5c180f0d9ff3a0 (diff) | |
download | gitlab-ce-168faf7d248ab89aac15e298ca9f49760f6f61c5.tar.gz |
Fake frequency
-rw-r--r-- | app/services/error_tracking/sentry_issues_service.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/services/error_tracking/sentry_issues_service.rb b/app/services/error_tracking/sentry_issues_service.rb index 9af74c7ca8b..7bc4f4627b9 100644 --- a/app/services/error_tracking/sentry_issues_service.rb +++ b/app/services/error_tracking/sentry_issues_service.rb @@ -56,6 +56,10 @@ module ErrorTracking project = issue.fetch('project') metadata = issue.fetch('metadata') + count = issue.fetch('count') + frequency = issue.fetch('stats').fetch('24h') + count, frequency = fake_freq(frequency) + ErrorTracking::Error.new( id: issue.fetch('id'), first_seen: issue.fetch('firstSeen'), @@ -63,17 +67,27 @@ module ErrorTracking title: issue.fetch('title'), type: issue.fetch('type'), user_count: issue.fetch('userCount'), - count: issue.fetch('count'), + count: count, message: metadata.fetch('value', nil), culprit: issue.fetch('culprit'), external_url: issue.fetch('permalink'), short_id: issue.fetch('shortId'), status: issue.fetch('status'), - frequency: issue.fetch('stats').fetch('24h'), + frequency: frequency, project_id: project.fetch('id'), project_name: project.fetch('name'), project_slug: project.fetch('slug'), ) end + + def fake_freq(frequency) + faked = frequency.map do |(time, count)| + [time, count == 0 ? 10 + rand(50) : count] + end + + count = faked.reduce(0) { |sum, (_, c)| sum + c } + + [count, faked] + end end end |