Skip to content

Integrates OpenTelemetry for distributed tracing#6

Merged
async-human merged 3 commits intomainfrom
homework-7
Feb 4, 2026
Merged

Integrates OpenTelemetry for distributed tracing#6
async-human merged 3 commits intomainfrom
homework-7

Conversation

@async-human
Copy link
Copy Markdown
Owner

Enables distributed tracing across all microservices (Assembly, IAM, Inventory, Notification, Order, Payment) using OpenTelemetry.

Introduces an OpenTelemetry Collector and Jaeger as a tracing backend in the deployment. Configures each service to initialize an OpenTelemetry tracer, exporting spans via gRPC to the collector.

Adds gRPC unary server and client interceptors for automatic context propagation and span creation for inter-service communication. Enhances key business logic methods with manual span creation to capture operation details and record errors, improving observability and debugging capabilities.

Enables distributed tracing across all microservices (Assembly, IAM, Inventory, Notification, Order, Payment) using OpenTelemetry.

Introduces an OpenTelemetry Collector and Jaeger as a tracing backend in the deployment. Configures each service to initialize an OpenTelemetry tracer, exporting spans via gRPC to the collector.

Adds gRPC unary server and client interceptors for automatic context propagation and span creation for inter-service communication. Enhances key business logic methods with manual span creation to capture operation details and record errors, improving observability and debugging capabilities.
Integrates a comprehensive monitoring solution using OpenTelemetry metrics,
Prometheus, and Grafana across all microservices.

*   Introduces a new `platform/pkg/metrics` module for standard OpenTelemetry
    metric provider initialization, exporting via OTLP/gRPC.
*   Standardizes environment variable configuration (`COLLECTOR_ENDPOINT`,
    `COLLECTOR_INTERVAL`) for metric collection across all services.
*   Defines service-specific metric instruments within a new `internal/metrics`
    package in each microservice.
*   Adds automatic gRPC interceptors and HTTP middleware to record common
    request metrics (total requests, active connections, request duration)
    with method, path, and status attributes.
*   Integrates business-specific metrics into key service operations (e.g.,
    user registrations/logins, order creation/payment, ship assembly,
    part retrieval, notification sending).
*   Deploys Prometheus and Grafana via Docker Compose, including:
    *   Prometheus configured with remote write to receive metrics from OTel Collector.
    *   Grafana provisioned with Prometheus datasource and a central
        'Microservices Monitoring Dashboard' JSON definition.
*   Updates the OpenTelemetry Collector configuration to include a metrics
    pipeline that exports received OTLP metrics to Prometheus.
*   Upgrades OpenTelemetry and other Go dependencies across all services.
Refactor the logging system to utilize OpenTelemetry (OTel) for centralized log collection and export to an Elasticsearch/Kibana stack.

Key changes include:
- Extend `LoggerConfig` interface and its implementations across services to support OTel-specific configurations (service name, environment, collector endpoint).
- Introduce a `SimpleOpenTelemetryCore` for Zap, bridging structured logs to OTel `log.Record`s for richer telemetry.
- Update Docker Compose to provision Elasticsearch, Kibana, and an initializer service for Kibana to set up a default logs data view.
- Configure the OpenTelemetry collector with an Elasticsearch exporter and a new pipeline to forward OTLP logs, enriching them with environment attributes.
- Simplify tracing shutdown registration in application initialization across all services.

This significantly enhances observability by enabling structured logs to be exported and visualized in a centralized logging system.
@async-human async-human merged commit 99bb147 into main Feb 4, 2026
8 of 10 checks passed
@async-human async-human deleted the homework-7 branch February 4, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant