-
Notifications
You must be signed in to change notification settings - Fork 7
Add incident.io plugin #128
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c28a645
Add IncidentIO plugin for incident.io incident management
5943a91
Modify CODEOWNERS for IncidentIO path
noorulkhan-n 39d9333
Add objectLimit to currentUser configuration
noorulkhan-n 9ed8522
Document why userSchedules.js already aggregates across all schedule β¦
284b4c6
Remove invalid objectLimit from currentUser.json
80182d1
Drop Incident/Alert indexing; rename dashboards; rebuild Overview
bdca994
Unpack schedule rotation membership instead of showing raw objects/arβ¦
1b445ac
Add timeframe picker to Incidents data stream
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "steps": [ | ||
| { | ||
| "displayName": "Authenticate", | ||
| "dataStream": { "name": "currentUser" }, | ||
| "required": true, | ||
| "error": "Could not authenticate. Check your API key is valid and has not expired.", | ||
| "success": "Connected successfully." | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| [ | ||
| { | ||
| "name": "Schedule", | ||
| "sourceType": "Schedule", | ||
| "icon": "calendar-days", | ||
| "singular": "Schedule", | ||
| "plural": "Schedules" | ||
| }, | ||
| { | ||
| "name": "Team", | ||
| "sourceType": "Team", | ||
| "icon": "people-group", | ||
| "singular": "Team", | ||
| "plural": "Teams" | ||
| }, | ||
| { | ||
| "name": "User", | ||
| "sourceType": "User", | ||
| "icon": "user", | ||
| "singular": "User", | ||
| "plural": "Users" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "name": "alerts", | ||
| "displayName": "Alerts", | ||
| "description": "All alerts ingested by alert sources, one row per alert", | ||
| "tags": ["Alerts"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/alerts", | ||
| "pathToData": "alerts", | ||
| "paging": { | ||
| "mode": "token", | ||
| "pageSize": { "realm": "queryArg", "path": "page_size", "value": "50" }, | ||
| "in": { "realm": "payload", "path": "pagination_meta.after" }, | ||
| "out": { "realm": "queryArg", "path": "after" } | ||
| } | ||
| }, | ||
| "matches": "none", | ||
| "metadata": [ | ||
| { "name": "id", "displayName": "ID", "shape": "string", "visible": false }, | ||
| { "name": "title", "displayName": "Title", "shape": "string", "role": "label" }, | ||
| { "name": "status", "displayName": "Status", "shape": "string" }, | ||
| { "name": "alert_source_id", "displayName": "Alert Source ID", "shape": "string" }, | ||
| { "name": "deduplication_key", "displayName": "Deduplication Key", "shape": "string" }, | ||
| { "name": "created_at", "displayName": "Created At", "shape": "date" }, | ||
| { "name": "updated_at", "displayName": "Updated At", "shape": "date" }, | ||
| { "name": "resolved_at", "displayName": "Resolved At", "shape": "date" }, | ||
| { "name": "source_url", "displayName": "Source URL", "shape": "url" }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "currentUser", | ||
| "displayName": "Current User", | ||
| "description": "Identity and role details for the configured API key", | ||
| "tags": ["Users"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v1/identity" | ||
| }, | ||
| "matches": "none", | ||
| "visibility": { "type": "hidden" }, | ||
| "metadata": [{ "pattern": ".*" }], | ||
| "timeframes": false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "incidents", | ||
| "displayName": "Incidents", | ||
| "description": "All incidents in the organization, one row per incident", | ||
| "tags": ["Incidents"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/incidents", | ||
| "expandInnerObjects": true, | ||
| "pathToData": "incidents", | ||
| "paging": { | ||
| "mode": "token", | ||
| "pageSize": { "realm": "queryArg", "path": "page_size", "value": "100" }, | ||
| "in": { "realm": "payload", "path": "pagination_meta.after" }, | ||
| "out": { "realm": "queryArg", "path": "after" } | ||
| } | ||
| }, | ||
| "matches": "none", | ||
| "metadata": [ | ||
| { "name": "id", "displayName": "ID", "shape": "string", "visible": false }, | ||
| { "name": "name", "displayName": "Name", "shape": "string", "role": "label" }, | ||
| { "name": "reference", "displayName": "Reference", "shape": "string" }, | ||
| { "name": "mode", "displayName": "Mode", "shape": "string" }, | ||
| { "name": "visibility", "displayName": "Visibility", "shape": "string" }, | ||
| { "name": "incident_status.name", "displayName": "Status", "shape": "string" }, | ||
| { "name": "incident_status.category", "displayName": "Status Category", "shape": "string" }, | ||
| { "name": "severity.name", "displayName": "Severity", "shape": "string" }, | ||
| { "name": "incident_type.name", "displayName": "Type", "shape": "string" }, | ||
| { "name": "created_at", "displayName": "Created At", "shape": "date" }, | ||
| { "name": "updated_at", "displayName": "Updated At", "shape": "date" }, | ||
| { "name": "permalink", "displayName": "Permalink", "shape": "url" }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "scheduleOnCall", | ||
| "displayName": "Schedule On-Call", | ||
| "description": "Who is currently on-call for a schedule, one row per active shift/layer", | ||
| "tags": ["On-Call", "Schedules"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/schedules/{{object.rawId}}", | ||
| "pathToData": "schedule.current_shifts", | ||
| "expandInnerObjects": true | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["Schedule"] } }, | ||
| "metadata": [ | ||
| { "name": "user.name", "displayName": "On-Call User", "shape": "string", "role": "label" }, | ||
| { "name": "user.email", "displayName": "Email", "shape": "string" }, | ||
| { "name": "start_at", "displayName": "Start At", "shape": "date", "role": "timestamp" }, | ||
| { "name": "end_at", "displayName": "End At", "shape": "date" }, | ||
| { "name": "rotation_id", "displayName": "Rotation ID", "shape": "string" }, | ||
| { "name": "layer_id", "displayName": "Layer ID", "shape": "string" }, | ||
| { "name": "entry_id", "displayName": "Entry ID", "shape": "string", "visible": false }, | ||
| { "name": "fingerprint", "displayName": "Fingerprint", "shape": "string", "visible": false }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "name": "scheduleShifts", | ||
| "displayName": "Schedule Shifts", | ||
| "description": "The schedule's effective shifts across a time window, accounting for overrides", | ||
| "tags": ["On-Call", "Schedules"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/schedule_entries", | ||
| "getArgs": [ | ||
| { "key": "schedule_id", "value": "{{object.rawId}}" }, | ||
| { "key": "entry_window_start", "value": "{{timeframe.start}}" }, | ||
| { "key": "entry_window_end", "value": "{{timeframe.end}}" } | ||
| ], | ||
| "expandInnerObjects": true, | ||
| "pathToData": "schedule_entries.final", | ||
| "paging": { "mode": "none" } | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["Schedule"] } }, | ||
| "metadata": [ | ||
| { "name": "user.name", "displayName": "On-Call User", "shape": "string", "role": "label" }, | ||
| { "name": "user.email", "displayName": "Email", "shape": "string" }, | ||
| { "name": "start_at", "displayName": "Start", "shape": "date", "role": "timestamp" }, | ||
| { "name": "end_at", "displayName": "End", "shape": "date" }, | ||
| { "name": "rotation_id", "displayName": "Rotation ID", "shape": "string" }, | ||
| { "name": "layer_id", "displayName": "Layer ID", "shape": "string" }, | ||
| { "name": "entry_id", "displayName": "Entry ID", "shape": "string", "visible": false }, | ||
| { "name": "fingerprint", "displayName": "Fingerprint", "shape": "string", "visible": false }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "schedules", | ||
| "displayName": "Schedules", | ||
| "description": "All on-call schedules in the organization, one row per schedule", | ||
| "tags": ["On-Call", "Schedules"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/schedules", | ||
| "pathToData": "schedules", | ||
| "paging": { | ||
| "mode": "token", | ||
| "pageSize": { "realm": "queryArg", "path": "page_size", "value": "100" }, | ||
| "in": { "realm": "payload", "path": "pagination_meta.after" }, | ||
| "out": { "realm": "queryArg", "path": "after" } | ||
| } | ||
| }, | ||
| "matches": "none", | ||
| "visibility": { "type": "hidden" }, | ||
| "metadata": [ | ||
| { "name": "id", "displayName": "ID", "shape": "string", "visible": false }, | ||
| { "name": "name", "displayName": "Name", "shape": "string", "role": "label" }, | ||
| { "name": "timezone", "displayName": "Timezone", "shape": "string" }, | ||
| { "name": "created_at", "displayName": "Created At", "shape": "date" }, | ||
| { "name": "updated_at", "displayName": "Updated At", "shape": "date" }, | ||
|
clarkd marked this conversation as resolved.
|
||
| { "name": "permalink", "displayName": "Permalink", "shape": "url" }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // dataStreams/scripts/teams.js | ||
| // The v3/teams response nests a `members` array per team. A metadata | ||
| // valueExpression cannot compute a length from a sibling array/object | ||
| // column (cross-column references receive an already-shaped placeholder, | ||
| // not the real array), so the member count is derived here instead, | ||
| // against the untouched raw response. | ||
| result = (data.teams || []).map((team) => ({ | ||
| ...team, | ||
| memberCount: (team.members || []).length, | ||
| })); |
30 changes: 30 additions & 0 deletions
30
plugins/IncidentIO/v1/dataStreams/scripts/userSchedules.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // dataStreams/scripts/userSchedules.js | ||
| // Cross-references the schedules list against the scoped user's id: for each | ||
| // schedule, filters current_shifts to the ones where the shift's on-call | ||
| // user matches, and emits one row per matching (schedule, shift) pair. This | ||
| // can't be expressed with pathToData/valueExpression alone because it joins | ||
| // a nested per-schedule array against the scope object's id. | ||
| const userId = context.objects[0].rawId; | ||
|
|
||
| // This script only ever sees ONE page of `schedules` per invocation (`data` is that | ||
| // page's raw response body) β but the platform re-invokes it once per page as the | ||
| // `paging` config advances the `after` cursor, and concatenates every invocation's | ||
| // `result` into the stream's final output. Filtering per page and letting the | ||
| // platform concatenate is equivalent to concatenating all pages before filtering, | ||
| // since this is a stateless per-row filter with no cross-page aggregation β so every | ||
| // schedule, on every page, is checked. Confirmed empirically against this endpoint by | ||
| // forcing page_size=1 (2 pages for 2 real schedules) and seeing both schedules' | ||
| // shifts in the final result, each tagged with its own page's cursor. | ||
| result = (data.schedules || []).flatMap((schedule) => | ||
|
noorulkhan-n marked this conversation as resolved.
|
||
| (schedule.current_shifts || []) | ||
| .filter((shift) => shift.user && shift.user.id === userId) | ||
| .map((shift) => ({ | ||
| scheduleId: schedule.id, | ||
| scheduleName: schedule.name, | ||
| schedulePermalink: schedule.permalink, | ||
| start_at: shift.start_at, | ||
| end_at: shift.end_at, | ||
| rotation_id: shift.rotation_id || null, | ||
| layer_id: shift.layer_id || null, | ||
| })), | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "teams", | ||
| "displayName": "Teams", | ||
| "description": "All teams in the organization, one row per team", | ||
| "tags": ["Teams"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v3/teams", | ||
| "postRequestScript": "teams.js", | ||
| "paging": { | ||
| "mode": "token", | ||
| "pageSize": { "realm": "queryArg", "path": "page_size", "value": "100" }, | ||
| "in": { "realm": "payload", "path": "pagination_meta.after" }, | ||
| "out": { "realm": "queryArg", "path": "after" } | ||
| } | ||
| }, | ||
| "matches": "none", | ||
| "visibility": { "type": "hidden" }, | ||
| "metadata": [ | ||
| { "name": "id", "displayName": "ID", "shape": "string", "visible": false }, | ||
| { "name": "name", "displayName": "Name", "shape": "string", "role": "label" }, | ||
| { "name": "members", "displayName": "Members", "shape": "json", "visible": false }, | ||
| { "name": "memberCount", "displayName": "Member Count", "shape": "number" }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "name": "userSchedules", | ||
| "displayName": "User Schedules", | ||
| "description": "Schedules the user currently appears in as on-call, one row per matching shift", | ||
| "tags": ["On-Call", "Users"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/schedules", | ||
| "postRequestScript": "userSchedules.js", | ||
| "paging": { | ||
| "mode": "token", | ||
| "pageSize": { "realm": "queryArg", "path": "page_size", "value": "100" }, | ||
| "in": { "realm": "payload", "path": "pagination_meta.after" }, | ||
| "out": { "realm": "queryArg", "path": "after" } | ||
| } | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["User"] } }, | ||
| "metadata": [ | ||
| { "name": "scheduleId", "displayName": "Schedule ID", "shape": "string", "visible": false }, | ||
| { "name": "scheduleName", "displayName": "Schedule", "shape": "string", "role": "label" }, | ||
| { "name": "schedulePermalink", "displayName": "Schedule Link", "shape": "url" }, | ||
| { "name": "start_at", "displayName": "Start", "shape": "date", "role": "timestamp" }, | ||
| { "name": "end_at", "displayName": "End", "shape": "date" }, | ||
| { "name": "rotation_id", "displayName": "Rotation ID", "shape": "string" }, | ||
| { "name": "layer_id", "displayName": "Layer ID", "shape": "string" } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "name": "users", | ||
| "displayName": "Users", | ||
| "description": "All users in the organization, one row per user", | ||
| "tags": ["Users"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "endpointPath": "v2/users", | ||
| "expandInnerObjects": true, | ||
| "pathToData": "users", | ||
| "paging": { | ||
| "mode": "token", | ||
| "pageSize": { "realm": "queryArg", "path": "page_size", "value": "100" }, | ||
| "in": { "realm": "payload", "path": "pagination_meta.after" }, | ||
| "out": { "realm": "queryArg", "path": "after" } | ||
| } | ||
| }, | ||
| "matches": "none", | ||
| "visibility": { "type": "hidden" }, | ||
| "metadata": [ | ||
| { "name": "id", "displayName": "ID", "shape": "string", "visible": false }, | ||
| { "name": "name", "displayName": "Name", "shape": "string", "role": "label" }, | ||
| { "name": "email", "displayName": "Email", "shape": "string" }, | ||
| { "name": "role", "displayName": "Role", "shape": "string" }, | ||
| { "name": "is_active", "displayName": "Active", "shape": "boolean" }, | ||
| { "name": "slack_user_id", "displayName": "Slack User ID", "shape": "string" }, | ||
| { "name": "seats.on_call", "displayName": "On-Call Seat", "shape": "string" }, | ||
| { "name": "seats.response", "displayName": "Response Seat", "shape": "string" }, | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "items": [ | ||
| { "name": "overview", "type": "dashboard" }, | ||
| { "name": "schedulePerspective", "type": "dashboard" }, | ||
| { "name": "teamPerspective", "type": "dashboard" }, | ||
| { "name": "userPerspective", "type": "dashboard" } | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.