Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions backend/.env.dist.local
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ CROWD_ORGANIZATION_ENRICHMENT_API_KEY=
CROWD_EAGLE_EYE_URL=
CROWD_EAGLE_EYE_API_KEY=

# Slack alerting settings
CROWD_SLACK_ALERTING_URL=

# Weekly emails settings
CROWD_WEEKLY_EMAILS_ENABLED="true"

Expand Down
3 changes: 0 additions & 3 deletions backend/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@
"installationId": "GITHUB_TOKEN_INSTALLATION_ID",
"privateKey": "GITHUB_TOKEN_PRIVATE_KEY"
},
"slackAlerting": {
"url": "CROWD_SLACK_ALERTING_URL"
},
"weeklyEmails": {
"enabled": "CROWD_WEEKLY_EMAILS_ENABLED"
},
Expand Down
3 changes: 0 additions & 3 deletions backend/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
"organizationEnrichment": {},
"eagleEye": {},
"githubToken": {},
"slackAlerting": {
"url": ""
},
"auth0": {},
"sso": {},
"crowdAnalytics": {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/api/apiResponseHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class ApiResponseHandler extends LoggerBase {
}

sendSlackNotification(
SlackChannel.ALERTS,
SlackChannel.CDP_ALERTS,
SlackPersona.ERROR_REPORTER,
`API Error ${code}: ${req.method} ${req.url}`,
sections,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/api/public/middlewares/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const errorHandler: ErrorRequestHandler = (
)

sendSlackNotification(
SlackChannel.ALERTS,
SlackChannel.CDP_ALERTS,
SlackPersona.ERROR_REPORTER,
`Public API Error 500: ${req.method} ${req.url}`,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export async function verifyMemberIdentity(req: Request, res: Response): Promise
} catch (error) {
req.log.warn({ error }, 'Audit log capture failed after identity unmerge')
sendSlackNotification(
SlackChannel.ALERTS,
SlackChannel.CDP_ALERTS,
SlackPersona.ERROR_REPORTER,
`Audit log capture failed after identity unmerge: member ${memberId}`,
[{ title: 'Error', text: `\`${error?.message || error}\`` }],
Expand All @@ -164,7 +164,7 @@ export async function verifyMemberIdentity(req: Request, res: Response): Promise
} catch (error) {
req.log.warn({ error }, 'Failed to start unmerge workflow after identity unmerge')
sendSlackNotification(
SlackChannel.ALERTS,
SlackChannel.CDP_ALERTS,
SlackPersona.ERROR_REPORTER,
`Failed to start unmerge workflow after identity unmerge: member ${memberId}`,
[
Expand Down
4 changes: 0 additions & 4 deletions backend/src/conf/configTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ export interface StackExchangeConfiguration {
key: string
}

export interface SlackAlertingConfiguration {
url: string
}

export interface IntegrationProcessingConfiguration {
maxRetries: number
}
Expand Down
4 changes: 0 additions & 4 deletions backend/src/conf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
SSOConfiguration,
SegmentConfiguration,
ServiceType,
SlackAlertingConfiguration,
SlackConfiguration,
SnowflakeConfiguration,
StackExchangeConfiguration,
Expand Down Expand Up @@ -132,9 +131,6 @@ export const STACKEXCHANGE_CONFIG: StackExchangeConfiguration =
key: process.env.STACKEXCHANGE_KEY,
}

export const SLACK_ALERTING_CONFIG: SlackAlertingConfiguration =
config.get<SlackAlertingConfiguration>('slackAlerting')

export const INTEGRATION_PROCESSING_CONFIG: IntegrationProcessingConfiguration =
config.get<IntegrationProcessingConfiguration>('integrationProcessing')

Expand Down
4 changes: 2 additions & 2 deletions services/apps/cron_service/src/jobs/nangoMonitoring.job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ const job: IJobDefinition = {
// Queue notification for this platform
notificationPromises.push(
sendSlackNotificationAsync(
SlackChannel.NANGO_ALERTS,
SlackChannel.CDP_INTEGRATIONS_ALERTS,
persona,
`Nango Monitor: ${nangoIntegration}`,
sections,
Expand All @@ -344,7 +344,7 @@ const job: IJobDefinition = {
if (failedStatusChecks > 0) {
notificationPromises.push(
sendSlackNotificationAsync(
SlackChannel.NANGO_ALERTS,
SlackChannel.CDP_INTEGRATIONS_ALERTS,
SlackPersona.ERROR_REPORTER,
'Nango Monitor: API Errors',
`Failed to retrieve status for ${failedStatusChecks} connection${failedStatusChecks > 1 ? 's' : ''} due to Nango API errors.\n\nCheck logs for details.`,
Expand Down
2 changes: 1 addition & 1 deletion services/apps/cron_service/src/jobs/queueMonitoring.job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const job: IJobDefinition = {

if (msg && msg.trim().length > 0) {
await sendSlackNotificationAsync(
SlackChannel.ALERTS,
SlackChannel.CDP_CRITICAL_ALERTS,
SlackPersona.WARNING_PROPAGATOR,
'Queue Monitoring Alert',
msg,
Expand Down
2 changes: 1 addition & 1 deletion services/apps/cron_service/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const queueJob = async (job: IJobDefinition) => {

if (err instanceof Error && err.message.includes('did not finish in time')) {
sendSlackNotificationAsync(
SlackChannel.ALERTS,
SlackChannel.CDP_CRITICAL_ALERTS,
SlackPersona.CRITICAL_ALERTER,
`Cron job timed out: ${job.name}`,
`Job \`${job.name}\` was killed after exceeding its ${job.timeout}s timeout (ran for ${diff}s).`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"brokers": "CROWD_KAFKA_BROKERS",
"extra": "CROWD_KAFKA_EXTRA"
},
"slackAlerting": {
"url": "CROWD_SLACK_ALERTING_URL"
},
"redis": {
"username": "CROWD_REDIS_USERNAME",
"password": "CROWD_REDIS_PASSWORD",
Expand Down
12 changes: 0 additions & 12 deletions services/apps/data_sink_worker/src/conf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import { IRedisConfiguration } from '@crowd/redis'
import { ITemporalConfig } from '@crowd/temporal'
import { QueuePriorityLevel } from '@crowd/types'

export interface ISlackAlertingConfig {
url: string
}

export interface IGithubConfig {
isSnowflakeEnabled: string
}
Expand Down Expand Up @@ -52,14 +48,6 @@ export const DB_CONFIG = (): IDatabaseConfig => {
return dbConfig
}

let slackAlertingConfig: ISlackAlertingConfig
export const SLACK_ALERTING_CONFIG = (): ISlackAlertingConfig => {
if (slackAlertingConfig) return slackAlertingConfig

slackAlertingConfig = config.get<ISlackAlertingConfig>('slackAlerting')
return slackAlertingConfig
}

let temporalConfig: ITemporalConfig | undefined
export const TEMPORAL_CONFIG = (): ITemporalConfig | undefined => {
if (temporalConfig) return temporalConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
"url": "CROWD_NANGO_URL",
"secretKey": "CROWD_NANGO_SECRET_KEY"
},
"slackAlerting": {
"url": "CROWD_SLACK_ALERTING_URL"
},
"github": {
"appId": "CROWD_GITHUB_APP_ID",
"clientId": "CROWD_GITHUB_CLIENT_ID",
Expand Down
11 changes: 0 additions & 11 deletions services/apps/integration_run_worker/src/conf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export interface INangoConfig {
secretKey: string
}

export interface ISlackAlertingConfig {
url: string
}
export interface ILokiDbConfig {
url: string
token: string
Expand Down Expand Up @@ -64,14 +61,6 @@ export const NANGO_CONFIG = (): INangoConfig => {
return nangoConfig
}

let slackAlertingConfig: ISlackAlertingConfig
export const SLACK_ALERTING_CONFIG = (): ISlackAlertingConfig => {
if (slackAlertingConfig) return slackAlertingConfig

slackAlertingConfig = config.get<ISlackAlertingConfig>('slackAlerting')
return slackAlertingConfig
}

const platformMap: Map<string, unknown | null> = new Map()
export const PLATFORM_CONFIG = (platform: string): unknown | undefined => {
if (platformMap.has(platform)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function executeCleanup(intervalHours = 24): Promise<void> {
} catch (err) {
log.error({ jobId: job.id, s3Path: job.s3Path, err }, 'Failed to clean job, skipping')
sendSlackNotification(
SlackChannel.INTEGRATION_NOTIFICATIONS,
SlackChannel.CDP_INTEGRATIONS_ALERTS,
SlackPersona.ERROR_REPORTER,
'Snowflake S3 Cleanup Failed',
`Failed to clean job \`${job.id}\` at \`${job.s3Path}\`.\n\n*Error:* ${err instanceof Error ? err.message : err}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const scheduleSnowflakeS3Cleanup = async () => {
} else {
svc.log.error({ err }, 'Failed to create snowflake-s3-cleanup schedule')
sendSlackNotification(
SlackChannel.INTEGRATION_NOTIFICATIONS,
SlackChannel.CDP_INTEGRATIONS_ALERTS,
SlackPersona.ERROR_REPORTER,
'Snowflake S3 Cleanup Schedule Failed',
`Failed to create the \`snowflake-s3-cleanup\` Temporal schedule.\n\n*Error:* ${err.message || err}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const scheduleSnowflakeS3Export = async () => {
} else {
svc.log.error({ err }, 'Failed to create snowflake-s3-export schedule')
sendSlackNotification(
SlackChannel.INTEGRATION_NOTIFICATIONS,
SlackChannel.CDP_INTEGRATIONS_ALERTS,
SlackPersona.ERROR_REPORTER,
'Snowflake S3 Export Schedule Failed',
`Failed to create the \`snowflake-s3-export\` Temporal schedule.\n\n*Error:* ${err.message || err}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ActivityMonitoringInterceptor implements ActivityInboundCallsInterc

// Fire and forget - don't await to avoid blocking the activity
sendSlackNotificationAsync(
SlackChannel.ALERTS,
SlackChannel.CDP_ALERTS,
SlackPersona.WARNING_PROPAGATOR,
'High Activity Retry Count',
message,
Expand Down
2 changes: 1 addition & 1 deletion services/archetypes/worker/src/activities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function telemetryIncrement(
async function slackNotify(message: string, persona: SlackPersona | string) {
// Accept string to allow workflow code to pass string literals without importing enum
await sendSlackNotificationAsync(
SlackChannel.ALERTS,
SlackChannel.CDP_ALERTS,
persona as SlackPersona,
'Temporal Alert',
message,
Expand Down
12 changes: 6 additions & 6 deletions services/libs/slack/src/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { SlackChannel, SlackChannelConfig } from './types'
const log = getServiceLogger()

const CHANNEL_WEBHOOK_URLS: Record<SlackChannel, string | undefined> = {
[SlackChannel.ALERTS]: process.env.CM_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.DATA_ALERTS]: process.env.CM_DATA_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.INTEGRATION_NOTIFICATIONS]:
process.env.CM_INTEGRATION_NOTIFICATIONS_SLACK_WEBHOOK_URL,
[SlackChannel.NANGO_ALERTS]: process.env.CM_NANGO_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.CDP_ALERTS]: process.env.CDP_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.CDP_CRITICAL_ALERTS]: process.env.CDP_CRITICAL_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.CDP_DATA_QUALITY_ALERTS]: process.env.CDP_DATA_QUALITY_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.CDP_INTEGRATIONS_ALERTS]: process.env.CDP_INTEGRATIONS_ALERTS_SLACK_WEBHOOK_URL,
[SlackChannel.CDP_PROJECTS_ALERTS]: process.env.CDP_PROJECTS_ALERTS_SLACK_WEBHOOK_URL,
}

// Check for missing webhook URLs on initialization
Expand All @@ -26,7 +26,7 @@ function checkChannelConfigurations(): void {
if (missingChannels.length > 0) {
log.warn(
{ missingChannels },
`Slack webhook URLs not configured for channels: ${missingChannels.join(', ')}. Set CM_{CHANNEL}_SLACK_WEBHOOK_URL environment variables.`,
`Slack webhook URLs not configured for channels: ${missingChannels.join(', ')}. Set the following env vars: ${missingChannels.map((c) => `${c}_SLACK_WEBHOOK_URL`).join(', ')}.`,
)
} else {
log.debug('All Slack channel webhook URLs are configured')
Expand Down
2 changes: 1 addition & 1 deletion services/libs/slack/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getWebhookClient(channel: SlackChannel): IncomingWebhook | null
if (!config.webhookUrl) {
log.warn(
{ channel },
`Slack webhook URL not configured for channel ${channel}. Set CM_${channel}_SLACK_WEBHOOK_URL environment variable.`,
`Slack webhook URL not configured for channel ${channel}. Set ${channel}_SLACK_WEBHOOK_URL environment variable.`,
)
return null
}
Expand Down
9 changes: 5 additions & 4 deletions services/libs/slack/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export enum SlackChannel {
ALERTS = 'ALERTS',
DATA_ALERTS = 'DATA_ALERTS',
INTEGRATION_NOTIFICATIONS = 'INTEGRATION_NOTIFICATIONS',
NANGO_ALERTS = 'NANGO_ALERTS',
CDP_ALERTS = 'CDP_ALERTS',
CDP_CRITICAL_ALERTS = 'CDP_CRITICAL_ALERTS',
CDP_DATA_QUALITY_ALERTS = 'CDP_DATA_QUALITY_ALERTS',
CDP_INTEGRATIONS_ALERTS = 'CDP_INTEGRATIONS_ALERTS',
CDP_PROJECTS_ALERTS = 'CDP_PROJECTS_ALERTS',
}

export enum SlackPersona {
Expand Down
Loading