框架原生方式接入分为几个步骤。首先引入依赖:spring-boot-starter-actuator(自动装载OTel组件)、micrometer-registry-otlp(指标对接OTLP)、micrometer-tracing-bridge-otel(替换为OTel Tracer)、opentelemetry-exporter-otlp(OTLP协议上报)和spring-ai-alibaba-autoconfigure-arms-observation(ARMS扩展)。然后在application.properties中启用配置:设置spring.ai.alibaba.arms.enabled=true开启扩展、配置采样率和上报端点(tracing和metrics的endpoint)、设置服务名等资源属性。启动后即可在阿里云应用监控OpenTelemetry版查看大模型调用链路、工具调用和Token消耗等可观测数据。数据上报端点支持阿里云ARMS或任何兼容OTLP协议的后端。




