Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

feat: enhance PagerDuty migrator filtering + and improve user migration operations#5471

Merged
joeyorlando merged 8 commits intodevfrom
joey/fix-pagerduty-migrator
Mar 17, 2025
Merged

feat: enhance PagerDuty migrator filtering + and improve user migration operations#5471
joeyorlando merged 8 commits intodevfrom
joey/fix-pagerduty-migrator

Conversation

@joeyorlando
Copy link
Copy Markdown
Contributor

@joeyorlando joeyorlando commented Mar 1, 2025

Summary of Changes

Improved Filtering Logic

  • Changed filtering logic to use OR operations between filter types (team, users, regex)
  • Resources matching ANY filter are now included in the migration
  • Made filtering more intuitive and aligned with user expectations

New PAGERDUTY_FILTER_USERS option for add_users_to_grafana.py script

  • This new config (environment variable) allows importing only a subset of users from your PagerDuty instance.
  • Added full test coverage for add_users_to_grafana.py
  • Updated documentation to reflect latest changes

Added Verbose Logging Option

  • Added PAGERDUTY_VERBOSE_LOGGING environment variable to control output verbosity
  • When disabled, only shows summary counts without detailed per-resource output
  • Significantly reduces output for large PagerDuty instances

Fixed User Handling

  • Properly skips user fetching and processing when MIGRATE_USERS=false
  • Marks schedules and escalation policies properly when not migrating users
  • When MIGRATE_USERS=true and PAGERDUTY_FILTER_USERS is set, only those specific users are migrated

Added Migration Progress Summary

  • Shows counts of filtered resources and those eligible for migration
  • Provides better visibility into the migration process

Updated Tests

  • Added comprehensive tests for the new OR-based filtering logic
  • Added tests for user filtering
  • Added tests for verbose and non-verbose logging modes

Updated Documentation

  • Clearly documented the new filtering behavior
  • Explained the verbose logging option
  • Updated configuration descriptions to be more accurate

These changes address issues with filtering behavior and user handling, making the PagerDuty migrator more intuitive, efficient, and flexible.

- Changed filter logic to use OR operations between filter types

- Added verbose logging option to reduce output spam

- Fixed user handling when MIGRATE_USERS=false

- Added migration progress summary

- Updated tests and documentation
…n PAGERDUTY_FILTER_USERS is set and MIGRATE_USERS=true, now only the specified users will be migrated. Added filter_users function, updated migrate function, added tests, and updated documentation.
@joeyorlando joeyorlando requested review from a team as code owners March 1, 2025 13:09
@joeyorlando joeyorlando changed the base branch from main to dev March 1, 2025 13:11
@joeyorlando joeyorlando force-pushed the joey/fix-pagerduty-migrator branch from 563bd15 to b906140 Compare March 1, 2025 13:15
@joeyorlando joeyorlando changed the title Fix PagerDuty migrator filtering issues and improve user handling feat: enhance PagerDuty migrator filtering + and improve user migration operations Mar 1, 2025
@joeyorlando joeyorlando added the release:patch PR will be added to "Other Changes" section of release notes label Mar 1, 2025
print(
f"Integrations: {sum(1 for i in integrations if i.get('oncall_type') and not i.get('is_escalation_policy_flawed'))} eligible of {filtered_resources_summary['integrations']} filtered"
)
print("")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - is this for a new line?

Copy link
Copy Markdown

@willgallego-grafana willgallego-grafana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@joeyorlando joeyorlando merged commit 4c72781 into dev Mar 17, 2025
23 of 25 checks passed
@joeyorlando joeyorlando deleted the joey/fix-pagerduty-migrator branch March 17, 2025 12:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release:patch PR will be added to "Other Changes" section of release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants