fastlane-plugin-sentry_api 0.3.0 → 0.5.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: d77dd2a4ddeeeebbae493992d767270bbb900115a8609b569da69c3fe289097f
4
- data.tar.gz: 9d5cd96f9c4122c36b1046f2d35a9ea52128ec72ec3ad6b89f2d75161e7da929
3
+ metadata.gz: d2d7e86861535827a08cfc5f104e19fc76aa7425ce1145eb423bd2245c3ca4f4
4
+ data.tar.gz: fb60b07c170ecbeec59c94b79e50486764baeefac2c350b682e92fc474574bc2
5
5
  SHA512:
6
- metadata.gz: 6710416b679ef754a02c988f66f8c982f8067539670214fd124acebaedd236aee4b3ddcba82fa523f1385f7f6b589bdbf3cdbccac55b8c22d3b558ef7d99b55b
7
- data.tar.gz: 35cea7b42c2aecbf03b0afef2995f43e1596cc77527bb6983c390af085037f6f0aee86b239380977c1aa540c195df83b74b1d0d0696ba889097b1674096ac883
6
+ metadata.gz: 7b5dce5c216e5a457fe1422aef19ed565706df708157f75fda3159a702076001051496a0aafee13966f5113d8d07c6093369d7703d0a5b959b05e7e7f87df4dd
7
+ data.tar.gz: c6bf3a529b30953e46a1728e73d35fb0e7462a519f0fe527fd208b391098c8bc0f68bae736a8e914e4d70513c85ab75017dbbc4716ef78b13321f307769e634c
data/README.md CHANGED
@@ -89,7 +89,7 @@ Query crash-free session and user rates from the Sentry Sessions API. Supports a
89
89
  | `per_page` | `Integer` | No | `10` | Number of groups to return (max 100) |
90
90
  | `order_by` | `String` | No | `-sum(session)` | Sort order for grouped results |
91
91
 
92
- **Output (SharedValues):** `SENTRY_CRASH_FREE_SESSION_RATE`, `SENTRY_CRASH_FREE_USER_RATE`, `SENTRY_TOTAL_SESSIONS`, `SENTRY_TOTAL_USERS`, `SENTRY_SESSION_GROUPS`
92
+ **Output (SharedValues):** `SENTRY_CRASH_FREE_SESSION_RATE`, `SENTRY_CRASH_FREE_USER_RATE`, `SENTRY_TOTAL_SESSIONS`, `SENTRY_TOTAL_USERS`, `SENTRY_SESSION_GROUPS`, `SENTRY_CRASH_FREE_SESSIONS_STATUS_CODE`, `SENTRY_CRASH_FREE_SESSIONS_JSON`
93
93
 
94
94
  **Examples:**
95
95
 
@@ -130,7 +130,7 @@ Convenience action for fetching user-centric crash-free metrics. For full sessio
130
130
  | `start_date` | `String` | No | — | ISO 8601 start date |
131
131
  | `end_date` | `String` | No | — | ISO 8601 end date |
132
132
 
133
- **Output (SharedValues):** `SENTRY_CRASH_FREE_USER_RATE_ONLY`, `SENTRY_TOTAL_USERS_ONLY`
133
+ **Output (SharedValues):** `SENTRY_CRASH_FREE_USER_RATE_ONLY`, `SENTRY_TOTAL_USERS_ONLY`, `SENTRY_CRASH_FREE_USERS_STATUS_CODE`, `SENTRY_CRASH_FREE_USERS_JSON`
134
134
 
135
135
  **Example:**
136
136
 
@@ -162,8 +162,9 @@ 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
- **Output (SharedValues):** `SENTRY_TTID_DATA` (array of `{ transaction:, avg:, p50:, p75:, p95:, count: }`), `SENTRY_TTID_OVERALL` (hash with `{ avg:, p50:, p75:, p95:, count: }` when `include_overall` is true)
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
 
168
169
  **Examples:**
169
170
 
@@ -171,7 +172,7 @@ Query TTID (Time to Initial Display) percentiles per screen from the Sentry Even
171
172
  # Top 10 screens by load count
172
173
  screens = sentry_ttid_percentiles(stats_period: "7d", per_page: 10)
173
174
  screens.each do |s|
174
- UI.message("#{s[:transaction]}: avg=#{s[:avg]}ms p50=#{s[:p50]}ms p95=#{s[:p95]}ms (#{s[:count]} loads)")
175
+ UI.message("#{s[:transaction]}: p50=#{s[:p50]}ms p75=#{s[:p75]}ms p95=#{s[:p95]}ms (#{s[:count]} loads)")
175
176
  end
176
177
 
177
178
  # With overall aggregate TTID
@@ -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
  ---
@@ -208,7 +216,7 @@ Query app launch latency (cold start & warm start) percentiles from the Sentry E
208
216
  | `end_date` | `String` | No | — | ISO 8601 end date |
209
217
  | `release` | `String` | No | — | Filter by release version |
210
218
 
211
- **Output (SharedValues):** `SENTRY_APP_LAUNCH_DATA` (hash with `:cold_start` and `:warm_start`, each containing `{ p50:, p75:, p95:, count: }`)
219
+ **Output (SharedValues):** `SENTRY_APP_LAUNCH_DATA` (hash with `:cold_start` and `:warm_start`, each containing `{ p50:, p75:, p95:, count: }`), `SENTRY_APP_LAUNCH_STATUS_CODE`, `SENTRY_APP_LAUNCH_JSON`
212
220
 
213
221
  **Examples:**
214
222
 
@@ -249,7 +257,7 @@ Fetch issues from a Sentry project. Supports filtering by release version, query
249
257
  | `per_page` | `Integer` | No | `25` | Number of issues to return (max 100) |
250
258
  | `cursor` | `String` | No | — | Pagination cursor |
251
259
 
252
- **Output (SharedValues):** `SENTRY_ISSUES` (array of issue hashes), `SENTRY_ISSUE_COUNT`
260
+ **Output (SharedValues):** `SENTRY_ISSUES` (array of issue hashes with `:id`, `:short_id`, `:title`, `:culprit`, `:level`, `:status`, `:event_count`, `:user_count`, `:first_seen`, `:last_seen`, `:permalink`, `:metadata`), `SENTRY_ISSUE_COUNT`, `SENTRY_ISSUES_STATUS_CODE`, `SENTRY_ISSUES_JSON`
253
261
 
254
262
  **Examples:**
255
263
 
@@ -303,6 +311,8 @@ Includes target checking with ✅/⚠️ indicators and optional JSON file outpu
303
311
  | `ttid_screen_count` | `Integer` | No | `10` | Number of top screens in TTID report |
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 |
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 |
306
316
  | `output_json` | `String` | No | — | Path to write JSON report file |
307
317
 
308
318
  **Output (SharedValues):** `SENTRY_SLO_REPORT` (complete hash with `:availability`, `:latency`, `:issues`)
@@ -356,6 +366,13 @@ report = sentry_slo_report(
356
366
  )
357
367
  rate = report[:availability][:current][:crash_free_session_rate]
358
368
  UI.important("Crash-free: #{(rate * 100).round(2)}%")
369
+
370
+ # Exclude specific screens from TTID metrics
371
+ sentry_slo_report(
372
+ crash_free_target: 0.998,
373
+ ttid_exclude_screens: ["AppContainerViewController", "SplashScreenViewController"],
374
+ output_json: "slo_report.json"
375
+ )
359
376
  ```
360
377
 
361
378
  ---
@@ -375,11 +392,11 @@ end
375
392
  lane :ttid_check do
376
393
  screens = sentry_ttid_percentiles(stats_period: "7d", per_page: 10, include_overall: true)
377
394
  screens.each do |s|
378
- UI.message("#{s[:transaction]}: avg=#{s[:avg]}ms p50=#{s[:p50]}ms p95=#{s[:p95]}ms (#{s[:count]} loads)")
395
+ UI.message("#{s[:transaction]}: p50=#{s[:p50]}ms p75=#{s[:p75]}ms p95=#{s[:p95]}ms (#{s[:count]} loads)")
379
396
  end
380
397
 
381
398
  overall = lane_context[SharedValues::SENTRY_TTID_OVERALL]
382
- UI.important("Overall TTID: avg=#{overall[:avg]}ms p50=#{overall[:p50]}ms p95=#{overall[:p95]}ms") if overall
399
+ UI.important("Overall TTID: p50=#{overall[:p50]}ms p75=#{overall[:p75]}ms p95=#{overall[:p95]}ms") if overall
383
400
  end
384
401
 
385
402
  lane :app_launch_check do
@@ -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
@@ -133,7 +137,8 @@ module Fastlane
133
137
 
134
138
  report[:issues][:top_crashes] = fetch_top_crash_issues(
135
139
  auth_token: auth_token, org_slug: org_slug, project_slug: project_slug,
136
- stats_period: stats_period, per_page: params[:crash_issue_count]
140
+ stats_period: stats_period, per_page: params[:crash_issue_count],
141
+ query: params[:crash_query]
137
142
  )
138
143
  log_top_crashes(report[:issues][:top_crashes])
139
144
 
@@ -286,6 +291,16 @@ module Fastlane
286
291
  optional: true,
287
292
  default_value: 5,
288
293
  type: Integer),
294
+ FastlaneCore::ConfigItem.new(key: :crash_query,
295
+ description: "Custom Sentry search query for top crash issues",
296
+ optional: true,
297
+ default_value: "is:unresolved issue.category:error error.unhandled:true",
298
+ type: String),
299
+ FastlaneCore::ConfigItem.new(key: :ttid_exclude_screens,
300
+ description: "Array of screen (transaction) names to exclude from TTID queries",
301
+ optional: true,
302
+ default_value: [],
303
+ type: Array),
289
304
  # ── Output ──
290
305
  FastlaneCore::ConfigItem.new(key: :output_json,
291
306
  description: "Path to write JSON report file (optional)",
@@ -327,7 +342,14 @@ module Fastlane
327
342
  compare_releases: false
328
343
  )
329
344
  rate = report[:availability][:current][:crash_free_session_rate]
330
- UI.important("Crash-free: #{(rate * 100).round(2)}%")'
345
+ UI.important("Crash-free: #{(rate * 100).round(2)}%")',
346
+
347
+ '# Exclude specific screens from TTID metrics
348
+ sentry_slo_report(
349
+ crash_free_target: 0.998,
350
+ ttid_exclude_screens: ["AppContainerViewController", "SplashScreenViewController"],
351
+ output_json: "slo_report.json"
352
+ )'
331
353
  ]
332
354
  end
333
355
 
@@ -407,7 +429,7 @@ module Fastlane
407
429
  end
408
430
  end
409
431
 
410
- def fetch_ttid(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil, per_page: 10)
432
+ def fetch_ttid(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil, per_page: 10, exclude_screens: [])
411
433
  fields = [
412
434
  'transaction',
413
435
  'avg(measurements.time_to_initial_display)',
@@ -421,7 +443,7 @@ module Fastlane
421
443
  dataset: 'metrics',
422
444
  field: fields,
423
445
  project: project_id.to_s,
424
- query: 'event.type:transaction transaction.op:ui.load',
446
+ query: ttid_query(exclude_screens),
425
447
  sort: '-count()',
426
448
  per_page: per_page.to_s
427
449
  }
@@ -455,7 +477,7 @@ module Fastlane
455
477
  end
456
478
  end
457
479
 
458
- def fetch_ttid_overall(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil)
480
+ def fetch_ttid_overall(auth_token:, org_slug:, project_id:, environment:, stats_period: nil, start_date: nil, end_date: nil, exclude_screens: [])
459
481
  fields = [
460
482
  'avg(measurements.time_to_initial_display)',
461
483
  'p50(measurements.time_to_initial_display)',
@@ -468,7 +490,7 @@ module Fastlane
468
490
  dataset: 'metrics',
469
491
  field: fields,
470
492
  project: project_id.to_s,
471
- query: 'event.type:transaction transaction.op:ui.load',
493
+ query: ttid_query(exclude_screens),
472
494
  per_page: '1'
473
495
  }
474
496
 
@@ -555,13 +577,13 @@ module Fastlane
555
577
  '14d'
556
578
  end
557
579
 
558
- def fetch_top_crash_issues(auth_token:, org_slug:, project_slug:, stats_period:, per_page:)
580
+ def fetch_top_crash_issues(auth_token:, org_slug:, project_slug:, stats_period:, per_page:, query:)
559
581
  response = Helper::SentryApiHelper.get_issues(
560
582
  auth_token: auth_token,
561
583
  org_slug: org_slug,
562
584
  project_slug: project_slug,
563
585
  params: {
564
- query: 'is:unresolved issue.category:error error.unhandled:true',
586
+ query: query,
565
587
  sort: 'freq',
566
588
  statsPeriod: issues_api_stats_period(stats_period),
567
589
  per_page: per_page.to_s
@@ -673,6 +695,14 @@ module Fastlane
673
695
  { avg: nil, p50: nil, p75: nil, p95: nil, count: nil }
674
696
  end
675
697
 
698
+ def ttid_query(exclude_screens)
699
+ parts = ['event.type:transaction transaction.op:ui.load']
700
+ (exclude_screens || []).each do |screen|
701
+ parts << "!transaction:#{screen}"
702
+ end
703
+ parts.join(' ')
704
+ end
705
+
676
706
  def round_ms(value)
677
707
  return nil if value.nil?
678
708
 
@@ -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.3.0"
3
+ VERSION = "0.5.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.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - crazymanish