artmizu / nuxt-prometheus Goto Github PK
View Code? Open in Web Editor NEWPrometheus metrics for NodeJS and a set of custom metrics for Nuxt applications
Prometheus metrics for NodeJS and a set of custom metrics for Nuxt applications
hi,
maybe i am doing it wrong but could it be that /metrics is exposed to the internet? if so, is there a way to prevent that? i thought about a nuxt middleware but it seems that the metrics endpoint is intercepted way earlier, before getting to nuxt and therefore ignoring the middleware.
did i miss a setting?
This is my first time using prometheus, I think it's cool and useful,but i have some question.
first http://26.26.26.1:3000 is my local url
when i open http://26.26.26.1:3000/metrics,the web page look like this
and web page look like this when I open http://26.26.26.1:3000/health
but,i wanna web page like the image of README
what should I do
Can you please add nuxt 2.16+ with bridge enabled into module constraints? When Nitro enabled, current version is working as expected, unlike @artmizu/analytics-nuxt-2
Nuxt 3.6.5
@artmizu/nuxt-prometheus: 2.1.3
I get the following error during npm install
or build
or dev
, etc.
Error while requiring module @artmizu/nuxt-prometheus: Error: Cannot find module '/home/runner/work/nuxt-prometheus/nuxt-prometheus/node_modules/.pnpm/[email protected]/node_modules/jiti/lib/index.js'
Thanks for cool module I was always thinking of exporting metrics for promotheus!
A quick review I found some issues:
configKey
seems is wrong analytics
while should probably be promotheus
in module definition and for runtime config (Line 15 in aac4b81
/_promotheus
(or at least _
) by default and provide options to customize or disable eachevent
object - it currently uses a deprecated method without node. prefix . And directly return response (
)prom-client
has around 40kb overhead (https://bundlephobia.com/package/[email protected]), while it is perfectly fine for any Node.js deployment, worker builds especially can enjoy the bundle saving.
Since Prometheus format is super simple, we might replace it with an inline util that renders expected format for exported metrics.
Found invalid calculation of total requests time in your calculateTime
nuxt-prometheus/src/runtime/utils.ts
Line 3 in 7073d48
Ruined test cases are the second and last.
{
input: [
{ start: 1, end: 10 },
{ start: 5, end: 7 },
{ start: 15, end: 30 },
],
res: 24,
},
{
input: [
{ start: 100, end: 101 },
{ start: 100, end: 105 },
{ start: 95, end: 102 },
],
// 5 from function
res: 10,
},
{
input: [
{ start: 53, end: 55 },
{ start: 58, end: 78 },
{ start: 90, end: 95 },
],
res: 27,
},
{
input: [
{ start: 45, end: 75 },
{ start: 65, end: 75 },
{ start: 85, end: 90 },
],
res: 35,
},
{
input: [
{ start: 50, end: 75 },
{ start: 35, end: 55 },
{ start: 10, end: 15 },
{ start: 55, end: 60 },
],
// 25 from function
res: 45,
},
In the last test not sorted input, it possible if Object.values
return different ordered array in different js realizations
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.