Giter VIP home page Giter VIP logo

moleculer-metrics's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

moleculer-metrics's Issues

RangeError: Invalid string lenght

Hello, I am a graduate student in electrical engineering from the State University of São Paulo, Brazil - SP and we are using the molecular framework as the basis for our project.

We would like to do the orchestration and choreography of microservices applied in an industrial plant to control a level mesh comparing the total execution time as well as the time of each route.

To do this we saw that you have the molecular-console-tracer module, we created a basic orchestration service to call each node's hello services sequentially:

// services/ orchestration.service.js

"use strict";

module.exports = {
	name: "orchestration", 
	actions: {   
		async start(ctx){			
			await ctx.call("greeter.hello",{},{nodeID: "node-12"})
			await ctx.call("greeter.hello",{},{nodeID: "node-13"})
			await ctx.call("greeter.hello",{},{nodeID: "node-21"})
	   }
	},
};

We did 2 tests before we ran our application to understand it better. The provision of services was distributed as follows in the tests:

Test 1:
image

Result 1
image

Test 2:
image

Result 2

image

As you can see in our test 2 when calling node-21's greeter.hello service that is on raspberry we got an error (RangeError: Invalid string lenght) show in the figure above in results.

Could you help me remedy this mistake?

Taking advantage of the post I would like to better understand how these times are measured, ie when the time starts and when it ends, and know where these values ​​are stored if you want to build a mean and standard deviation graph. I say this because I got a little confused in test 1, because we have two api.rest in the result should not be just one, api.rest gives two different times api.rest 28ms and api.rest 3ms.

default dashboard does not use correct metrics

It seems like the default metrics generated for registry are like moleculer_registry_*, when the default dashboard uses different metrics. Also, some places where it uses _req_ the metrics are _request_.

Jaeger UI <cannot-find-trace-name>

If rest API request is successful I get correct trace name

image

If API request is error the trace name is " < cannot-find-trace-name > " also the api service is not listed

image

Is it related to setting parentCtx on moleculer context.js file?

Below is the metric data received on makePayload Function for a failed api request

{ id: '9cc98685-a241-4ce0-b4d6-a38867a0bc57',
  requestID: 'f92f5c36-0518-4808-b63d-cdeaa83ccbd5',
  level: 2,
  startTime: 1521729207551,
  endTime: 1521729208835.64,
  duration: 1284.639944,
  remoteCall: false,
  fromCache: false,
  params: { dbName: 'm1213' },
  meta: { username: undefined },
  action: { name: 'v1.db.create' },
  parent: 'f92f5c36-0518-4808-b63d-cdeaa83ccbd5',
  nodeID: 'win-n53jq-11308',
  error:
   { name: 'MoleculerError',
     code: 403,
     type: 'DB_CREATE_FAILED',
     message: 'Unable to create Db' } }
{ id: '9cc98685-a241-4ce0-b4d6-a38867a0bc57',
  requestID: 'f92f5c36-0518-4808-b63d-cdeaa83ccbd5',
  level: 2,
  startTime: 1521729207551,
  endTime: 1521729208896.2466,
  duration: 1345.246633,
  remoteCall: false,
  fromCache: false,
  params: { dbName: 'm1213' },
  meta: { username: undefined },
  action: { name: 'v1.db.create' },
  parent: 'f92f5c36-0518-4808-b63d-cdeaa83ccbd5',
  nodeID: 'win-n53jq-11308' }

moleculer-prometheus using global registry

Issue:
Global registry is being used instead of registry instance

Why is this an issue:
Using a global registry means we don't have the ability to stop and start a service on the same process. This was revealed as when running unit tests we start a broker and then create and destroy the necessary services for each test.

What's going wrong?:
The metrics are being assigned to the global registry. Default metrics have a statement that deletes them before attempting to recreate, but this doesn't happen for any other metrics. This causes a fatal error when the service spins up again because the metrics already exist. (see code sample).

Proposal
Create a field on the service instance which has a bespoke registry so it can be passed in to metrics and destroyed when stopped is called

Code Sample:
https://codesandbox.io/s/moleculer-sample-fpcjd?fontsize=14

I've kind of already gone through and done some of the work for this so I can put a PR so you can see what I mean better. 🙂

Return action response

Hi all)

I think it would be useful to store action response (not only error) in payload on metrics.trace.span.finish event. And because of response can huge/confident this feature will turn off by default, but it could be activated by setting response option to true/object/function like params option

// Action definition
{
    metrics: { 
        params: true,
        meta: true,
        response: true // default false
    }
}

// or


{
    metrics: { 
        params: true,
        meta: true,
        response: ['id', 'name']
    }
}

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.