LeituraPesquisaRadarFramework de investimento
Entrar / Cadastrar
← Voltar para a leitura
TópicoEditorial DisconfirmAIAtualizado 2026-11-07 15:16

Datadog

5 etapas1 peças5 Fontes

Datadog工程师在排查内部AI应用的大语言模型(LLM)成本时发现,尽管提示缓存(Prompt Caching)看似已启用,但实际命中率极低甚至为零,导致每次请求都重复支付高昂的输入Token费用。通过Cloud Cost Management和Agent Observability工具,团队定位到四种导致缓存静默失效的代码层面陷阱:Go map遍历顺序不确定导致工具列表前缀变化、动态时间戳置于静态指令之前破坏前缀匹配、SDK选项未正确传递至底层请求体、以及误用不支持缓存的Anthropic OpenAI兼容路由。这一发现揭示了提示缓存作为“前缀匹配”机制的脆弱性,任何位于可复用内容之前的微小变动都会使后续所有计算失效。

Como chegamos aqui

  1. 2026-03-18

    Mastra框架用户报告Datadog LLM Observability未在Span中显示缓存读取Token,引发对观测数据准确性的关注。

    github.com ↗
  2. 2026-09-02

    Datadog发布博客《Monitor prompt caching to optimize your token usage》,介绍如何通过设置断点优化缓存策略,指出Anthropic和OpenAI的缓存机制差异。

    datadoghq.com ↗
  3. 2026-09-03

    开发者Mike Bifulco发表文章分析“零命中率”原因,指出将`toISOString()`生成的毫秒级时间戳放在长系统提示词之前是常见错误。

    mikebifulco.com ↗
  4. 2026-11-06

    Datadog发布详细调查报告《How we investigated prompt cache misses with Datadog agent observability》,披露内部应用因Go map无序、参数缺失及API路由问题导致的缓存失效案例及修复方案。

    datadoghq.com ↗
  5. 2026-11-07

    Datadog在GitHub仓库`datadog-saist`提交修复代码,调整提示词结构以最大化缓存前缀稳定性,并增加RepositoryID等上下文隔离。

    github.com ↗
Entrar / Cadastrar
LeituraPesquisaRadarFramework de investimento

O que ainda está indefinido

  • 不同LLM提供商(如Anthropic vs OpenAI)的缓存TTL策略对高频低延迟场景的具体影响边界在哪里?
  • 除了代码层面的修复,是否有通用的中间件或网关层解决方案能自动规范化请求前缀以防止此类静默失效?
  • Datadog Agent Observability在展示缓存指标时,如何确保多步Agent运行中的聚合数据准确性(参考Mastra Issue #14475的修复逻辑)?

Fontes

  • datadoghq.comDatadog官方博客:调查提示缓存未命中↗
  • github.comDatadog GitHub提交:修复提示缓存前缀↗
  • mikebifulco.comMike Bifulco博客:为什么你的提示缓存命中率为零↗
  • datadoghq.comDatadog官方博客:监控提示缓存以优化Token使用↗
  • github.comMastra GitHub Issue:Datadog观测未显示缓存Token↗

Cobertura neste tópico

  • Datadog Troubleshooting Prompt Cache Misses: Four Silent Code-Level Traps2026-11-07Notícias

    Datadog engineers documented the troubleshooting process of locating individual request discrepancies from aggregate cost anomalies, discovering four specific causes—Go map iteration order, missing request body control parameters, unpassed SDK options, and API route incompatibility—that prevented prompt caching from actually taking effect despite appearing enabled.