# `internal` directory explanation

This directory contains code that is not intended to be used by out of `metrics` module.

## `internal/datasource`

Metrics data source. Where and how to get data from.

Sub directories are organized by infra-level data store:

- Central thanos: newer developed metric integrations mainly get data from the central thanos.
- Shoot prometheus: legacy metrics server and tidbcloud user console get data from dedicated prometheus inside shoot k8s.
- MetaDB: Machine capacity metrics, such as cpu, memory, disk, etc., are collected from metaDB.

## `internal/rest`

Legacy REST handlers for metrics server.

## `internal/service`

Services which implements business logic:

- `internal/service/query`: A query manager service for the legacy metrics server.
- `internal/service/pipeline`: A registry service for the push pipeline. Since pipeline are composed as three type of streaming components (receiver -> processor -> exporter), 
  the pipeline service serves as a component registry. Most of business logic is implemented in each underlying component.
