定制 kabiroman/adaptive-entity-manager-opentelemetry-bridge 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kabiroman/adaptive-entity-manager-opentelemetry-bridge

Composer 安装命令:

composer require kabiroman/adaptive-entity-manager-opentelemetry-bridge

包简介

OpenTelemetry bridge for Adaptive Entity Manager - adds distributed tracing and observability to entity lifecycle operations

README 文档

README

This Symfony bundle automatically creates OpenTelemetry spans for persist, update, and remove operations from kabiroman/adaptive-entity-manager-bundle and resolves manager names based on entity namespaces.

Installation

composer require kabiroman/adaptive-entity-manager-opentelemetry-bridge

Register the bundle in config/bundles.php and make sure an OTLP exporter/SDK is configured if you plan to export traces.

Configuration

Supported configuration structure (config/packages/adaptive_entity_manager_opentelemetry_bridge.yaml):

adaptive_entity_manager_opentelemetry_bridge:
    enabled: true
    manager_namespaces:
        sales: 'App\Domain\Sales\'
        legacy: 'App\Domain\Legacy\'
  • enabled toggles tracing on or off.
  • manager_namespaces maps manager names (keys) to namespace prefixes (values), which are used to determine entity ownership.

Usage

EntityPersistenceTracingSubscriber listens to lifecycle events emitted by AdaptiveEntityManager. Thanks to autoconfiguration, it receives TracerInterface, LoggerInterface (if available), the enabled flag, and namespace mapping from the bundle configuration.

Span naming

Spans are named according to the following pattern:

aem.{operation}.{EntityShortName}

Examples:

  • aem.persist.User
  • aem.update.Order
  • aem.remove.Product

Span attributes

  • aem.operation: persist, update, or remove
  • aem.entity.class: fully qualified class name
  • aem.entity.short_class: short class name
  • aem.entity.id: result of getId() (when available)
  • aem.manager: manager name resolved from namespace or unknown
  • aem.entity.changed_fields and aem.entity.changed_fields_count for updates
  • component: adaptive-entity-manager

Events

  • aem.entity.persisted — emitted after entity persist
  • aem.entity.updated — emitted after entity update
  • aem.entity.removed — emitted after entity removal

Troubleshooting

Spans do not appear in Jaeger/Tempo

  1. Confirm that TracerInterface is registered:
    php bin/console debug:container TracerInterface
  2. Make sure the subscriber and bundle are loaded:
    php bin/console debug:container EntityPersistenceTracingSubscriber
  3. Check the configuration that Symfony loads:
    php bin/console debug:config adaptive_entity_manager_opentelemetry_bridge
  4. Enable debug logging if needed:
    monolog:
        handlers:
            main:
                level: debug

aem.manager always reads unknown

Ensure the configured namespaces match your entity namespaces:

manager_namespaces:
    sales: 'App\Domain\Sales\'  # Must match the entity namespace prefix
  • App\Domain\Sales\Entity\User
  • App\Entity\Sales\User ❌ (namespace differs)

Jaeger / Tempo / OTLP

The bundle relies on OpenTelemetry\API\Trace\TracerInterface, so actual exporting and exporter selection happens outside the bundle (for example, with OpenTelemetry\SDK and an OTLP exporter). Ensure a TracerInterface service is available in your application.

Graceful degradation

  • If no TracerInterface is registered, spans are not created.
  • When enabled is false, the subscriber is a no-op.
  • If manager_namespaces is empty, the manager name defaults to unknown.
  • The logger is optional and only used for debug output.

Examples

Minimal configuration example:

adaptive_entity_manager_opentelemetry_bridge:
    enabled: '%env(bool:OTEL_ENABLED)%'
    manager_namespaces:
        sales: 'App\Domain\Sales\'

When Jaeger/Tempo receives traces, look for spans such as aem.persist.User and aem.update.Order that include manager, entity class, and id attributes.

Roadmap

This package is actively maintained. See ROADMAP.md for planned features and future releases.

Upcoming:

  • v1.1.0 (Q1 2026): Span customization hooks, behavior tests, and edge case coverage
  • v1.2.0 (Q2 2026): Integration tests, performance benchmarks, and CI/CD

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT License - see LICENSE file for details.

kabiroman/adaptive-entity-manager-opentelemetry-bridge 适用场景与选型建议

kabiroman/adaptive-entity-manager-opentelemetry-bridge 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「manager」 「bundle」 「entity」 「opentelemetry」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kabiroman/adaptive-entity-manager-opentelemetry-bridge 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kabiroman/adaptive-entity-manager-opentelemetry-bridge 我们能提供哪些服务?
定制开发 / 二次开发

基于 kabiroman/adaptive-entity-manager-opentelemetry-bridge 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-17