Skip to content

Commit

Permalink
Merge branch 'main' into revert-893-nikhars/fix/revert-sentry-informer
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhars authored Feb 6, 2025
2 parents 8c0e6e9 + 97dfa1c commit f978a7d
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FEED_ENGINEERING_CHANNEL_ID="33333333"
FEED_SDKS_CHANNEL_ID="42424242"
DISABLE_GITHUB_METRICS="false"
FORCE_GET_USER_BY_SLACK_ID=
TEAM_OSPO_CHANNEL_ID=
TEAM_DEV_INFRA_CHANNEL_ID=
SUPPORT_CHANNEL_ID=
DRY_RUN=

Expand Down
23 changes: 12 additions & 11 deletions product-owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ product_areas:
Issues - Suggested Fix:
- team-machine-learning
Org Relocation:
- team-ospo
- team-dev-infra
Other:
- team-ospo
- team-dev-infra
Performance:
- team-performance
Processing:
Expand Down Expand Up @@ -94,18 +94,18 @@ product_areas:
Stats:
- team-revenue
Unknown:
- team-ospo
- team-dev-infra
User Feedback:
- team-replays
What's New:
- team-product
repos:
arroyo: team-sns
cdc: team-sns
craft: team-ospo
craft: team-dev-infra
relay: team-ingest
responses: team-ospo
self-hosted: team-ospo
responses: team-dev-infra
self-hosted: team-dev-infra
sentry-android-gradle-plugin: team-mobile-sdks
sentry-cli: team-web-backend-sdks
sentry-cocoa: team-mobile-sdks
Expand Down Expand Up @@ -156,7 +156,12 @@ teams:
team-dashboards:
offices:
- yyz
slack_channel: C01MYDW8Y7K
slack_channel: C026Y0SK34H
team-dev-infra:
offices:
- sfo
- sea
slack_channel: C05816N2A2K
team-docs:
offices:
- sea
Expand Down Expand Up @@ -204,10 +209,6 @@ teams:
offices:
- vie
slack_channel: C0190510ABF
team-ospo:
offices:
- sea
slack_channel: C04B27EECUB
team-ourlogs:
offices:
- yyz
Expand Down
6 changes: 3 additions & 3 deletions src/brain/github/githubMetrics/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('github webhook', function () {
timeToTriageBy: null,
timeToRouteBy: null,
product_area: null,
teams: ['team-ospo'],
teams: ['team-dev-infra'],
},
{ schema: SCHEMA }
);
Expand Down Expand Up @@ -174,7 +174,7 @@ describe('github webhook', function () {
timeToTriageBy: null,
timeToRouteBy: null,
product_area: null,
teams: ['team-ospo'],
teams: ['team-dev-infra'],
},
{ schema: SCHEMA }
);
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('github webhook', function () {
timeToTriageBy: null,
timeToRouteBy: null,
product_area: null,
teams: ['team-ospo'],
teams: ['team-dev-infra'],
},
{ schema: SCHEMA }
);
Expand Down
11 changes: 5 additions & 6 deletions src/brain/github/issueLabelHandler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

## Time to Triage

We track Time to Triage [as an SLO][looker] for the OSPO and the
EPD org as a whole. The computation is [defined in LookML][implementation]
based on the `Status: Untriaged` label. The handler in this directory
implements logic to manipulate the `Status: Untriaged` label in repos that are
owned by one team (i.e., not `sentry`; that's done with [a GitHub
Action][action]). Here is the logic:
We track Time to Triage [as an SLO][looker] for EPD. The computation is
[defined in LookML][implementation] based on the `Status: Untriaged` label. The
handler in this directory implements logic to manipulate the `Status:
Untriaged` label in repos that are owned by one team (i.e., not `sentry`;
that's done with [a GitHub Action][action]). Here is the logic:

1. Apply `Status: Untriaged` to new issues/PRs from external users.

Expand Down
2 changes: 1 addition & 1 deletion src/brain/github/issueLabelHandler/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ describe('issueLabelHandler', function () {
expect(org.api.issues._labels).toContain(WAITING_FOR_PRODUCT_OWNER_LABEL);
expect(org.api.issues._comments).toEqual([
'Assigning to @getsentry/support for [routing](https://open.sentry.io/triage/#2-route) ⏲️',
'Failed to route for Product Area: Does Not Exist. Defaulting to @getsentry/open-source for [triage](https://develop.sentry.dev/processing-tickets/#3-triage) ⏲️',
'Failed to route for Product Area: Does Not Exist. Defaulting to @getsentry/dev-infra for [triage](https://develop.sentry.dev/processing-tickets/#3-triage) ⏲️',
]);
expect(modifyProjectIssueFieldSpy).toHaveBeenCalled();
});
Expand Down
2 changes: 1 addition & 1 deletion src/brain/github/issueLabelHandler/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async function routeIssue(org, productAreaLabelName) {
return `Routing to @${org.slug}/${ghTeamSlug} for [triage](https://develop.sentry.dev/processing-tickets/#3-triage) ⏲️`;
} catch (error) {
Sentry.captureException(error);
return `Failed to route for ${productAreaLabelName}. Defaulting to @${org.slug}/open-source for [triage](https://develop.sentry.dev/processing-tickets/#3-triage) ⏲️`;
return `Failed to route for ${productAreaLabelName}. Defaulting to @${org.slug}/dev-infra for [triage](https://develop.sentry.dev/processing-tickets/#3-triage) ⏲️`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/brain/slack/triggerPubSub/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createSlackAppMention } from '@test/utils/createSlackAppMention';
import { buildServer } from '@/buildServer';
import * as slackScoresFunctions from '@/jobs/slackScores';

import { TEAM_OSPO_CHANNEL_ID } from '../../../config';
import { TEAM_DEV_INFRA_CHANNEL_ID } from '../../../config';

import { triggerPubSub } from '.';

Expand All @@ -30,7 +30,7 @@ describe('slack app', function () {
jest.clearAllMocks();
});

it('does not do anything if channel is not ospo team channel', async function () {
it('does not do anything if channel is not dev-infra team channel', async function () {
const response = await createSlackAppMention(
fastify,
'<@U018UAXJVG8> ttr',
Expand All @@ -45,7 +45,7 @@ describe('slack app', function () {
const response = await createSlackAppMention(
fastify,
'<@U018UAXJVG8> ttr',
TEAM_OSPO_CHANNEL_ID
TEAM_DEV_INFRA_CHANNEL_ID
);
expect(response.statusCode).toBe(200);
expect(sendGitHubEngagementMetricsSpy).toHaveBeenCalledWith(true);
Expand All @@ -56,7 +56,7 @@ describe('slack app', function () {
const response = await createSlackAppMention(
fastify,
'<@U018UAXJVG8> activity',
TEAM_OSPO_CHANNEL_ID
TEAM_DEV_INFRA_CHANNEL_ID
);
expect(response.statusCode).toBe(200);
expect(sendGitHubEngagementMetricsSpy).not.toHaveBeenCalled();
Expand Down
4 changes: 2 additions & 2 deletions src/brain/slack/triggerPubSub/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TEAM_OSPO_CHANNEL_ID } from '@/config';
import { TEAM_DEV_INFRA_CHANNEL_ID } from '@/config';
import {
sendGitHubActivityMetrics,
sendGitHubEngagementMetrics,
Expand All @@ -8,7 +8,7 @@ import { bolt } from '@api/slack';

export const slackHandler = async ({ event }) => {
const { channel, text } = event;
if (channel !== TEAM_OSPO_CHANNEL_ID) {
if (channel !== TEAM_DEV_INFRA_CHANNEL_ID) {
return;
}
if (text.includes('ttr')) {
Expand Down
6 changes: 3 additions & 3 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export const KAFKA_CONTROL_PLANE_CHANNEL_ID = // #feed-topicctl
// Till we test things out, this points to #feed-sentry-informer
export const TRIAGE_INCIDENTS_CHANNED_ID = // #triage-incidents
process.env.TRIAGE_INCIDENTS_CHANNED_ID || 'C0874TSSHN1';
export const SUPPORT_CHANNEL_ID = // #discuss-support-open-source
export const SUPPORT_CHANNEL_ID = // #discuss-support-github
process.env.SUPPORT_CHANNEL_ID || 'C02KHRNRZ1B';
export const TEAM_OSPO_CHANNEL_ID = // #team-ospo
process.env.TEAM_OSPO_CHANNEL_ID || 'G01F3FQ0T41';
export const TEAM_DEV_INFRA_CHANNEL_ID = // #team-dev-infra
process.env.TEAM_DEV_INFRA_CHANNEL_ID || 'G01F13Y6AQ0';
export const TEAM_PRODUCT_OWNERS_CHANNEL_ID =
process.env.TEAM_PRODUCT_OWNERS_CHANNEL_ID || 'C063DCB4PGF';
export const DISCUSS_PRODUCT_CHANNEL_ID = // #discuss-product
Expand Down
16 changes: 8 additions & 8 deletions src/jobs/slackScores.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { bolt } from '@api/slack';

import {
DISCUSS_PRODUCT_CHANNEL_ID,
TEAM_OSPO_CHANNEL_ID,
TEAM_DEV_INFRA_CHANNEL_ID,
TEAM_PRODUCT_OWNERS_CHANNEL_ID,
} from '../config';

Expand Down Expand Up @@ -97,7 +97,7 @@ describe('slackScores tests', function () {
await sendGitHubEngagementMetrics(true);
expect(postMessageSpy).toHaveBeenCalledWith(
expect.objectContaining({
channel: TEAM_OSPO_CHANNEL_ID,
channel: TEAM_DEV_INFRA_CHANNEL_ID,
})
);
});
Expand All @@ -123,11 +123,11 @@ describe('slackScores tests', function () {
├────────────────────────────────────────────────┤
| No Volume |
├────────────────────────────────────────────────┤
| dev-infra | - (0/0) |
| enterprise | - (0/0) |
| ingest | - (0/0) |
| issues | - (0/0) |
| null | - (0/0) |
| ospo | - (0/0) |
└────────────────────────────────────────────────┘\`\`\``,
type: 'mrkdwn',
},
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('slackScores tests', function () {
├────────────────────────────────────────────────┤
| Low Volume |
├────────────────────────────────────────────────┤
| ospo | 100 (1/1) |
| dev-infra | 100 (1/1) |
| enterprise | 0 (0/1) |
├────────────────────────────────────────────────┤
| No Volume |
Expand Down Expand Up @@ -251,11 +251,11 @@ describe('slackScores tests', function () {
├────────────────────────────────────────────────┤
| No Volume |
├────────────────────────────────────────────────┤
| dev-infra | - (0/0) |
| enterprise | - (0/0) |
| ingest | - (0/0) |
| issues | - (0/0) |
| null | - (0/0) |
| ospo | - (0/0) |
└────────────────────────────────────────────────┘\`\`\``,
type: 'mrkdwn',
},
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('slackScores tests', function () {
├────────────────────────────────────────────────┤
| Low Volume |
├────────────────────────────────────────────────┤
| ospo | 100 (1/1) |
| dev-infra | 100 (1/1) |
├────────────────────────────────────────────────┤
| No Volume |
├────────────────────────────────────────────────┤
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('slackScores tests', function () {
expect(postMessageSpy).not.toHaveBeenCalled();
});

it('should send github activity metrics properly to ospo team channel for testing', async () => {
it('should send github activity metrics properly to dev-infra team channel for testing', async () => {
const discussions = [
{
title: 'Discussion 1',
Expand Down Expand Up @@ -359,7 +359,7 @@ describe('slackScores tests', function () {
await sendGitHubActivityMetrics(true);
expect(postMessageSpy).toHaveBeenCalledWith(
expect.objectContaining({
channel: TEAM_OSPO_CHANNEL_ID,
channel: TEAM_DEV_INFRA_CHANNEL_ID,
})
);
});
Expand Down
14 changes: 7 additions & 7 deletions src/jobs/slackScores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
FEED_ENGINEERING_CHANNEL_ID,
GETSENTRY_ORG,
PRODUCT_OWNERS_INFO,
TEAM_OSPO_CHANNEL_ID,
TEAM_DEV_INFRA_CHANNEL_ID,
TEAM_PRODUCT_OWNERS_CHANNEL_ID,
} from '@/config';
import {
Expand Down Expand Up @@ -73,7 +73,7 @@ export const sendApisPublishStatus = async () => {
};

export const sendGitHubEngagementMetrics = async (
ospo_internal: boolean = false
dev_infra_internal: boolean = false
) => {
const teamScores: teamScoreInfo[] = await Promise.all(
Object.keys(PRODUCT_OWNERS_INFO['teams']).map(async (team: string) => {
Expand Down Expand Up @@ -195,8 +195,8 @@ export const sendGitHubEngagementMetrics = async (
text: '```' + scoreBoard + '```',
},
});
const channelsToPost = ospo_internal
? [TEAM_OSPO_CHANNEL_ID]
const channelsToPost = dev_infra_internal
? [TEAM_DEV_INFRA_CHANNEL_ID]
: [TEAM_PRODUCT_OWNERS_CHANNEL_ID];
const slackNotifications = channelsToPost.map((channelId: string) => {
return bolt.client.chat.postMessage({
Expand All @@ -209,7 +209,7 @@ export const sendGitHubEngagementMetrics = async (
};

export const sendGitHubActivityMetrics = async (
ospo_internal: boolean = false
dev_infra_internal: boolean = false
) => {
const { discussions, gitHubCommenters, issues } =
await getGitHubActivityMetrics();
Expand Down Expand Up @@ -323,8 +323,8 @@ export const sendGitHubActivityMetrics = async (
text: '```' + scoreBoard + '```',
},
});
const channelToPost = ospo_internal
? TEAM_OSPO_CHANNEL_ID
const channelToPost = dev_infra_internal
? TEAM_DEV_INFRA_CHANNEL_ID
: DISCUSS_PRODUCT_CHANNEL_ID;
await bolt.client.chat.postMessage({
channel: channelToPost,
Expand Down
10 changes: 5 additions & 5 deletions src/utils/db/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('metrics tests', function () {
testPayload.repository.name = 'routing-repo';
const result = await insertOss('issues', testPayload);
expect(result).toMatchObject({
teams: ['team-ospo'],
teams: ['team-dev-infra'],
product_area: 'One-Team',
});
});
Expand All @@ -163,7 +163,7 @@ describe('metrics tests', function () {
testPayload.repository.name = 'routing-repo';
const result = await insertOss('issues', testPayload);
expect(result).toMatchObject({
teams: ['team-ospo'],
teams: ['team-dev-infra'],
product_area: 'One-Team',
});
});
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('metrics tests', function () {
testPayload.comment = { id: 123, created_at: null, updated_at: null };
const result = await insertOss('issue_comment', testPayload);
expect(result).toMatchObject({
teams: ['team-ospo'],
teams: ['team-dev-infra'],
product_area: 'One-Team',
target_name: 'Test Issue',
});
Expand Down Expand Up @@ -259,7 +259,7 @@ describe('metrics tests', function () {
target_id: 1,
target_name: 'Issue Title',
target_type: 'issue',
teams: ['team-ospo'],
teams: ['team-dev-infra'],
timeToRouteBy: null,
timeToTriageBy: null,
type: 'issue_comment',
Expand All @@ -284,7 +284,7 @@ describe('metrics tests', function () {
target_id: 1,
target_name: 'Pull Request Title',
target_type: 'pull_request',
teams: ['team-ospo'],
teams: ['team-dev-infra'],
timeToRouteBy: null,
timeToTriageBy: null,
type: 'pull_request_comment',
Expand Down
4 changes: 2 additions & 2 deletions src/utils/db/scores.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('score tests', () => {
jest.clearAllMocks();
});
it('should send the right sql we expect for getIssueEventsForTeam', () => {
getIssueEventsForTeam('team-ospo');
getIssueEventsForTeam('team-dev-infra');
const query = `WITH labelings AS (
SELECT
issues.object_id AS issue_id,
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('score tests', () => {
triage_by_dt,
FROM
issues_to_count
WHERE 'team-ospo' in UNNEST(teams)
WHERE 'team-dev-infra' in UNNEST(teams)
;`;
expect(mockQuery).toHaveBeenCalledWith(query);
});
Expand Down
Loading

0 comments on commit f978a7d

Please sign in to comment.