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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC WIP] feat(metrics): add metrics integration with prometheus #3339

Open
wants to merge 2 commits into
base: master
from

Conversation

@raymondfeng
Copy link
Member

commented Jul 11, 2019

PoC for https://prometheus.io/ integration

Checklist

馃憠 Read and sign the CLA (Contributor License Agreement) 馃憟

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

馃憠 Check out how to submit a PR 馃憟

@raymondfeng raymondfeng requested a review from bajtos as a code owner Jul 11, 2019

@raymondfeng raymondfeng changed the title feat(metrics): add metrics integration with prometheus [RFC WIP] feat(metrics): add metrics integration with prometheus Jul 11, 2019

@raymondfeng raymondfeng force-pushed the prometheus branch 2 times, most recently from b401dbb to 8bec17b Jul 12, 2019

this.component(MetricsComponent);
```

By default, Metrics route is mounted at `/metrics`. This path can be customized

This comment has been minimized.

Copy link
@hacksparrow

hacksparrow Jul 12, 2019

Member

How about access control?

This comment has been minimized.

Copy link
@raymondfeng

raymondfeng Jul 12, 2019

Author Member

It's similar as how we expose openapi specs. Let's worry about that later.

There are a few things to consider:

  1. pull vs push - prometheus prefers pull
  2. use a different rest endpoint (host/port)
  3. ACL
@raymondfeng

This comment has been minimized.

Copy link
Member Author

commented Jul 17, 2019

FYI: I refactored the module to extensions/metrics - to be consistent with #3360

I had to include c74b870 so that CI can run.

@bajtos

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

I had to include c74b870 so that CI can run.

As I commented in the other PR, can you please open a new PR to make the necessary changes to allow extensions to be hosted in extensions/ directory?

@bajtos

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

I am not familiar with Prometheus. What kind of metrics is it collecting? What kind of metrics does it makes sense to provide from a LoopBack application? What can be exposed out of the box and what requires users to provide explicit configuration for?

For example:

  • Request latency - how long does it take to handle a request.
    • From the time we receive request headers until we send the response headers (not waiting for the response body to be sent entirely)
    • From the time we receive request body until we send the response headers
    • From the time we receive request headers until the last byte of the response was sent
  • DataSource latency - how long does it take to execute a call to a datasource (make a DB query, call a backend web-service)
  • Memory usage
  • CPU usage
  • Event loop latency
  • Anything else?

I'd like the documentation for the extension (the README?) to better describe these aspects and educate LB4 users that are new to Prometheus.

@raymondfeng raymondfeng force-pushed the prometheus branch 2 times, most recently from 96d7916 to 0964afd Jul 30, 2019

@raymondfeng

This comment has been minimized.

Copy link
Member Author

commented Jul 30, 2019

@bajtos I have updated README to include more information.

@raymondfeng raymondfeng force-pushed the prometheus branch from 0964afd to fd08597 Jul 30, 2019

@raymondfeng raymondfeng force-pushed the prometheus branch 2 times, most recently from bd3e6d9 to fbb7f30 Aug 13, 2019

@raymondfeng raymondfeng force-pushed the prometheus branch from fbb7f30 to 0ba3204 Aug 22, 2019

@raymondfeng raymondfeng force-pushed the prometheus branch from 0ba3204 to 9639c29 Aug 23, 2019

@raymondfeng

This comment has been minimized.

Copy link
Member Author

commented Aug 23, 2019

@bajtos PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.