Skip to content

Conversation

peterbueschel
Copy link

@peterbueschel peterbueschel commented May 27, 2025

Hi team,(@mblaschke)

we would like to extend your helpful tool a bit and started with exposing memberships of teams. I hope you accept direct contributions without prior discussion; please let me know if you prefer a different process for feature proposals.


Summary

This PR adds the new Prometheus metric pagerduty_team_member_info which exposes all PagerDuty team members and their roles within each team.
It enables users to visualize which users are in which teams and their team role, and to join this data with pagerduty_user_info for enhanced dashboards and queries.

Changes

  • Introduced pagerduty_team_member_info metric (labels: teamID, userID, role) to the Team collector.
  • Updated metrics_team.go:
    • Registered new GaugeVec for this metric in Setup.
    • Populated the metric in Collect by listing all team members via PagerDuty API.
  • Updated README:
    • Documented the new metric in the Metrics table.
    • Added a usage example of querying and joining with pagerduty_user_info for Grafana dashboards or Prometheus queries.

Example Usage

Prometheus query to show team members and their user info:

pagerduty_team_member_info{teamID="$TEAM_ID"}
* on(userID) group_left(userName) pagerduty_user_info

Motivation

This feature allows for:

  • Easy inspection of team membership and roles from Prometheus metrics alone.
  • Building detailed Grafana dashboards/table panels of team structure.
  • Automation and audits based on PagerDuty team membership.

Testing

Tested locally; new metric successfully appears in /metrics endpoint output.

# HELP pagerduty_api_counter Pagerduty api counter
# TYPE pagerduty_api_counter counter
...
pagerduty_api_counter{name="ListTeamMemberships"} ...

# HELP pagerduty_team_member_info PagerDuty team member information
# TYPE pagerduty_team_member_info gauge
pagerduty_team_member_info{role="manager",teamID="P0...X",userID="P....9"} 1
pagerduty_team_member_info{role="manager",teamID="P0...Q",userID="P....7"} 1

Copy link

@gaborsimonits
Copy link

Hi Team, can you please check Peter's request?

@peterbueschel
Copy link
Author

Can we get this merged or is there anything missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants