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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Health Status programmatically #9

Closed
BrunnerLivio opened this issue Oct 1, 2018 · 1 comment
Closed

Get Health Status programmatically #9

BrunnerLivio opened this issue Oct 1, 2018 · 1 comment

Comments

@BrunnerLivio
Copy link
Member

BrunnerLivio commented Oct 1, 2018

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The only way to retrieve the health status is over HTTP.

Expected behavior

There should be a way to request the current status by the public nestjs/terminus API.

For example:

// Returns { status: 'ok' | 'error', info: {...} }
await terminusRegistry.getHealthStatus('/health');

Related

godaddy/terminus#83

@BrunnerLivio
Copy link
Member Author

BrunnerLivio commented Apr 5, 2020

Resolved in 7.0.0 🎉

@Injectable()
class MyService {
  constructor(private health: HealthCheckService, private dns: DNSHealthIndicator) { }

  async getStatus() {
   const status = await this.health.check([() => this.dns.pingCheck('google', 'https://google.com')]);
   console.log(status);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
First Release
  
Dream
Development

No branches or pull requests

1 participant