cognesy/instructor-telemetry
最新稳定版本:v2.3.1
Composer 安装命令:
composer require cognesy/instructor-telemetry
包简介
Backend-neutral telemetry core for Instructor PHP
README 文档
README
Backend-neutral telemetry core for Instructor PHP.
Use it to correlate spans across runtimes and export them to OTEL, Logfire, or Langfuse.
Live Interop Tests
The package now includes env-gated live backend interop tests under
packages/telemetry/tests/Integration.
Use them to prove both:
- write-path export to Logfire or Langfuse
- read-path queryback through the backend API
Run from the monorepo root:
TELEMETRY_INTEROP_ENABLED=1 composer test:telemetry-interop
Required env:
- Logfire:
LOGFIRE_TOKEN,LOGFIRE_OTLP_ENDPOINT,LOGFIRE_READ_TOKEN - Langfuse:
LANGFUSE_BASE_URL,LANGFUSE_PUBLIC_KEY,LANGFUSE_SECRET_KEY - inference, streaming, and agent runtime smoke tests also require
OPENAI_API_KEY - AgentCtrl smoke tests also require a usable
codexCLI inPATHand a working Codex authentication/configuration state
The suite is opt-in by design. Without TELEMETRY_INTEROP_ENABLED=1, the
integration tests skip cleanly.
Example
<?php use Cognesy\Telemetry\Adapters\Logfire\LogfireConfig; use Cognesy\Telemetry\Adapters\Logfire\LogfireExporter; use Cognesy\Telemetry\Application\Registry\TraceRegistry; use Cognesy\Telemetry\Application\Telemetry; use Cognesy\Telemetry\Domain\Value\AttributeBag; $telemetry = new Telemetry( registry: new TraceRegistry(), exporter: new LogfireExporter(new LogfireConfig( endpoint: 'https://logfire-eu.pydantic.dev', serviceName: 'demo', headers: ['Authorization' => $_ENV['LOGFIRE_TOKEN'] ?? ''], )), ); $telemetry->openRoot('run', 'demo.run'); $telemetry->log('run', 'demo.step', AttributeBag::fromArray(['status' => 'ok'])); $telemetry->complete('run'); $telemetry->flush();
Documentation
packages/telemetry/CHEATSHEET.mdpackages/telemetry/docs/01-introduction.mdpackages/telemetry/docs/02-basic-setup.mdpackages/telemetry/docs/03-runtime-wiring.mdpackages/telemetry/docs/04-troubleshooting.mdpackages/telemetry/docs/05-langfuse.mdpackages/telemetry/docs/06-logfire.mdpackages/telemetry/tests/Integration/examples/A03_Troubleshooting/TelemetryLogfire/run.phpexamples/A03_Troubleshooting/TelemetryLangfuse/run.phpexamples/D05_AgentTroubleshooting/TelemetryLogfire/run.phpexamples/D05_AgentTroubleshooting/TelemetryLangfuse/run.phpexamples/D05_AgentTroubleshooting/SubagentTelemetryLogfire/run.phpexamples/D05_AgentTroubleshooting/SubagentTelemetryLangfuse/run.php
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-18