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

Expose stats via prometheus #517

Closed
abhisheksurve45 opened this issue Mar 16, 2023 · 2 comments
Closed

Expose stats via prometheus #517

abhisheksurve45 opened this issue Mar 16, 2023 · 2 comments

Comments

@abhisheksurve45
Copy link

abhisheksurve45 commented Mar 16, 2023

Hi, is it possible to expose the stats via prometheus

image

The monitor option just shows on console

@teammakdi
Copy link

teammakdi commented Mar 17, 2023

    const puppeteer = addExtra(vanillaPuppeteer)

    const cluster = await Cluster.launch()
    const clusterSize = cluster.jobQueue.size()
    clusterSizeMetric.set(clusterSize)

    const availableWorkers = cluster.workersAvail.length
    const busyWorkers = cluster.workersBusy.length
    const totalWorkers = cluster.workers.length
    crawlerWorkerQueueMetric.labels('available').set(availableWorkers)
    crawlerWorkerQueueMetric.labels('busy').set(busyWorkers)
    crawlerWorkerQueueMetric.labels('total').set(totalWorkers)

    const cpuUsage = cluster.systemMonitor.cpuUsage
    const memory = cluster.systemMonitor.memoryUsage
    crawlerClusterTelemetryMetric.labels('cpu_usage').set(cpuUsage)
    crawlerClusterTelemetryMetric.labels('memory_usage').set(memory)

@jwgo
Copy link

jwgo commented Mar 24, 2023

https://www.npmjs.com/package/@devgo/puppeteer-cluster?activeTab=readme#clustergetmonitorobject

I've released it with what's in the PR and a few features I need, so check it out and do with it what you will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants