Download the PHP package motadata-apm/custom-instrumentation without Composer
On this page you can find all versions of the php package motadata-apm/custom-instrumentation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download motadata-apm/custom-instrumentation
More information about motadata-apm/custom-instrumentation
Files in motadata-apm/custom-instrumentation
Package custom-instrumentation
Short Description Motadata APM custom instrumentation helpers for OpenTelemetry spans in PHP.
License proprietary
Homepage https://www.motadata.com/aiops-platform/
Informations about the package custom-instrumentation
Motadata APM Custom Instrumentation for PHP
Lightweight utilities for adding validated, namespaced custom attributes to Motadata Instrumentation spans in PHP. Designed to keep instrumentation safe, consistent, and easy to adopt.
Table of Contents
- Overview
- Requirements
- Installation
- Quick Start
- API at a Glance
- Behavior & Validation
- Best Practices
- Support
- License
Overview
Motadata APM Custom Instrumentation helps you attach business context to traces without risking invalid attributes or inconsistent naming. Keys are automatically namespaced, inputs are validated, and the API is safe to use across concurrent requests.
Prerequisite: Instrument your app first with Motadata Auto Instrumentation so the span context is available.
Requirements
- PHP >= 8.1 and <= 8.4
- Motadata Agent (8.1.2+)
Installation
There are several ways to add this package to your project. Note that if this package is not yet published on Packagist, you must use the Local Path methods.
1. Via Composer CLI
If the package is published on Packagist:
2. Manual Installation (composer.json)
Add the package to your require block:
Then run:
3. Via VCS Repository (GitHub/Private Git)
Use this method to pull directly from the Git repository (e.g., for private use or internal testing).
-
Add the repository to your
composer.json: - Run
composer update.
Authentication for Private Repositories
When using the VCS method with a private repository, you must provide credentials.
Recommended: Using the CLI
Run this command to store your GitHub Personal Access Token (PAT) securely:
Manual: auth.json
Alternatively, create an auth.json file in your project root or in ~/.composer/:
Warning: Never commit
auth.jsonto version control. Add it to your.gitignore.
Note for Auto-Instrumentation Users: If you are using the Motadata PHP Auto-Instrumentation script, it may occasionally revert
composer.jsonor remove this package during dependency synchronization. If the package is missing from yourcomposer.jsonafter instrumentation, simply re-add the package details as shown in the installation steps above and runcomposer update.
Quick Start
Keys are automatically prefixed with apm. when missing, but prefer providing the prefix yourself for consistency. All setters throw Exception on invalid input or missing span context, so keep calls wrapped in try/catch.
API at a Glance
Scalar
| Method | Parameter |
|---|---|
set(string $key, bool $value) |
bool |
setInt(string $key, int $value) |
int |
setFloat(string $key, float $value) |
float (finite) |
setString(string $key, string $value) |
string |
Arrays
| Method | Parameter |
|---|---|
setBoolArray(string $key, array $values) |
bool[] |
setIntArray(string $key, array $values) |
int[] |
setFloatArray(string $key, array $values) |
float[] (finite) |
setStringArray(string $key, array $values) |
string[] |
Behavior & Validation
- Keys auto-prefix to
apm.when absent, are lowercased, and are trimmed before validation. - Keys allow only alphanumeric characters and dots.
- Nulls are removed from arrays; arrays must retain at least one non-null value.
- Float inputs reject NaN or Infinity.
- Throws
Exceptionfor invalid input or when no active span is present.
Best Practices
- Use descriptive, hierarchical keys already prefixed with
apm.(e.g.,apm.order.id,apm.order.items). - Choose correct types: IDs as
int, metrics asfloat, flags asbool. - Wrap calls in try/catch and log errors so observability never breaks business flow.
- Use array setters for collections; let null filtering happen inside the library.
- Keep key naming consistent across services to simplify querying.
Support
- Email: [email protected]
- Issues: https://github.com/motadata2025/motadata-apm-custom-instrumentation-php/issues
License
Copyright (c) Motadata 2026. All rights reserved.
Proprietary software; see LICENSE for full terms.