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

remove api key from metric #1431

Merged
merged 1 commit into from
Jan 8, 2025
Merged
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
11 changes: 9 additions & 2 deletions apps/scheduler/create-alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ export async function createAlerts(chainId: string): Promise<void> {
const subgraphsToAlert: { subgraphName: string; subgraphUrl: string }[] = [];

for (const [subgraphName, subgraphUrl] of subgraphs) {
subgraphsToAlert.push({ subgraphName, subgraphUrl });
let subgraphUrlClean = subgraphUrl;
if (subgraphUrl.includes('gateway')) {
const parts = subgraphUrl.split('/');
parts.splice(4, 1);
subgraphUrlClean = parts.join('/');
}

subgraphsToAlert.push({ subgraphName, subgraphUrl: subgraphUrlClean });
}

await createSubgraphLagAlertsIfNotExist(chainId, config.data.chain.slug, subgraphsToAlert);
Expand Down Expand Up @@ -159,7 +166,7 @@ async function createSubgraphLagAlertsIfNotExist(
// upsert all other alarms
for (const subgraph of subgraphs) {
const alarmName = `${ALARM_PREFIX}:${subgraph.subgraphName}`;
const metricName = `${chainSlug}-${subgraph.subgraphName}-${subgraph.subgraphUrl}-lag`;
const metricName = `${chainSlug}-${subgraph.subgraphName}-lag-${subgraph.subgraphUrl}`;

//make sure metric is available for alarm
await subgraphMetricPublisher.publish(metricName, 0);
Expand Down
13 changes: 8 additions & 5 deletions modules/controllers/subgraph-monitor-controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { Chain } from '@prisma/client';
import { syncMerklRewards } from '../actions/aprs/merkl';
import { SwapFeeFromSnapshotsAprService } from '../pool/lib/apr-data-sources/swap-fee-apr-from-snapshots.service';
import { prisma } from '../../prisma/prisma-client';
import { subgraphMetricPublisher } from '../metrics/metrics.client';
import { AllNetworkConfigs } from '../network/network-config';
import { GaugeSubgraphService } from '../subgraphs/gauge-subgraph/gauge-subgraph.service';
Expand All @@ -28,8 +24,15 @@ export function SubgraphMonitorController(tracer?: any) {
const meta = await subgraph.getMetadata();
lag = Math.max(Number(latestBlock) - meta.block.number, 0);

let subgraphUrlClean = subgraphUrl;
if (subgraphUrl.includes('gateway')) {
const parts = subgraphUrl.split('/');
parts.splice(4, 1);
subgraphUrlClean = parts.join('/');
}

subgraphMetricPublisher.publish(
`${config.data.chain.slug}-${subgraphName}-${subgraphUrl}-lag`,
`${config.data.chain.slug}-${subgraphName}-lag-${subgraphUrl}`,
lag,
);
}
Expand Down
Loading