# sadesh123/opentelemetrytracing architecture

> Architecture diagram of the GitHub repository sadesh123/opentelemetrytracing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sadesh123/opentelemetrytracing
- Repository: https://github.com/sadesh123/opentelemetrytracing

## Overview

##### Main Components
- API Gateway – This is the entry point for HTTP requests. It routes incoming requests to the Lambda function.
- AWS Lambda Function – Your Go-based serverless function (main.go) handles requests. It contains the business logic to:
- Retrieve all NBA shot data.
- Retrieve shot data based on player ID.
- New shot data.
- DynamoDB – NoSQL database that stores the NBA player's shot data.
- OpenTelemetry – Instrumentation library used within your Go code to record and propagate trace information.

##### Design Principles and Architectural Patterns
- Separation of concerns: front-facing API layer (API Gateway) distinct from business logic (Lambda) and data storage (DynamoDB).
- Serverless design pattern where you rely on managed AWS services for scalability and fault tolerance.
- Distributed tracing instrumentation (OpenTelemetry and AWS X-Ray) to help monitor microservice performance even in what might appear to be a simple architecture.

##### Incorporate Relevant Technologies
- Labels such as “Go” next to the Lambda function to denote the language and runtime.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    Client("Client"):::client
    APIGW("API Gateway"):::apigw
    LAMBDA("AWS Lambda (Go)"):::lambda
    DYNAMODB("DynamoDB"):::db
    OPENTELEMETRY("OpenTelemetry"):::otel
    XRAY("AWS X-Ray"):::xray

    %% Data flows
    Client -->|"HTTPRequest"| APIGW
    APIGW -->|"RouteRequest"| LAMBDA
    LAMBDA <-->|"DBOperations"| DYNAMODB
    LAMBDA -->|"RecordTrace"| OPENTELEMETRY
    OPENTELEMETRY -->|"ForwardTrace"| XRAY

    %% Click Events
    click LAMBDA "https://github.com/sadesh123/opentelemetrytracing/blob/main/main.go"
    click OPENTELEMETRY "https://github.com/sadesh123/opentelemetrytracing/blob/main/go.mod"
    click OPENTELEMETRY "https://github.com/sadesh123/opentelemetrytracing/blob/main/go.sum"

    %% Styles
    classDef client fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef apigw fill:#89CFF0,stroke:#333,stroke-width:2px;
    classDef lambda fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef db fill:#F4A460,stroke:#333,stroke-width:2px;
    classDef otel fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef xray fill:#FFA07A,stroke:#333,stroke-width:2px;
```
