Skip to content

chore: Add documentation note about @traced()#291

Merged
viveknair merged 1 commit intomainfrom
05-18-chore_add_documentation_note_about_traced_
May 19, 2025
Merged

chore: Add documentation note about @traced()#291
viveknair merged 1 commit intomainfrom
05-18-chore_add_documentation_note_about_traced_

Conversation

@viveknair
Copy link
Copy Markdown
Contributor

@viveknair viveknair commented May 18, 2025

TL;DR

Added documentation for the new @traced decorator that enables lower-level OpenTelemetry tracing.

What changed?

  • Added a new section "3. Lower-Level Tracing (traced)" to the README
  • Included code examples demonstrating how to use the @traced decorator
  • Explained the difference between @traced and @interaction decorators
  • Renumbered the subsequent sections to maintain document flow

How to test?

Review the new documentation section to ensure it clearly explains:

  • The purpose of the @traced decorator
  • How to implement it in code with the provided examples
  • How it relates to the existing @interaction decorator
  • The ability to add custom attributes to spans

Why make this change?

The @traced decorator provides more granular control over tracing, allowing developers to instrument specific functions or code blocks within a larger system. This addition complements the existing @interaction decorator by enabling more detailed observability into application performance and behavior, especially for helper functions that don't represent complete interactions but are still important for debugging and monitoring.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@viveknair viveknair assigned dsafreno and joshlebed and unassigned dsafreno May 18, 2025
@viveknair viveknair marked this pull request as ready for review May 18, 2025 10:54
Comment thread README.md
# This would be a database call in a real application
return f"User {user_id}: Sample information"

@interaction(pipeline_id=GENTRACE_PIPELINE_ID)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GENTRACE_PIPELINE_ID variable is referenced but not defined in this code example. Consider either:

  1. Adding a definition at the top of the example:

    GENTRACE_PIPELINE_ID = "your-pipeline-id"
  2. Or replacing the direct reference with a placeholder:

    @interaction(pipeline_id="your-pipeline-id")

This will make the example more self-contained and easier for users to understand what they need to replace with their own values.

Suggested change
@interaction(pipeline_id=GENTRACE_PIPELINE_ID)
@interaction(pipeline_id="your-pipeline-id")

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@viveknair viveknair force-pushed the 05-18-chore_add_documentation_note_about_traced_ branch from cd99fb2 to 03e7993 Compare May 18, 2025 10:56
@viveknair viveknair requested a review from joshlebed May 19, 2025 06:37
Copy link
Copy Markdown
Contributor Author

viveknair commented May 19, 2025

Merge activity

  • May 19, 4:47 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • May 19, 4:47 PM EDT: @viveknair merged this pull request with Graphite.

@viveknair viveknair merged commit b056034 into main May 19, 2025
8 checks passed
@stainless-app stainless-app bot mentioned this pull request May 20, 2025
@stainless-app stainless-app bot mentioned this pull request Jun 6, 2025
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.

3 participants