Code Monkey home page Code Monkey logo

Comments (7)

raymondfeng avatar raymondfeng commented on August 15, 2024 1

Here is what I meant:

  1. HealthCheck is an interface/mixin that a controller can choose to implement
  2. The health check operation will be mount to /myController/healthcheck
  3. The implementation of heathcheck method can be custom. The backing datasource can provide a default impl based on ping.

from loopback-next.

emckean avatar emckean commented on August 15, 2024

I think what I want is dataSource.ping ā€¦ basically I want an endpoint to confirm that a db exists before running local tests, if that make sense? An example of how to use dataSource.ping to check if the underlying db is healthy would be great.

from loopback-next.

superkhau avatar superkhau commented on August 15, 2024

cc @raymondfeng

from loopback-next.

superkhau avatar superkhau commented on August 15, 2024

"@simonho @erin.mckean Health check should be a mixin that models can opt in" as per @raymondfeng

from loopback-next.

ritch avatar ritch commented on August 15, 2024

-1 for a model mixin... Models should just be plain objects. This should be one or both of:

// a
let heartbeat = await repository.ping()
// b
heartbeat = await dataSource.ping()

That being said... its not just about datasources... thats a naive way to look at this. Health means the entire health of the API. Eg. GET /health this could do something like:

public getHealth() : Array<HeartBeat> {
  for(binding of app.find('dataSources.*')) {
    yield (await binding.resolve().ping());
  }
}

from loopback-next.

ritch avatar ritch commented on August 15, 2024

+1 for a controller mixin

from loopback-next.

bajtos avatar bajtos commented on August 15, 2024

I am closing this issue because we are not going to have time to work on this in the next 6-9 months. However, we are happy to accept a pull request contributing this feature.

from loopback-next.

Related Issues (20)

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.