Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 3.46 KB

README.md

File metadata and controls

63 lines (48 loc) · 3.46 KB

Edison Status

Edison Microservices are self-describing services: they expose information about the current state and about the application, system, responsible team and dependencies to other services. The purpose of this library is to expose such kind of information.

The /internal/status API contains information about the application status:

  • A REST API to get the current status and information about the service as JSON
  • An HTML representation / status page for human beeings.
  • A possibility to indicate the status of jobs, repositories or other components (see de.otto.edison.status.indicator.StatusDetailIndicator)
  • A possibility to add information about required services (see de.otto.edison.about.spec.ServiceSpec)

Usage

The example-status shows how to use and configure the status library.

  1. Add a dependency to edison-status (or directly add a dependency to edison-service)
  2. Configure some properties (see below).
  3. Optionally implement some Spring beans, implementing the StatusDetailIndicator (SDI) interface. Every SDI will be automatically added to the status details section of the status page / JSON document.
  4. Optionally override the behaviour of the StatusAggregator and/or schedulers (see 'Conditional Spring Beans'). This should generally not be necessary.

Environment Properties

The following properties should be added to your application.properties or application.yml configuration.

Required:

  • spring.application.name: The default Spring Boot property containing the name of the service.

Optional VCS information about the deployed application:

Optional information about the application:

  • edison.status.application.description: A human-readable short description of the application's purpose.
  • edison.status.application.group: Information about the group of services this service is belonging to. Example: 'order', 'user', 'campaign'
  • edison.status.application.environment: The staging environment (like develop, prelive, live) of the service.

Optional information about the system:

  • server.port: The port used to access the application
  • server.hostname: The hostname of the server
  • HOSTNAME: if server.hostname is not configured, the system environment's HOSTNAME is tried. If this is not available, the SystemInfoConfiguration is trying to get the hostname using InetAddress.getLocalHost().getHostName().

Conditional Spring Beans

By default, the status of the application is calculated every 10 seconds and cached in the meantime. You can change this default behaviour in the following ways:

  1. Override the @ConditionalOnMissingBean StatusAggregator. The default implementation is caching the status. You could replace this default bean by providing an uncached implementation. If calculating the status is expensive (for example, if you have to access a database), this might not be a good idea if the status ressource is retrieved frequently.

  2. Override the @ConditionalOnMissingBean named 'fixedDelayScheduler'. By default, this scheduler is updating the StatusAggregator every 10 seconds.

  3. Provide a 'cronScheduler' bean and configure edison.status.scheduler.cron in your application properties with a valid cron expression. This way, the cron scheduler is used instead of the fixedDelayScheduler.