mirror of
https://github.com/agentuniverse-ai/agentUniverse.git
synced 2026-02-09 01:59:19 +08:00
4.0 KiB
4.0 KiB
推荐配置
为了方便用户使用,我们给出几种基础的OTel配置供用户参考,用户可以基于这些配置按自己需求修改。
本地控制台输出配置
配置文件
[OTEL]
service_name = "agentuniverse-demo"
provider_class = "opentelemetry.sdk.trace.TracerProvider"
id_generator_class = "opentelemetry.sdk.trace.RandomIdGenerator"
# Instrumentation配置列表
instrumentations = [
"agentuniverse.base.tracing.otel.instrumentation.llm.llm_instrumentor.LLMInstrumentor",
"agentuniverse.base.tracing.otel.instrumentation.agent.agent_instrumentor.AgentInstrumentor",
"agentuniverse.base.tracing.otel.instrumentation.tool.tool_instrumentor.ToolInstrumentor",
]
[OTEL.resource]
deployment = "development"
team = "llm"
version = "1.0.0"
environment = "dev"
[[OTEL.processors]]
class = "opentelemetry.sdk.trace.export.BatchSpanProcessor"
[OTEL.processors.exporter]
class = "opentelemetry.sdk.trace.export.ConsoleSpanExporter"
[[OTEL.metric_readers]]
class = "opentelemetry.sdk.metrics.export.PeriodicExportingMetricReader"
[OTEL.metric_readers.args]
export_interval_millis = 1000
[OTEL.metric_readers.exporter]
class = "opentelemetry.sdk.metrics.export.ConsoleMetricExporter"
特点
- 输出到本地控制台,无额外依赖,配置简单,方便快速上手调试
- 但是输出内容直接打到控制台内容会非常多,实际场景不推荐
输出到本地JSON
配置文件
[OTEL]
service_name = "agentuniverse-demo"
provider_class = "opentelemetry.sdk.trace.TracerProvider"
id_generator_class = "opentelemetry.sdk.trace.RandomIdGenerator"
instrumentations = [
"agentuniverse.base.tracing.otel.instrumentation.llm.llm_instrumentor.LLMInstrumentor",
"agentuniverse.base.tracing.otel.instrumentation.agent.agent_instrumentor.AgentInstrumentor",
"agentuniverse.base.tracing.otel.instrumentation.tool.tool_instrumentor.ToolInstrumentor",
]
[OTEL.resource]
deployment = "development"
team = "llm"
version = "1.0.0"
environment = "dev"
[[OTEL.processors]]
class = "opentelemetry.sdk.trace.export.BatchSpanProcessor"
[OTEL.processors.exporter]
class = "agentuniverse.base.tracing.otel.span_processor.span_json_exporter.SpanJsonExporter"
[OTEL.processors.exporter.args]
base_dir = "./monitors"
特点
- 将Trace内容输出到本地json文件,根据llm、agent、tool维度区分文件夹,每一个span单独存放文件记录,方便后期各类场景消费(如模型SFT)。
- 可通过参数
base_dir修改输出路径
通过OTLP Exporter上送数据
前期准备
配置环境变量
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = 'DELTA'
配置文件
[OTEL]
service_name = "agentuniverse-demo"
provider_class = "opentelemetry.sdk.trace.TracerProvider"
id_generator_class = "opentelemetry.sdk.trace.RandomIdGenerator"
instrumentations = [
"agentuniverse.base.tracing.otel.instrumentation.llm.llm_instrumentor.LLMInstrumentor",
"agentuniverse.base.tracing.otel.instrumentation.agent.agent_instrumentor.AgentInstrumentor",
"agentuniverse.base.tracing.otel.instrumentation.tool.tool_instrumentor.ToolInstrumentor",
]
[OTEL.resource]
deployment = "development"
team = "llm"
version = "1.0.0"
environment = "dev"
[[OTEL.processors]]
class = "opentelemetry.sdk.trace.export.BatchSpanProcessor"
[OTEL.processors.exporter]
class = "opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter"
[OTEL.processors.exporter.args]
endpoint = "http://localhost:4318/v1/traces"
[[OTEL.metric_readers]]
class = "opentelemetry.sdk.metrics.export.PeriodicExportingMetricReader"
[OTEL.metric_readers.args]
export_interval_millis = 1000
[OTEL.metric_readers.exporter]
class = "opentelemetry.exporter.otlp.proto.http.metric_exporter.OTLPMetricExporter"
[OTEL.metric_readers.exporter.args]
endpoint = "http://localhost:4318/v1/metrics"
特点
- 通过OTLPMetricExporter和OTLPSpanExporter将数据上送至Signoz、Jaeger等可观测平台,利用平台能力能清晰地观测到各类指标和数据。