Add span attributes and per-PostProcessor spans to markdown tracing - #8
Open
raydive wants to merge 1 commit into
Open
Add span attributes and per-PostProcessor spans to markdown tracing#8raydive wants to merge 1 commit into
raydive wants to merge 1 commit into
Conversation
Beta trace analysis showed that post_process dominates typical parse time (p50: 8.1ms of 9.0ms) while the inlines phase dominates the tail (p99: 303ms), but the existing spans carried no detail to explain either. Enrich the instrumentation: - markdown.parse: markdown.input.length attribute, to correlate tail latency with input size - markdown.render: markdown.node.type, markdown.input.length, and markdown.output.length (when the output is a CharSequence) - markdown.parse.post_processor: new child span per PostProcessor with a markdown.post_processor.class attribute, so the cost of post processing is attributable to individual processors Span.current() and GlobalOpenTelemetry come from opentelemetry-api, already a transitive compile dependency via opentelemetry-instrumentation-annotations; both are no-ops when no agent or SDK is wired. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
beta / prod のトレース分析で判明した「span はあるが詳細が分からない」問題に対応し、markdown 計装に span 属性と PostProcessor 単位の子 span を追加します。
背景(トレース分析結果)
変更内容
markdown.parseにmarkdown.input.length属性を追加(String / BasedSequence オーバーロード。Reader はサイズ不明のため対象外)markdown.renderにmarkdown.node.type/markdown.input.length/markdown.output.length(出力が CharSequence の場合のみ)属性を追加markdown.parse.post_processorを追加し、markdown.post_processor.class属性に実装クラスの FQCN を記録(global スコープ・ノードスコープの両方)実装メモ
Span.current()/GlobalOpenTelemetryは opentelemetry-api 由来で、既に opentelemetry-instrumentation-annotations の推移的依存として入っているため新規依存なし検証
mvn test成功(挙動不変)markdown.input.length=85、markdown.node.type=Document、markdown.output.length=160)とmarkdown.parse.post_processor子 span(markdown.post_processor.class=...AttributesNodePostProcessor)が正しい親子関係で出力されることを確認Generated with Claude Code