Skip to content

Description

The Events service is in charge of :

  • Enabling the consumption of events from an external service in web socket or HTTP long polling
  • Allowing the emission of events from an external service in web socket or HTTP long polling
  • Historization (storage in a data lake) of each event handled by the message broker
  • Searching for events through various filters directly from the data lake

Technical stack

Library Role Version
Express HTTP framework 4.17.1
express-openapi-validator Swagger-based syntax validation of incoming requests 4.13.4
socket.io Web sockets 4.4.1
@elastic/elasticsearch Events storage 7.16.0
@prisme.ai/broker Message broker interface latest
@prisme.ai/permissions Authorization latest

Design

Events & API

Documentation

Performance

Minimum resources shall be tested and specified so that 99% of external consumers receive each event in less than N milliseconds when a total of M events per second are processed by the same workspace.

Quality

Development standards and quality measurement

The required quality level corresponds to the recommended SonarQube Quality Gate:

  • 80% minimum code coverage
  • 3 % max of duplicated lines
  • Level A in Maintainability, Reliability and Security

Logs

Any action is logged into two different ways:

  • Trace of the HTTP call if there is one (produced at the Gateway API level)
  • Transcription of the action as an event (produced by the service handling the action)

In both cases, all the usual contextual information is included (provided by the common bootstrap between the backend services).
As a minimum, this information should include : :

  • Correlation id
  • User id
  • Workspace id
  • Timestamp
  • Log criticality

Errors

Technical errors (aka unexpected errors) such as a timeout on a REST service call are caught by the service and logged with the full stack trace.

If this error occurs during the processing of an HTTP request, the caller simply receives a generic "Internal Error".

In addition to the error logs, the error is also transmitted as a generic error event.

Both in the log and in the event, the usual contextual information is included as much as possible (see Logs).

Supervision

Just like the other backend micro services, this one provides different administration routes:

  • /metrics : Prometheus
  • /sys/logging : dynamically change log details
  • /sys/heapdump : Generate a memory dump that can be retrieved from the instance and loaded into Chrome for easy debugging
  • /sys/healthcheck : Returns a code 200 if the instance is "healthy"

Security

Company Social Responsibility (CSR)

Linting

The code should be formatted using Prettier, using the version specified in the package.json