sentry_top_errors 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 312ff43ff1b7e67a60e97d53ce62420fdcb1a7e0d661df6fed257ad1f2fddea5
4
- data.tar.gz: 3b2a17b9ca30d78d2a27f26d9c05802c1af5fe410a92c49eb2a7abb49f40bcbe
3
+ metadata.gz: 4b815358cb7c0ff813d5f8413c20baf96fcf92c882e1c8f67cb20edf7b6c631c
4
+ data.tar.gz: 6eaf8ebaf3dd48334db7250d86d823c7adccc52e664d2dad3a65bc0aedac67d8
5
5
  SHA512:
6
- metadata.gz: 4729a76870723d4941e0687d74a0947c1301fb80449037ed51b89f671f211a209fac35a9893d579471789e0c67d59cfd7f416f662a56e186d2a09a9eb36b9ce7
7
- data.tar.gz: 81976c7433fe881e4f805366423527a6966bd8b6cdc550250efef0bfc803bc51703fe130bc50ba18bffac05d15e3862eba8acd5af3bad208be4444587593edc6
6
+ metadata.gz: 833a13244399e4308619fcb852bd50b98c03d459381ee0ea2eaec71a91e6519db5f5bdc9bf7553a6e0967ae1334b8b7a8c3de1babafc5d24d0e3a729a6be7947
7
+ data.tar.gz: 3ed0dd57a38729c9286297b08a741af9d90990e49d4b18506d38818fbd909ace63e0b4671078fd7c69a1edef4e89a45d196b606f9d14baa6560c9ecc54bd81e7
@@ -24,4 +24,4 @@ end
24
24
 
25
25
  reporter = SentryTopErrors::Reporter.new(client: client, report_type: :html)
26
26
  reporter.fetch_data
27
- puts r.generate_report
27
+ puts reporter.generate_report
@@ -1,5 +1,3 @@
1
- require 'progress_bar'
2
-
3
1
  class SentryTopErrors::Reporter
4
2
  def initialize(client:, prod_regex: /^p-/, threshold_24h: 30, threshold_new: 10, new_days_num: 1, report_type: :html)
5
3
  @client = client
@@ -67,7 +65,9 @@ class SentryTopErrors::Reporter
67
65
  culprit: issue['culprit'],
68
66
  issue_link: issue['permalink'],
69
67
  issue_count: count_in_24h,
70
- is_production: is_production
68
+ is_production: is_production,
69
+ assigned_to: issue.dig('assignedTo', 'name'),
70
+ assigned_to_email: issue.dig('assignedTo', 'email'),
71
71
  }
72
72
 
73
73
  if count_in_24h > @threshold_24h
@@ -139,8 +139,12 @@ class SentryTopErrors::Reporter
139
139
  elsif @report_type == :html
140
140
  tpl_dir = File.join(File.expand_path(File.dirname(__FILE__) + "/../.."), "templates")
141
141
  html_content = File.read(tpl_dir + "/index.html")
142
+ project_orgs = @projects.map {|pr| pr['organization']['name'] }.uniq.join(", ")
143
+
142
144
  html_content.sub!(%{['ALL_ISSUE_COUNTS_PLACEHOLDER']}, JSON.pretty_generate(issue_counts))
143
145
  html_content.sub!(%{['NEW_ISSUE_COUNTS_PLACEHOLDER']}, JSON.pretty_generate(new_issues))
146
+ html_content.sub!("REPORT_GENERATE_DATE", Time.now.strftime("%F %T %Z"))
147
+ html_content.sub!("REPORT_SENTRY_ORG", project_orgs)
144
148
 
145
149
  puts "Saved index.html"
146
150
  File.write("./index.html", html_content)
@@ -2,6 +2,7 @@ require 'excon'
2
2
  require 'json'
3
3
  require 'yaml'
4
4
  require 'time'
5
+ require 'progress_bar'
5
6
 
6
7
  module SentryTopErrors
7
8
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "sentry_top_errors"
3
- s.version = "0.1.1"
3
+ s.version = "0.1.3"
4
4
  s.summary = "Generate top errors report for sentry"
5
5
  s.description = ""
6
6
  s.author = "Pavel Evstigneev"
data/templates/index.html CHANGED
@@ -15,9 +15,9 @@
15
15
  .page-content {
16
16
  height: 100%;
17
17
  min-height: 400px;
18
- width: 92%;
19
- max-width: 1200px;
20
- margin: 30px auto;
18
+ width: 90%;
19
+ max-width: 1400px;
20
+ margin: 35px auto;
21
21
  background: #fff;
22
22
  padding: 25px;
23
23
  border-radius: 12px;
@@ -26,7 +26,7 @@
26
26
 
27
27
  h1 {
28
28
  font-size: 1.5em;
29
- background: #9d4f4f;
29
+ background: #87358e;
30
30
  margin: -25px -25px 35px -25px;
31
31
  padding: 12px 25px;
32
32
  border-radius: 12px 12px 0 0;
@@ -53,10 +53,15 @@
53
53
  }
54
54
 
55
55
  table.rows-table td, table.rows-table th {
56
- padding: 3px 7px;
56
+ padding: 4px 7px;
57
57
  border: 1px solid #cfcfcf;
58
58
  }
59
59
 
60
+ .full-width {
61
+ width: 100%;
62
+ max-width: 100%;
63
+ }
64
+
60
65
  tr.is-non-prod-issue, tr.is-non-prod-issue td a {
61
66
  color: #36487d;
62
67
  background: #f5f5f5;
@@ -81,10 +86,11 @@
81
86
  max-width: 260px;
82
87
  }
83
88
 
84
- .full-width {
85
- width: 100%;
86
- max-width: 100%;
87
- }
89
+ td.issue-assignee {
90
+ font-size: 80%;
91
+ overflow: ellipsis;
92
+ max-width: 100px;
93
+ }
88
94
  </style>
89
95
  </head>
90
96
  <body>
@@ -93,7 +99,9 @@
93
99
  <a href=''>Sentry Errors</a>
94
100
  </h1>
95
101
 
96
- <h2>Repeating Issues</h2>
102
+ <p>Generated at: <b>REPORT_GENERATE_DATE</b>, for sentry organization <b>REPORT_SENTRY_ORG</b></p>
103
+
104
+ <h2>Repeating Issues (in last 24h)</h2>
97
105
 
98
106
  <table class='rows-table full-width' id="issues-table">
99
107
  <thead>
@@ -102,6 +110,7 @@
102
110
  <th>Project</th>
103
111
  <th>Issue</th>
104
112
  <th>Cause</th>
113
+ <th>User</th>
105
114
  </tr>
106
115
  </thead>
107
116
  <tbody></tbody>
@@ -116,6 +125,7 @@
116
125
  <th>Project</th>
117
126
  <th>Issue</th>
118
127
  <th>Cause</th>
128
+ <th>User</th>
119
129
  </tr>
120
130
  </thead>
121
131
  <tbody></tbody>
@@ -322,9 +332,7 @@
322
332
  </script>
323
333
 
324
334
  <script>
325
- var issuesTable = $('#issues-table tbody');
326
-
327
- ALL_ISSUE_COUNTS.forEach(issue => {
335
+ var generateRow = (issue, table) => {
328
336
  var tr = $.element('tr', {
329
337
  appendTo: issuesTable,
330
338
  class: issue.is_production ? 'is-prod-issue' : 'is-non-prod-issue',
@@ -336,22 +344,21 @@
336
344
  var issueCell = $.element('td', {appendTo: tr, class: 'issue-name'});
337
345
  $.element('a', {href: issue.issue_link, text: issue.issue, target: '_blank', appendTo: issueCell})
338
346
  $.element('td', {text: issue.culprit, appendTo: tr, class: 'issue-cause'});
339
- });
347
+ if (issue.assigned_to) {
348
+ $.element('td', {text: issue.assigned_to, appendTo: tr, class: 'issue-assignee', title: issue.assigned_to_email});
349
+ } else {
350
+ $.element('td', {appendTo: tr});
351
+ }
352
+ }
340
353
 
341
- var issuesTable = $('#new-issues-table tbody');
354
+ var issuesTable = $('#issues-table tbody');
355
+ ALL_ISSUE_COUNTS.forEach(issue => {
356
+ generateRow(issue, issuesTable);
357
+ });
342
358
 
359
+ var newIssuesTable = $('#new-issues-table tbody');
343
360
  NEW_ISSUE_COUNTS.forEach(issue => {
344
- var tr = $.element('tr', {
345
- appendTo: issuesTable,
346
- class: issue.is_production ? 'is-prod-issue' : 'is-non-prod-issue',
347
- });
348
-
349
- $.element('td', {text: issue.issue_count, appendTo: tr, class: 'issue-count'});
350
- var projectCell = $.element('td', {appendTo: tr, class: 'project-name'});
351
- $.element('a', {href: issue.project_url, text: issue.project_name, target: '_blank', appendTo: projectCell})
352
- var issueCell = $.element('td', {appendTo: tr, class: 'issue-name'});
353
- $.element('a', {href: issue.issue_link, text: issue.issue, target: '_blank', appendTo: issueCell})
354
- $.element('td', {text: issue.culprit, appendTo: tr, class: 'issue-cause'});
361
+ generateRow(issue, newIssuesTable);
355
362
  });
356
363
  </script>
357
364
  </body>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry_top_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Evstigneev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon