Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

joeyorlando
Copy link
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("")

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

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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