Skip to content

Add @WithSpan annotations for OpenTelemetry phase tracing - #7

Open
raydive wants to merge 1 commit into
masterfrom
fix/opentelemetry-tracing
Open

Add @WithSpan annotations for OpenTelemetry phase tracing#7
raydive wants to merge 1 commit into
masterfrom
fix/opentelemetry-tracing

Conversation

@raydive

@raydive raydive commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Instrument Parser/HtmlRenderer processing phases with OpenTelemetry @WithSpan annotations so that traces show where markdown processing time is spent:

  • markdown.parse: Parser.parse(String/BasedSequence/Reader)
  • markdown.parse.blocks: block parsing loop, extracted into DocumentParser.parseBlocks() (behavior unchanged)
  • markdown.parse.pre_process_paragraphs / pre_process_blocks / inlines: existing DocumentParser phase methods
  • markdown.parse.post_process: PostProcessorManager.processDocument
  • markdown.render: HtmlRenderer.render(Node, Appendable, int), where all public render overloads converge

The opentelemetry-instrumentation-annotations dependency is annotation-only (~20KB). Spans are created by a Java agent (dd-java-agent with dd.trace.otel.enabled=true, or opentelemetry-javaagent); without an agent the annotations are inert with no runtime effect.

Instrument Parser/HtmlRenderer processing phases with OpenTelemetry
@WithSpan annotations so that traces show where markdown processing
time is spent:

- markdown.parse: Parser.parse(String/BasedSequence/Reader)
- markdown.parse.blocks: block parsing loop, extracted into
  DocumentParser.parseBlocks() (behavior unchanged)
- markdown.parse.pre_process_paragraphs / pre_process_blocks /
  inlines: existing DocumentParser phase methods
- markdown.parse.post_process: PostProcessorManager.processDocument
- markdown.render: HtmlRenderer.render(Node, Appendable, int),
  where all public render overloads converge

The opentelemetry-instrumentation-annotations dependency is
annotation-only (~20KB). Spans are created by a Java agent
(dd-java-agent with dd.trace.otel.enabled=true, or
opentelemetry-javaagent); without an agent the annotations are inert
with no runtime effect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant