Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
/ hotpot Public archive

A framework for building the home of your microservices.

License

Notifications You must be signed in to change notification settings

yizhang7210/hotpot

Repository files navigation

Hotpot

Hotpot is a framework on top of Spring Boot for building a central console of Microservices.

It allows you to quickly build a web app that brings together your services, their statuses, and metrics.

Main concepts

  • Service: an individual deployable artifact in your microservices universe, e.g. user-service
  • Service Metric: a measure of some aspect of a Service, for example:
    - average-releases: average number of releases for the past 30 days
    - percentage-rollback: percentage of rollbacks for the past 30 days
    - doc-location: url of the service's web API documentation
  • Service Objective: a goal, rule, or guideline that you want a Service to satisfy, expressed in terms of one or more Service Metrics, for example:
    - high-quality-release: average-releases > 1 AND percentage-rollback < 20%
    - well-documented: doc-location exists

Quick start

  1. Set up a Spring Boot application, perhaps using Spring Initializr, or gradle init.

  2. Import hotpot-core as a dependency. If you're using gradle:

       repositories {
           jcenter()
       }
       dependencies {
           implementation 'com.hotpot:hotpot-core:${version}'
       }
  3. Add the following configuration to your application.yaml or equivalent:

    hotpot:
      web-api:
        enabled: <enabled>    # default: true. Web API endpoints will be exposed.
        base-url: <base-url>  # default: "". Web API endpoints will be exposed under the <base-url> sub-path
      metrics:
        enabled: <enabled>    # default: false. Enable gathering and surfacing service level metrics and objectives.
  4. Create (and wire) beans that implement the following interfaces:

    - ServiceIdentityProvider (exactly 1): to provide all the service identifiers
    - ServiceMetaDataProvider (1 or more): to provide service metadata given a service identifier

    Note: Services' metadata may come from multiple sources. In Hotpot, each ServiceMetaDataProvider therefore needs to set a precedence. When constructing a service from the metadata provided by the multiple providers, the ones with higher precedence (larger number) will override the ones with lower precedence, if they both provide the same metadata field on the same service.

  5. To enable service metrics, set hotpot.metrics.enabled to true, and create beans that implement the following interfaces:

    - ServiceMetricProvider (exactly 1): to provide all the service metrics
    - ServiceObjectiveProvider (exactly 1): to provide all the service objectives
    - ServiceDataProvider (1 or more): to provide the actual data for each metric defined in the ServiceMetricProvider
  6. Start up your spring boot application.

  7. curl localhost:8080/<base-ur>/serviceIds will give you the IDs of all your services.

  8. With metrics enabled, curl localhost:8080/<base-ur>/metrics/values/{serviceId} will give you all the current metrics for the service serviceId.

For the complete set of endpoints, see the public documentation.

Alternatively, import and run the Postman Collection locally.

Libraries

Popular libraries that make running a Hotpot app even easier include:

  • hotpot-staticdata: Support file (yaml) based service, metric, and objective definitions

More Information