poespas / opentelemetry-tracing-magento2
Magento 2 OpenTelemetry Tracing
Installs: 2 129
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1 || ^8.2 || ^8.3
- jonahgeorge/jaeger-client-php: ^1.5
README
Overview
OpenTelemetry Tracing is a Magento 2 module that integrates seamlessly with Magento's built-in Profiling functionality to provide advanced tracing capabilities. By adding a custom tracing driver, this module enables detailed performance monitoring and analysis, helping developers optimize their Magento applications effectively and for free.
Features
- Enhanced Profiling: Extends Magento's native profiler with advanced tracing capabilities.
- Jaeger Compatibility: Integrates with Jaeger for distributed tracing using the jonahgeorge/jaeger-client-php library.
- Grafana Tempo Support: Compatible with Grafana Tempo through the OpenTelemetry endpoint, allowing for comprehensive monitoring and visualization.
- Flexible Configuration: Easily configure tracing settings via JSON files or Magento CLI commands.
Compatibility
Jaeger
OpenTelemetry Tracing integrates with Jaeger, a popular open-source distributed tracing system. This integration is powered by the jonahgeorge/jaeger-client-php library, ensuring reliable and efficient tracing capabilities.
Grafana Tempo
The module also supports Grafana Tempo, enabling users to leverage Grafana's powerful visualization tools through the OpenTelemetry endpoint. This compatibility allows for seamless tracing data collection and analysis within the Grafana ecosystem.
Installation
- Clone the Repository:
composer require poespas/opentelemetry-tracing-magento2
- Enable the Module:
bin/magento module:enable Poespas_OpentelemetryTracing bin/magento setup:upgrade
Configuration
You can configure the tracing driver using a JSON configuration file or via the Magento CLI command.
Using var/profiler.flag
File
Create or update the var/profiler.flag
file in the root of the magento installation with your JSON configuration:
{
"drivers": [
{
"type": "\\Poespas\\OpentelemetryTracing\\Profiler\\Driver\\TracingDriver",
"application_name": "my-magento-app",
"config": {
"local_agent": {
"reporting_host": "127.0.0.1",
"reporting_port": 14268
},
"dispatch_mode": "jaeger_over_binary_http"
}
}
]
}
Using Magento CLI Command
Alternatively, enable the profiler with a minified JSON configuration using the following command:
bin/magento dev:profiler:enable '{"drivers":[{"type":"\\Poespas\\OpentelemetryTracing\\Profiler\\Driver\\TracingDriver","application_name":"my-magento-app","config":{"local_agent":{"reporting_host":"127.0.0.1","reporting_port":14268},"dispatch_mode":"jaeger_over_binary_http"}}]}'
Screenshots
Jaeger Integration
Example of tracing data visualized in Jaeger.
Grafana Tempo Integration
Example of tracing data visualized in Grafana Tempo.
Inspiration
OpenTelemetry Tracing was inspired by the sitewards/Magento2-OpenCensus project.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Support
For support and questions, please open an issue on the GitHub repository.