# recepbaykara/kong-dynatrace architecture

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

- Interactive diagram: https://gitdiagram.com/recepbaykara/kong-dynatrace
- Repository: https://github.com/recepbaykara/kong-dynatrace

## Overview

kong-dynatrace is a Kong Gateway plugin that adds distributed-tracing context to upstream requests and forwards per-request metrics to Dynatrace. Its documented workflow spans Kong’s access, header_filter, and log phases; the schema defines plugin configuration. No source excerpts were provided, so the relationships below rely on the README’s workflow description, and handler responsibilities share the documented handler.lua path.

Main entry points: [`handler.lua`](https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua) (Trace injection), [`schema.lua`](https://github.com/recepbaykara/kong-dynatrace/blob/main/schema.lua) (Plugin config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Kong plugin"]
  node_config["Plugin config<br/>[schema.lua]"]
  node_access["Trace injection<br/>[handler.lua]"]
  node_status["Status capture<br/>[handler.lua]"]
end

subgraph group_telemetry["Telemetry delivery"]
  node_metrics["Metric formatting<br/>[handler.lua]"]
  node_dispatch["Async dispatch<br/>[handler.lua]"]
end

node_gateway["Kong Gateway"]
node_upstream["Upstream service"]
node_dynatrace["Dynatrace API"]

node_gateway -->|"loads settings"| node_config
node_gateway -->|"runs access phase"| node_access
node_gateway -->|"runs header_filter"| node_status
node_gateway -->|"runs log phase"| node_metrics
node_access -->|"sets traceparent"| node_upstream
node_metrics -->|"formats then dispatches"| node_dispatch
node_dispatch -->|"posts metrics"| node_dynatrace

click node_config "https://github.com/recepbaykara/kong-dynatrace/blob/main/schema.lua"
click node_access "https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua"
click node_status "https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua"
click node_metrics "https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua"
click node_dispatch "https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua"

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_config,node_access,node_status toneBlue
class node_metrics,node_dispatch toneAmber
class node_gateway,node_upstream toneIndigo
class node_dynatrace toneMint
```

## Components

### Kong plugin

- [Plugin config](https://github.com/recepbaykara/kong-dynatrace/blob/main/schema.lua): `schema.lua`
- [Trace injection](https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua): `handler.lua`
- [Status capture](https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua): `handler.lua`

### Telemetry delivery

- [Metric formatting](https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua): `handler.lua`
- [Async dispatch](https://github.com/recepbaykara/kong-dynatrace/blob/main/handler.lua): `handler.lua`

### Other components

- **Kong Gateway**
- **Upstream service**
- **Dynatrace API**

## Connections

- Kong Gateway → Plugin config: loads settings (evidence: `README.md`)
- Kong Gateway → Trace injection: runs access phase (evidence: `README.md`)
- Kong Gateway → Status capture: runs header_filter (evidence: `README.md`)
- Kong Gateway → Metric formatting: runs log phase (evidence: `README.md`)
- Trace injection → Upstream service: sets traceparent (evidence: `README.md`)
- Metric formatting → Async dispatch: formats then dispatches (evidence: `README.md`)
- Async dispatch → Dynatrace API: posts metrics (evidence: `README.md`)
