# evertonvargas/observability architecture

> Architecture diagram of the GitHub repository evertonvargas/observability, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/evertonvargas/observability
- Repository: https://github.com/evertonvargas/observability

## Overview

This repository is a small Fastify service instrumented for observability, alongside configuration for an observability stack. An HTTP client reaches the service’s test and error routes; those routes record metrics, and the error route logs failures. The server starts the OpenTelemetry SDK, which configures metric and trace exporters. Logger and tracer implementations are included because they are core modules. The README is empty, and the configuration files were not excerpted, so their runtime wiring and backend relationships are not asserted.

Main entry points: [`app/src/tracer.ts`](https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts) (Telemetry setup), [`app/src/server.ts`](https://github.com/evertonvargas/observability/blob/main/app/src/server.ts) (Fastify server), [`app/src/infra/logger.ts`](https://github.com/evertonvargas/observability/blob/main/app/src/infra/logger.ts) (Pino logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Application"]
  node_server["Fastify server<br/>[server.ts]"]
  node_test_route["Test route<br/>[server.ts]"]
  node_error_route["Error route<br/>[server.ts]"]
  node_logger["Pino logger<br/>[logger.ts]"]
end

subgraph group_telemetry["Telemetry"]
  node_tracer["Telemetry setup<br/>[tracer.ts]"]
  node_metric_exporter["OTLP metrics exporter<br/>[tracer.ts]"]
  node_trace_exporter["OTLP trace exporter<br/>[tracer.ts]"]
end

subgraph group_stack["Observability Stack"]
  node_otel_config["Collector config<br/>[otel.yaml]"]
  node_prometheus_config["Prometheus config<br/>[prometheus.yaml]"]
  node_mimir_config["Mimir config<br/>[mimir.yaml]"]
  node_tempo_config["Tempo config<br/>[tempo.yaml]"]
  node_grafana_config["Grafana datasource<br/>[datasources.yaml]"]
end

node_client(("HTTP client"))

node_client -->|"sends requests"| node_server
node_server -->|"registers route"| node_test_route
node_server -->|"registers route"| node_error_route
node_server -->|"starts SDK"| node_tracer
node_test_route -->|"records metrics"| node_tracer
node_error_route -->|"records metrics"| node_tracer
node_error_route -->|"logs errors"| node_logger
node_tracer -->|"configures"| node_metric_exporter
node_tracer -->|"configures"| node_trace_exporter

click node_server "https://github.com/evertonvargas/observability/blob/main/app/src/server.ts"
click node_test_route "https://github.com/evertonvargas/observability/blob/main/app/src/server.ts"
click node_error_route "https://github.com/evertonvargas/observability/blob/main/app/src/server.ts"
click node_logger "https://github.com/evertonvargas/observability/blob/main/app/src/infra/logger.ts"
click node_tracer "https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts"
click node_metric_exporter "https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts"
click node_trace_exporter "https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts"
click node_otel_config "https://github.com/evertonvargas/observability/blob/main/config/otel/otel.yaml"
click node_prometheus_config "https://github.com/evertonvargas/observability/blob/main/config/prometheus/prometheus.yaml"
click node_mimir_config "https://github.com/evertonvargas/observability/blob/main/config/mimir/mimir.yaml"
click node_tempo_config "https://github.com/evertonvargas/observability/blob/main/config/tempo/tempo.yaml"
click node_grafana_config "https://github.com/evertonvargas/observability/blob/main/config/grafana/datasources.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_test_route,node_error_route,node_logger,node_client toneBlue
class node_tracer,node_metric_exporter,node_trace_exporter toneAmber
class node_otel_config,node_prometheus_config,node_mimir_config,node_tempo_config,node_grafana_config toneMint
```

## Components

### Application

- [Fastify server](https://github.com/evertonvargas/observability/blob/main/app/src/server.ts): `app/src/server.ts`
- [Test route](https://github.com/evertonvargas/observability/blob/main/app/src/server.ts): `app/src/server.ts`
- [Error route](https://github.com/evertonvargas/observability/blob/main/app/src/server.ts): `app/src/server.ts`
- [Pino logger](https://github.com/evertonvargas/observability/blob/main/app/src/infra/logger.ts): `app/src/infra/logger.ts`

### Telemetry

- [Telemetry setup](https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts): `app/src/tracer.ts`
- [OTLP metrics exporter](https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts): `app/src/tracer.ts`
- [OTLP trace exporter](https://github.com/evertonvargas/observability/blob/main/app/src/tracer.ts): `app/src/tracer.ts`

### Observability Stack

- [Collector config](https://github.com/evertonvargas/observability/blob/main/config/otel/otel.yaml): `config/otel/otel.yaml`
- [Prometheus config](https://github.com/evertonvargas/observability/blob/main/config/prometheus/prometheus.yaml): `config/prometheus/prometheus.yaml`
- [Mimir config](https://github.com/evertonvargas/observability/blob/main/config/mimir/mimir.yaml): `config/mimir/mimir.yaml`
- [Tempo config](https://github.com/evertonvargas/observability/blob/main/config/tempo/tempo.yaml): `config/tempo/tempo.yaml`
- [Grafana datasource](https://github.com/evertonvargas/observability/blob/main/config/grafana/datasources.yaml): `config/grafana/datasources.yaml`

### Other components

- **HTTP client**

## Connections

- HTTP client → Fastify server: sends requests (evidence: `app/src/server.ts`)
- Fastify server → Test route: registers route (evidence: `app/src/server.ts`)
- Fastify server → Error route: registers route (evidence: `app/src/server.ts`)
- Fastify server → Telemetry setup: starts SDK (evidence: `app/src/server.ts`)
- Test route → Telemetry setup: records metrics (evidence: `app/src/server.ts`)
- Error route → Telemetry setup: records metrics (evidence: `app/src/server.ts`)
- Error route → Pino logger: logs errors (evidence: `app/src/server.ts`)
- Telemetry setup → OTLP metrics exporter: configures (evidence: `app/src/tracer.ts`)
- Telemetry setup → OTLP trace exporter: configures (evidence: `app/src/tracer.ts`)
