fastlane-plugin-sentry_api 0.4.0 → 0.6.0

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: e998c3813e2bc19b0bfa6e76e1a102cfb546dbf4bce827f7bc4a6605417af6b8
4
- data.tar.gz: 3f614ff5d0b6f8e3bcb0091d6fa4e13444114aea9517521f2ebc03eee95f49c8
3
+ metadata.gz: bf6e5df1b17f042687dd22fd18486555d04b5cfe3e493f479cfa4ca1e3f392ef
4
+ data.tar.gz: d03707db9075c322a007109bf0e5b73804a1f061657fc39088008623cb0ee2ce
5
5
  SHA512:
6
- metadata.gz: 0b33aa8f31b3fcb6678f232129a57b3cc610c0eefd72bb6fb1bcd0d82454483540ce86834b2d48f366d9262043637ac82be68851d105faa1befe5ff172c1b579
7
- data.tar.gz: d4cfdf3c7bf563ee2c407da39b6a4ef7dd8d3e5fc7d022d2b08def70f736f1b34ac56f4209bf34cdc9ee861ff5f5ad8e30b4a9ea33e11012e3746767d60292dd
6
+ metadata.gz: 8dc7401daf7358046bfa80d0a6bbf1cbd929d317825a1f4c70466518b99be17b6656932a735377deccc616773a832434a654ae41cb3c54012053aa81ce3a3c49
7
+ data.tar.gz: 1f0197ae4d7a65f04a294b89d45dac2b9ae45a4f251630dc0664c5be090c0dcf66fe675f1b2ed120651f00f27d64cf0713065d96be39a7b19ea3c57f6cabb1fc
data/README.md CHANGED
@@ -162,6 +162,7 @@ Query TTID (Time to Initial Display) percentiles per screen from the Sentry Even
162
162
  | `per_page` | `Integer` | No | `20` | Number of screens to return (max 100) |
163
163
  | `sort` | `String` | No | `-count()` | Sort order |
164
164
  | `include_overall` | `Boolean` | No | `false` | Also fetch overall/aggregate TTID percentiles across all screens |
165
+ | `ttid_exclude_screens` | `Array` | No | `[]` | Array of screen (transaction) names to exclude from TTID queries |
165
166
 
166
167
  **Output (SharedValues):** `SENTRY_TTID_DATA` (array of `{ transaction:, p50:, p75:, p95:, count: }`), `SENTRY_TTID_OVERALL` (hash with `{ p50:, p75:, p95:, count: }` when `include_overall` is true), `SENTRY_TTID_STATUS_CODE`, `SENTRY_TTID_JSON`
167
168
 
@@ -187,6 +188,13 @@ sentry_ttid_percentiles(
187
188
  start_date: "2026-02-24T00:00:00Z",
188
189
  end_date: "2026-03-03T00:00:00Z"
189
190
  )
191
+
192
+ # Exclude specific screens (e.g. container or splash screens that inflate TTID)
193
+ sentry_ttid_percentiles(
194
+ stats_period: "7d",
195
+ include_overall: true,
196
+ ttid_exclude_screens: ["AppContainerViewController", "SplashScreenViewController"]
197
+ )
190
198
  ```
191
199
 
192
200
  ---
@@ -304,6 +312,7 @@ Includes target checking with ✅/⚠️ indicators and optional JSON file outpu
304
312
  | `issue_count` | `Integer` | No | `10` | Number of top issues per release |
305
313
  | `crash_issue_count` | `Integer` | No | `5` | Number of top crash (unhandled error) issues to include |
306
314
  | `crash_query` | `String` | No | `is:unresolved issue.category:error error.unhandled:true` | Custom Sentry search query for top crash issues |
315
+ | `ttid_exclude_screens` | `Array` | No | `[]` | Array of screen (transaction) names to exclude from TTID queries |
307
316
  | `output_json` | `String` | No | — | Path to write JSON report file |
308
317
 
309
318
  **Output (SharedValues):** `SENTRY_SLO_REPORT` (complete hash with `:availability`, `:latency`, `:issues`)
@@ -316,6 +325,7 @@ The `:latency` section includes:
316
325
 
317
326
  The `:issues` section includes:
318
327
  - `:top_crashes` — array of top unhandled error issues (always fetched, not release-scoped)
328
+ - `:total_crash_count` — total number of crash issues matching the query (up to 100), useful when you only display top N but want to show the full count
319
329
  - `:current_release` — `{ version:, count:, issues: [] }` (when `current_release` is provided)
320
330
  - `:previous_release` — same structure (when `previous_release` is provided)
321
331
 
@@ -346,6 +356,7 @@ cold = report[:latency][:app_launch][:cold]
346
356
  UI.message("Cold start p95: #{cold[:p95]}ms")
347
357
 
348
358
  # Top crash issues
359
+ UI.message("Total crash issues: #{report[:issues][:total_crash_count]}")
349
360
  report[:issues][:top_crashes].each do |issue|
350
361
  UI.message("#{issue[:short_id]}: #{issue[:title]} (#{issue[:event_count]} events)")
351
362
  end
@@ -357,6 +368,13 @@ report = sentry_slo_report(
357
368
  )
358
369
  rate = report[:availability][:current][:crash_free_session_rate]
359
370
  UI.important("Crash-free: #{(rate * 100).round(2)}%")
371
+
372
+ # Exclude specific screens from TTID metrics
373
+ sentry_slo_report(
374
+ crash_free_target: 0.998,
375
+ ttid_exclude_screens: ["AppContainerViewController", "SplashScreenViewController"],
376
+ output_json: "slo_report.json"
377
+ )
360
378
  ```
361
379
 
362
380
  ---
@@ -76,14 +76,16 @@ module Fastlane
76
76
  report[:latency][:current] = fetch_ttid(
77
77
  auth_token: auth_token, org_slug: org_slug, project_id: project_id,
78
78
  environment: environment, stats_period: stats_period,
79
- per_page: params[:ttid_screen_count]
79
+ per_page: params[:ttid_screen_count],
80
+ exclude_screens: params[:ttid_exclude_screens]
80
81
  )
81
82
  log_ttid("Current #{stats_period}", report[:latency][:current], params[:ttid_p95_target_ms])
82
83
 
83
84
  # Overall/aggregate TTID
84
85
  report[:latency][:overall] = fetch_ttid_overall(
85
86
  auth_token: auth_token, org_slug: org_slug, project_id: project_id,
86
- environment: environment, stats_period: stats_period
87
+ environment: environment, stats_period: stats_period,
88
+ exclude_screens: params[:ttid_exclude_screens]
87
89
  )
88
90
  log_ttid_overall("Current #{stats_period}", report[:latency][:overall], params[:ttid_p95_target_ms])
89
91
 
@@ -93,14 +95,16 @@ module Fastlane
93
95
  auth_token: auth_token, org_slug: org_slug, project_id: project_id,
94
96
  environment: environment,
95
97
  start_date: prev_dates[:start], end_date: prev_dates[:end],
96
- per_page: params[:ttid_screen_count]
98
+ per_page: params[:ttid_screen_count],
99
+ exclude_screens: params[:ttid_exclude_screens]
97
100
  )
98
101
  log_ttid("Previous #{stats_period}", report[:latency][:previous], params[:ttid_p95_target_ms])
99
102
 
100
103
  report[:latency][:overall_previous] = fetch_ttid_overall(
101
104
  auth_token: auth_token, org_slug: org_slug, project_id: project_id,
102
105
  environment: environment,
103
- start_date: prev_dates[:start], end_date: prev_dates[:end]
106
+ start_date: prev_dates[:start], end_date: prev_dates[:end],
107
+ exclude_screens: params[:ttid_exclude_screens]
104
108
  )
105
109
  log_ttid_overall("Previous #{stats_period}", report[:latency][:overall_previous], params[:ttid_p95_target_ms])
106
110
  end
@@ -131,11 +135,13 @@ module Fastlane
131
135
  # ── TOP CRASH ISSUES ────────────────────────────────────────────
132
136
  UI.header("Top Crash Issues")
133
137
 
134
- report[:issues][:top_crashes] = fetch_top_crash_issues(
138
+ crash_result = fetch_top_crash_issues(
135
139
  auth_token: auth_token, org_slug: org_slug, project_slug: project_slug,
136
140
  stats_period: stats_period, per_page: params[:crash_issue_count],
137
141
  query: params[:crash_query]
138
142
  )
143
+ report[:issues][:top_crashes] = crash_result[:issues]
144
+ report[:issues][:total_crash_count] = crash_result[:total_count]
139
145
  log_top_crashes(report[:issues][:top_crashes])
140
146
 
141
147
  # ── ISSUES (Release Comparison) ─────────────────────────────────
@@ -292,6 +298,11 @@ module Fastlane
292
298
  optional: true,
293
299
  default_value: "is:unresolved issue.category:error error.unhandled:true",
294
300
  type: String),
301
+ FastlaneCore::ConfigItem.new(key: :ttid_exclude_screens,
302
+ description: "Array of screen (transaction) names to exclude from TTID queries",
303
+ optional: true,
304
+ default_value: [],
305
+ type: Array),
295
306
  # ── Output ──
296
307
  FastlaneCore::ConfigItem.new(key: :output_json,
297
308
  description: "Path to write JSON report file (optional)",
@@ -333,7 +344,14 @@ module Fastlane
333
344
  compare_releases: false
334
345
  )
335
346
  rate = report[:availability][:current][:crash_free_session_rate]
336
- UI.important("Crash-free: #{(rate * 100).round(2)}%")'
347
+ UI.important("Crash-free: #{(rate * 100).round(2)}%")',
348
+
349
+ '# Exclude specific screens from TTID metrics
350
+ sentry_slo_report(
351
+ crash_free_target: 0.998,
352
+ ttid_exclude_screens: ["AppContainerViewController", "SplashScreenViewController"],
353
+ output_json: "slo_report.json"
354
+ )'
337
355
  ]
338
356
  end
339
357
 
@@ -413,7 +431,7 @@ module Fastlane
413
431
  end
414
432
  end
415
433
 
416
- def fetch_ttid(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil, per_page: 10)
434
+ def fetch_ttid(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil, per_page: 10, exclude_screens: [])
417
435
  fields = [
418
436
  'transaction',
419
437
  'avg(measurements.time_to_initial_display)',
@@ -427,7 +445,7 @@ module Fastlane
427
445
  dataset: 'metrics',
428
446
  field: fields,
429
447
  project: project_id.to_s,
430
- query: 'event.type:transaction transaction.op:ui.load',
448
+ query: ttid_query(exclude_screens),
431
449
  sort: '-count()',
432
450
  per_page: per_page.to_s
433
451
  }
@@ -461,7 +479,7 @@ module Fastlane
461
479
  end
462
480
  end
463
481
 
464
- def fetch_ttid_overall(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil)
482
+ def fetch_ttid_overall(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil, exclude_screens: [])
465
483
  fields = [
466
484
  'avg(measurements.time_to_initial_display)',
467
485
  'p50(measurements.time_to_initial_display)',
@@ -474,7 +492,7 @@ module Fastlane
474
492
  dataset: 'metrics',
475
493
  field: fields,
476
494
  project: project_id.to_s,
477
- query: 'event.type:transaction transaction.op:ui.load',
495
+ query: ttid_query(exclude_screens),
478
496
  per_page: '1'
479
497
  }
480
498
 
@@ -570,17 +588,17 @@ module Fastlane
570
588
  query: query,
571
589
  sort: 'freq',
572
590
  statsPeriod: issues_api_stats_period(stats_period),
573
- per_page: per_page.to_s
591
+ per_page: '100'
574
592
  }
575
593
  )
576
594
 
577
595
  unless response[:status].between?(200, 299)
578
596
  UI.error("Sentry Issues API error #{response[:status]}: #{response[:body]}")
579
- return []
597
+ return { issues: [], total_count: 0 }
580
598
  end
581
599
 
582
600
  issues_data = response[:json] || []
583
- issues_data.first(per_page).map do |issue|
601
+ issues = issues_data.first(per_page).map do |issue|
584
602
  {
585
603
  id: issue['id'],
586
604
  short_id: issue['shortId'],
@@ -592,6 +610,8 @@ module Fastlane
592
610
  last_seen: issue['lastSeen']
593
611
  }
594
612
  end
613
+
614
+ { issues: issues, total_count: issues_data.length }
595
615
  end
596
616
 
597
617
  def fetch_issues_for_release(auth_token:, org_slug:, project_slug:, release:, per_page:)
@@ -679,6 +699,14 @@ module Fastlane
679
699
  { avg: nil, p50: nil, p75: nil, p95: nil, count: nil }
680
700
  end
681
701
 
702
+ def ttid_query(exclude_screens)
703
+ parts = ['event.type:transaction transaction.op:ui.load']
704
+ (exclude_screens || []).each do |screen|
705
+ parts << "!transaction:#{screen}"
706
+ end
707
+ parts.join(' ')
708
+ end
709
+
682
710
  def round_ms(value)
683
711
  return nil if value.nil?
684
712
 
@@ -160,7 +160,12 @@ module Fastlane
160
160
  description: "Also fetch overall/aggregate TTID percentiles across all screens",
161
161
  optional: true,
162
162
  default_value: false,
163
- type: Fastlane::Boolean)
163
+ type: Fastlane::Boolean),
164
+ FastlaneCore::ConfigItem.new(key: :ttid_exclude_screens,
165
+ description: "Array of screen (transaction) names to exclude from TTID queries",
166
+ optional: true,
167
+ default_value: [],
168
+ type: Array)
164
169
  ]
165
170
  end
166
171
 
@@ -220,6 +225,9 @@ module Fastlane
220
225
  query_parts = ["event.type:transaction"]
221
226
  query_parts << "transaction.op:#{params[:transaction_op]}" if params[:transaction_op]
222
227
  query_parts << "release:#{params[:release]}" if params[:release]
228
+ (params[:ttid_exclude_screens] || []).each do |screen|
229
+ query_parts << "!transaction:#{screen}"
230
+ end
223
231
 
224
232
  query_params = {
225
233
  dataset: 'metrics',
@@ -253,6 +261,9 @@ module Fastlane
253
261
  query_parts = ['event.type:transaction']
254
262
  query_parts << "transaction.op:#{params[:transaction_op]}" if params[:transaction_op]
255
263
  query_parts << "release:#{params[:release]}" if params[:release]
264
+ (params[:ttid_exclude_screens] || []).each do |screen|
265
+ query_parts << "!transaction:#{screen}"
266
+ end
256
267
 
257
268
  query_params = {
258
269
  dataset: 'metrics',
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SentryApi
3
- VERSION = "0.4.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sentry_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - crazymanish