Movatterモバイル変換


[0]ホーム

URL:


Loading
  1. Elastic Docs/
  2. Reference/
  3. Ingestion tools/
  4. Elastic Distributions of OpenTelemetry (EDOT)/
  5. EDOT PHP

Migrate to EDOT PHP from the Elastic APM PHP agent

Compared to the Elastic APM PHP agent, the Elastic Distribution of OpenTelemetry PHP presents a number of advantages:

Follow these steps to migrate from the legacy Elastic APM PHP agent (elastic-apm-php) to the Elastic Distribution of OpenTelemetry PHP (elastic-otel-php).

  1. Uninstall the Elastic APM PHP agent

    Remove the previously installedelastic-apm-php package:

    sudo dpkg -r elastic-apm-php
    sudo rpm -e elastic-apm-php
    sudo apk del elastic-apm-php
  2. Install EDOT PHP

    Download the appropriate package for your system from theGitHub releases page.

    sudo dpkg -i elastic-otel-php_<version>_amd64.deb
    sudo rpm -ivh elastic-otel-php-<version>-1.x86_64.rpm
    sudo apk add --allow-untrusted elastic-otel-php-<version>.apk
  3. Update configuration

    Switch fromphp.ini-based configuration to environment variables. The following is a common mapping between old and new settings:

    Elastic APM (php.ini)EDOT PHP (environment variable)Description
    elastic_apm.enabled = 1ELASTIC_OTEL_ENABLED=trueEnables EDOT PHP features - enabled by default
    elastic_apm.service_name = my-appOTEL_SERVICE_NAME=my-appDefines the logical service name
    elastic_apm.server_url = http://...OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318Sets OTLP exporter endpoint
    elastic_apm.secret_token = token123OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer token123"Sets auth header for OTLP exporter
    elastic_apm.environment = productionOTEL_RESOURCE_ATTRIBUTES=deployment.environment=productionAdds environment context to exported data
    Tip

    EDOT PHP does not require changes to your code or Composer configuration — instrumentation works automatically after package installation.

  4. Restart your PHP environment

    Restart the relevant PHP processes for changes to take effect. This might include:

    sudo systemctl restart php8.x-fpm
    sudo systemctl restart apache2
    php script.php

The following are Elastic APM PHP agent settings that you can migrate to EDOT PHP.

Elastic APM PHP OptionEDOT PHP Environment variable equivalent OptionDescription
api_keyOTEL_EXPORTER_OTLP_HEADERSSet API key via OTLP headers. Example:Authorization=Bearer <token>.
breakdown_metricsNot availableNo span compression or breakdown-type metric generation (yet).
capture_errorsNot availableNo direct equivalent. Handled via standard error handling and inferred spans.
disable_instrumentationsOTEL_PHP_DISABLED_INSTRUMENTATIONSComma-separated list of instrumentations to disable.
disable_sendNot availableNo direct option. Could potentially be simulated with custom exporters or filtering processors.
enabledELASTIC_OTEL_ENABLEDEnables or disables EDOT PHP instrumentation entirely.
environmentOTEL_RESOURCE_ATTRIBUTESAdd deployment metadata (e.g.,deployment.environment=prod).
global_labelsOTEL_RESOURCE_ATTRIBUTESSet global key-value pairs for all spans/metrics.
log_levelOTEL_LOG_LEVEL,ELASTIC_OTEL_LOG_LEVEL_FILEControls log verbosity globally (OTEL_LOG_LEVEL) or per sink (e.g., file, stderr, syslog viaELASTIC_OTEL_LOG_LEVEL_*).
server_urlOTEL_EXPORTER_OTLP_ENDPOINTSets OTLP exporter endpoint. Defaults tohttp://localhost:4318.
service_nameOTEL_SERVICE_NAMEDefines service name for traces/metrics.
transaction_sample_rateOTEL_TRACES_SAMPLER_ARGSampling rate for traces (e.g.,0.25).
transaction_max_spansNot availableNo direct support in PHP SDK for limiting spans per transaction.
span_frames_min_durationELASTIC_OTEL_INFERRED_SPANS_MIN_DURATIONDuration threshold for inferred spans.
sanitize_field_namesNot availableNot yet supported in EDOT PHP.
verify_server_certOTEL_EXPORTER_OTLP_INSECUREEnable or disable SSL verification when exporting telemetry.
transaction_ignore_urlsOTEL_PHP_EXCLUDED_URLSA comma-separated list of regex patterns for excluding incoming HTTP URLs from tracing (e.g.,client/.*/info,healthcheck).
transaction_name_callbackNot availableNo equivalent for callback-based naming; use grouping or manualsetAttribute().
log_level_syslogELASTIC_OTEL_LOG_LEVEL_SYSLOGSets syslog sink verbosity.
log_level_fileELASTIC_OTEL_LOG_LEVEL_FILEControls log level for file-based output.
log_level_stderrELASTIC_OTEL_LOG_LEVEL_STDERRControls log level for stderr (recommended in containers).
log_fileELASTIC_OTEL_LOG_FILEPath for log output; supports%p (PID) and%t (timestamp) placeholders.
log_featureELASTIC_OTEL_LOG_FEATURESFine-grained feature-based logging configuration.
transaction_url_groupsELASTIC_OTEL_TRANSACTION_URL_GROUPSGroup similar URL paths (e.g.,/user/*).
inferred_spans_enabledELASTIC_OTEL_INFERRED_SPANS_ENABLEDEnables inferred spans (preview).
inferred_spans_sampling_intervalELASTIC_OTEL_INFERRED_SPANS_SAMPLING_INTERVALSampling frequency for stack traces during inferred spans.
inferred_spans_min_durationELASTIC_OTEL_INFERRED_SPANS_MIN_DURATIONMinimum duration of inferred span (used to limit noise).

You can manage EDOT PHP configurations through thecentral configuration feature in the Applications UI.

Refer toCentral configuration for more information.

The following limitations apply to EDOT PHP:

  • Lack of span compression: The classic Elastic APM agent includes span compression, which merges multiple similar spans. EDOT PHP doesn't currently support span compression. As a result, traces may be more verbose and produce higher cardinality, especially in loop-heavy code.
Note

For a broader overview of known limitations — including technical constraints related to PHP runtime and extensions, refer toLimitations.

If you're encountering issues during migration, refer to theEDOT PHP troubleshooting guide.


[8]ページ先頭

©2009-2026 Movatter.jp