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

Add npm download metrics #8

Merged
merged 12 commits into from
Feb 19, 2024
Merged

Add npm download metrics #8

merged 12 commits into from
Feb 19, 2024

Conversation

rkachowski
Copy link
Contributor

@rkachowski rkachowski commented Feb 19, 2024

Description

This pr adds npm download metrics per package taken from npm download count api, for each celo package per day and sends them to prometheus for ingestion into grafana. This adds a new metric declaration and functionality to collect different metric types.

In addition, the code is refactored somewhat

  • Extracted npm / socket logic into discrete files
  • Modified control flow to add explicit init step
  • Some logging changes
  • Created a metric type def to prevent using map[string]interface{} everywhere

Example Prometheus output

# HELP npm_download_count NPM package download count for a given day
# TYPE npm_download_count gauge
npm_download_count{date="2024-02-18",package="@celo/wallet-remote"} 180
npm_download_count{date="2024-02-18",package="@celo/wallet-rpc"} 12
# HELP socket_score Shows socket.dev packages scores
# TYPE socket_score gauge
socket_score{package="@celo/wallet-remote",score="license",version="5.1.2"} 0.8674955154068579
socket_score{package="@celo/wallet-remote",score="maintenance",version="5.1.2"} 0.6597539553864471
socket_score{package="@celo/wallet-remote",score="miscellaneous",version="5.1.2"} 0
socket_score{package="@celo/wallet-remote",score="quality",version="5.1.2"} 0.47630445736698557
socket_score{package="@celo/wallet-remote",score="supplychainrisk",version="5.1.2"} 0.3774902325656003
socket_score{package="@celo/wallet-remote",score="vulnerability",version="5.1.2"} 0.5
socket_score{package="@celo/wallet-rpc",score="license",version="5.1.2"} 0.8674955154068579
socket_score{package="@celo/wallet-rpc",score="maintenance",version="5.1.2"} 0.6597539553864471
socket_score{package="@celo/wallet-rpc",score="miscellaneous",version="5.1.2"} 0
socket_score{package="@celo/wallet-rpc",score="quality",version="5.1.2"} 0.4891786926458545
socket_score{package="@celo/wallet-rpc",score="supplychainrisk",version="5.1.2"} 0.2998454968631518
socket_score{package="@celo/wallet-rpc",score="vulnerability",version="5.1.2"} 0.5

Tested

  • Tested locally
  • Tested on integration-tests cluster (with dev image)

Tickets

@rkachowski rkachowski marked this pull request as ready for review February 19, 2024 13:54
@rkachowski rkachowski requested a review from a team as a code owner February 19, 2024 13:54
@rkachowski rkachowski self-assigned this Feb 19, 2024
@rkachowski rkachowski merged commit 1c8f496 into main Feb 19, 2024
8 checks passed
@rkachowski rkachowski deleted the dhutch/npm_downloads branch February 19, 2024 15:59
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

Successfully merging this pull request may close these issues.

None yet

2 participants