GithubHelp home page GithubHelp logo

nuxt-prometheus's People

Contributors

andreyyolkin avatar artmizu avatar github-actions[bot] avatar nwacky avatar tchoupinax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nuxt-prometheus's Issues

prevent access from the internet?

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?

feature request: allow Nuxt Bridge

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

Some improvements

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 (
    configKey: 'analytics',
    )
  • Exposed routes (/metrics, /health) can potentially conflict with user provided routes. Specially metrics. It would be nice to prefix them probably with /_promotheus (or at least _) by default and provide options to customize or disable each
  • Avoid restructuring event object - it currently uses a deprecated method without node. prefix . And directly return response (
    res.end(await register.metrics())
    )
  • Perf: We could probably directly render promethus metrics response and reduce bundle size in https://github.com/artmizu/nuxt-prometheus/blob/main/src/runtime/registry.ts.

Bug: calculation of request time sum

Found invalid calculation of total requests time in your calculateTime

export function calculateTime(data: AnalyticsModuleState) {

Ruined test cases are the second and last.

Test cases
{
      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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.