Download the PHP package mumzworld/laravel-opentelemetry without Composer

On this page you can find all versions of the php package mumzworld/laravel-opentelemetry. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-opentelemetry

Laravel OpenTelemetry Package

A comprehensive OpenTelemetry integration package for Laravel applications that provides complete observability through distributed tracing, metrics collection, and visualization. This package enables you to monitor your application's performance, track requests across microservices, and identify bottlenecks in your Laravel application.

Learn more about OpenTelemetry:

๐Ÿš€ Features

๐Ÿ“‹ Prerequisites

๐Ÿ› ๏ธ Installation

โš ๏ธ CRITICAL: The OpenTelemetry PHP extension must be installed BEFORE running composer require. The package installation will fail without it.

Docker Environment (Recommended)

For Fresh Laravel Projects: If you don't have Docker setup yet, create these files first:

Create Dockerfile:

Create docker-compose.yml:

Step 1: Add Extension to Dockerfile (If Docker Already Exists)

Add the OpenTelemetry extension to your Dockerfile:

Step 2: Rebuild Docker Container

Step 3: Install the Package

Note: The service provider is automatically registered via Laravel's package auto-discovery.

Non-Docker Environment

Step 1: Install OpenTelemetry PHP Extension

Using PECL (Most Common):

Verify Installation:

Step 2: Install the Package

Note: The service provider is automatically registered via Laravel's package auto-discovery.

Step 4: Publish Configuration Files

Note: The publish command creates a .env.opentelemetry.example file as a reference. You can safely delete this file after copying the variables to your .env file.

For Docker Environment:

For Non-Docker Environment:

Step 5: Configure Environment Variables

Add these variables to your .env file:

Step 6: Setup Docker Observability Stack

Add the OpenTelemetry services to your docker-compose.yml:

Step 7: Start the Observability Stack

Step 8: Verify Installation

If test routes return 404:

  1. Ensure you've added the test route inclusion to routes/api.php
  2. Clear route cache: docker-compose exec app php artisan route:clear
  3. Restart the app container: docker-compose restart app

๐Ÿ” Troubleshooting

Common Issues

1. No traces appearing in Grafana

Check if services are running:

Check collector logs:

2. PHP Extension not loading

Verify OpenTelemetry extension is installed:

Check PHP configuration:

3. Traces not being exported

Check environment variables:

Test with debug mode:

4. High memory usage

Adjust sampling rate:

๐ŸŽฏ Usage Examples

Basic Custom Tracing

Controller Integration

Database Query Tracing

Job Tracing

๐Ÿงช Testing the Integration

The package includes test routes to verify your OpenTelemetry setup:

Test Routes

Enable Test Routes

Add to your routes/api.php (development only):

Note: After testing is complete, you can safely remove the opentelemetry-test.php file and the test route inclusion from routes/api.php. These files are only for setup verification and are not needed in production.

Expected Test Responses

Basic Test (/api/opentelemetry/test):

Configuration Test (/api/opentelemetry/config):

๐Ÿ”ง Configuration Options

Environment Variables

Variable Default Description
OTEL_ENABLED true Enable/disable OpenTelemetry
OTEL_SERVICE_NAME APP_NAME Service name for traces
OTEL_SERVICE_VERSION 1.0.0 Service version
OTEL_ENVIRONMENT APP_ENV Deployment environment
OTEL_TRACES_EXPORTER otlp Trace exporter type
OTEL_EXPORTER_OTLP_ENDPOINT http://otel-collector:4318 OTLP endpoint
OTEL_PROPAGATORS baggage,tracecontext Trace propagators
OTEL_TRACES_SAMPLER parentbased_traceidratio Sampling strategy
OTEL_TRACES_SAMPLER_ARG 1.0 Sampling ratio (0.0-1.0)
OTEL_PHP_AUTOLOAD_ENABLED true Enable PHP auto-instrumentation
OTEL_INSTRUMENTATION_ENABLED true Enable instrumentation

Configuration File

The package publishes a configuration file at config/opentelemetry.php:

๐Ÿณ Docker Integration

Complete Stack

The package includes a complete observability stack:

Service URLs

๐Ÿ“Š Viewing Traces

Grafana Dashboard

  1. Open Grafana at http://your-host:3000
  2. Login with admin/admin
  3. Go to "Explore" โ†’ Select "Tempo" datasource
  4. Search for traces by:
    • Service name: {service.name="your-service-name"}
    • HTTP operations: {service.name="your-service-name" && name=~".*GET.*"}
    • Slow traces: {service.name="your-service-name" && duration>100ms}

Sample Trace Queries

Runtime Issues

No traces in Grafana:

Traces not exported:

High memory usage:

๐Ÿš€ Production Deployment

Environment Configuration

Performance Considerations

  1. Sampling: Use appropriate sampling rates for production (0.1 = 10%)
  2. Batching: Configure batch processors in collector
  3. Resource Limits: Set memory and CPU limits
  4. Network: Use gRPC for better performance
  5. Storage: Configure appropriate retention policies

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“„ License

This package is licensed under the MIT License.

๐Ÿ†˜ Support

For support and questions:


Built with โค๏ธ by Mumzworld Development Team


All versions of laravel-opentelemetry with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0|^13.0
open-telemetry/api Version ^1.0
open-telemetry/sdk Version ^1.0
open-telemetry/exporter-otlp Version ^1.0
open-telemetry/opentelemetry-auto-laravel Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mumzworld/laravel-opentelemetry contains the following files

Loading the files please wait ...