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

Move the prometheus monitoring for fill feed to the calling script #246

Merged
merged 2 commits into from
Oct 31, 2024
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
36 changes: 0 additions & 36 deletions client/ts/src/fillFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { PROGRAM_ID } from './manifest';
import { convertU128 } from './utils/numbers';
import { genAccDiscriminator } from './utils/discriminator';
import * as promClient from 'prom-client';
import express from 'express';
import promBundle from 'express-prom-bundle';
import { FillLogResult } from './types';

// For live monitoring of the fill feed. For a more complete look at fill
Expand Down Expand Up @@ -182,40 +180,6 @@ export class FillFeed {
}
}

/**
* Run a fill feed as a websocket server that clients can connect to and get
* notifications of fills for all manifest markets.
*/
export async function runFillFeed() {
const connection: Connection = new Connection(
process.env.RPC_URL || 'http://127.0.0.1:8899',
'confirmed',
);

promClient.collectDefaultMetrics({
labels: {
app: 'fillFeed',
},
});

const register = new promClient.Registry();
register.setDefaultLabels({
app: 'fillFeed',
});
const metricsApp = express();
metricsApp.listen(8080);

const promMetrics = promBundle({
includeMethod: true,
metricsApp,
autoregister: false,
});
metricsApp.use(promMetrics);

const fillFeed: FillFeed = new FillFeed(connection);
await fillFeed.parseLogs();
}

const fillDiscriminant = genAccDiscriminator('manifest::logs::FillLog');

function toFillLogResult(
Expand Down
3 changes: 3 additions & 0 deletions debug-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"@solana/wallet-adapter-react-ui": "^0.9.35",
"@solana/wallet-adapter-wallets": "^0.19.32",
"@solana/web3.js": "^1.95.0",
"express": "^4.21.0",
"express-prom-bundle": "^7.0.0",
"lightweight-charts": "^4.2.0",
"next": "14.2.5",
"prom-client": "^15.1.3",
"react": "^18.2.0",
"react-dom": "^18",
"react-toastify": "^10.0.5"
Expand Down
24 changes: 24 additions & 0 deletions debug-ui/scripts/start-fill-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import 'dotenv/config';
import { FillFeed } from '@cks-systems/manifest-sdk/fillFeed';
import { Connection } from '@solana/web3.js';
import { sleep } from '@/lib/util';
import * as promClient from 'prom-client';
import express from 'express';
import promBundle from 'express-prom-bundle';

const { RPC_URL } = process.env;

Expand All @@ -28,6 +31,27 @@ const monitorFeed = async (feed: FillFeed) => {
};

const run = async () => {
// Prometheus monitoring for this feed on the default prometheus port.
promClient.collectDefaultMetrics({
labels: {
app: 'fillFeed',
},
});

const register = new promClient.Registry();
register.setDefaultLabels({
app: 'fillFeed',
});
const metricsApp = express();
metricsApp.listen(9090);

const promMetrics = promBundle({
includeMethod: true,
metricsApp,
autoregister: false,
});
metricsApp.use(promMetrics);

const timeoutMs = 5_000;

console.log('starting feed...');
Expand Down
Loading
Loading