Skip to content

Latest commit

 

History

History
106 lines (88 loc) · 3.56 KB

how-it-works.mdx

File metadata and controls

106 lines (88 loc) · 3.56 KB
title description
How it works
A good look under the hood.

SDKs

Apitally integrates directly with your application through one of our open-source SDKs, which is a small dependency to add to your project.

GitHub repository GitHub repository GitHub repository GitHub repository GitHub repository

The diagram below illustrates how the SDKs works.

<img className="block dark:hidden rounded-xl" style={{ border: "solid 1px #22222222" }} src="https://assets.apitally.io/docs/how-it-works-light.png" alt="Diagram showing how the Apitally SDKs works" /> <img className="hidden dark:block rounded-xl" style={{ border: "solid 1px #dddddd22" }} src="https://assets.apitally.io/docs/how-it-works-dark.png" alt="Diagram showing how the Apitally SDKs works" />

The SDKs include the following features:

  • Introspection of your application to capture metadata about endpoints.
  • Lightweight middleware for each supported framework, which captures request and response metadata.
  • A non-blocking client that handles communication with the Apitally Hub.
The clients are designed to be resilient to temporary network failures when communicating with the Apitally Hub and will retry sending data for up to 1 hour.

On startup

When your application starts running and the Apitally middleware is initialized, it introspects your application to capture metadata about all available endpoints. This metadata is then sent to the Apitally Hub in a once-off request.

During runtime

When your application receives a request, the middleware times the invokation of the request handler and captures metadata about the request and response, such as the HTTP method, path and the HTTP status code. If the response is a validation error (status 400 or 422), the middleware inspects the response body for further details about the error.

The captured metadata is then passed to the client which immediately aggregates it with previously received data. The client synchronizes the aggregated data with the Apitally Hub in one minute intervals.

If request logging is enabled, the client writes the request and response data to a compressed temporary file on disk. During the next synchronization interval, the client reads the log file and sends the compressed data to the Apitally Hub.

The communication with the Apitally Hub happens either asynchronously or in a separate thread, depending on your framework, which means that it doesn't interfere with your applications' handling of requests.

Server side

When the Apitally Hub receives data from your application, it puts it in a queue for asynchronous processing. The data should be processed and visible on the dashboard within a few seconds.

Data is retained at 1-minute granularity for 32 days and then aggregated to 30-minute intervals. We delete data completely after 13 months.