Skip to content

reactedge/magento-open-telemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReactEdge OpenTelemetry for Magento

A lightweight Magento module that simplifies OpenTelemetry integration and provides a business-oriented telemetry API.

Rather than working directly with spans, tracers and exporters throughout the application, developers can work with higher-level concepts:

  • Activity
  • Operation
  • Success / Failure
  • Structured Attributes

The module exports telemetry using OpenTelemetry and can be visualised using Jaeger, Grafana, Tempo or any OTLP-compatible backend.

Why not use OpenTelemetry directly?

OpenTelemetry provides a powerful low-level API based on tracers, spans and exporters. This module introduces a simpler business-oriented abstraction based on Activities and Operations, allowing Magento developers to instrument business workflows without needing detailed OpenTelemetry knowledge.

Features

  • OpenTelemetry integration for Magento
  • Simple Activity API
  • Operation lifecycle tracking
  • Success and failure reporting
  • OTLP exporter support
  • Jaeger compatible
  • Lightweight dependency injection integration
  • Framework-agnostic telemetry concepts

Installation

composer require reactedge/opentelemetry
composer require open-telemetry/opentelemetry
composer require \
    open-telemetry/api \
    open-telemetry/sdk \
    open-telemetry/exporter-otlp

Configuration

Example:

<default>
    <reactedge_telemetry>
        <general>
            <enabled>1</enabled>
            <service_name>magento-store</service_name>
            <collector_endpoint>http://otel-collector:4318/v1/traces</collector_endpoint>
        </general>
    </reactedge_telemetry>
</default>

Basic Usage

$operation = $activity->startOperation(
    'product.search',
    [
        'search.term' => $searchTerm
    ]
);

try {
    // business logic

    $activity->endOperation(
        $operation,
        [
            'result.count' => $count
        ]
    );
} catch (\Throwable $e) {
    $activity->failOperation(
        $operation,
        [
            'exception.message' => $e->getMessage()
        ]
    );
}

Concepts

Activity

An Activity represents a source of telemetry events.

Operation

An Operation represents a unit of work with a beginning and an end.

Example:

$operation = $activity->startOperation('checkout');

and later:

$activity->endOperation($operation);

Viewing Traces

The module exports OpenTelemetry spans through OTLP.

A common local setup is:

Magento ↓ OpenTelemetry Collector ↓ Jaeger

Once configured, traces can be inspected using the Jaeger UI.

Architecture

Business Logic
       │
       ▼
 Activity
       │
       ▼
 Operation
       │
       ▼
 OpenTelemetry SDK
       │
       ▼
 OTLP Exporter
       │
       ▼
 OpenTelemetry Collector
       │
       ▼
 Jaeger / Grafana / Tempo

About

Business-oriented OpenTelemetry integration for Magento with Activities, Operations, Events and Child Operations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages