Skip to content

Refactor createPbTraceContextFromSpan to use createTraceparent helper#98

Merged
torosent merged 3 commits intotorosent/fix-otelfrom
copilot/sub-pr-97
Feb 9, 2026
Merged

Refactor createPbTraceContextFromSpan to use createTraceparent helper#98
torosent merged 3 commits intotorosent/fix-otelfrom
copilot/sub-pr-97

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 9, 2026

Addresses feedback from #97 to eliminate duplicate traceparent formatting logic.

Changes

  • Refactored createPbTraceContextFromSpan to call createTraceparent() instead of manually formatting the traceparent string
  • Removes duplicate flags formatting and template literal construction
  • Ensures consistent ID normalization (lowercase) and validation across all traceparent creation
// Before: Manual formatting duplicates logic
const flags = (spanContext.traceFlags & 0xff).toString(16).padStart(2, "0");
const traceparent = `00-${spanContext.traceId}-${spanContext.spanId}-${flags}`;

// After: Reuses existing helper
const traceparent = createTraceparent(spanContext.traceId, spanContext.spanId, spanContext.traceFlags);

This ensures future changes to traceparent formatting apply consistently across the codebase.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 9, 2026 17:46
Co-authored-by: torosent <17064840+torosent@users.noreply.github.com>
Co-authored-by: torosent <17064840+torosent@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • node-precompiled-binaries.grpc.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/durabletask-js/durabletask-js/node_modules/.bin/node-pre-gyp install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update tracer cache invalidation logic based on feedback Refactor createPbTraceContextFromSpan to use createTraceparent helper Feb 9, 2026
Copilot AI requested a review from torosent February 9, 2026 17:50
@torosent torosent marked this pull request as ready for review February 9, 2026 18:01
@torosent torosent merged commit 3f85d19 into torosent/fix-otel Feb 9, 2026
1 check passed
@torosent torosent deleted the copilot/sub-pr-97 branch February 9, 2026 18:02
YunchuWang pushed a commit that referenced this pull request Feb 9, 2026
)

* Refactor tracing span names and types for consistency with Durable Task conventions

* Refactor createPbTraceContextFromSpan to use createTraceparent helper (#98)

* Remove package-lock.json from .gitignore (#99)

* Fix setSpanError/setSpanOk to use getOtelApi() directly and widen createPbTraceContextFromSpan signature

- Revert setSpanError and setSpanOk to call getOtelApi() instead of
  getTracingContext(), since they only need SpanStatusCode (no tracer)
- Widen createPbTraceContextFromSpan parameter type to Span | undefined | null
  for consistency with extractTraceparentFromSpan

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.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.

2 participants