Skip to content

docs: adjust observability pages snippets - #897

Open
thiagobomfin-galileo wants to merge 2 commits into
mainfrom
fix/sc-63596-observability-pages
Open

docs: adjust observability pages snippets#897
thiagobomfin-galileo wants to merge 2 commits into
mainfrom
fix/sc-63596-observability-pages

Conversation

@thiagobomfin-galileo

Copy link
Copy Markdown
Contributor

Describe your changes

Add Python (Beta) snippet siblings across the Observability nav group, mirroring the experiments-pages rollout in PR #850.

Beta variants showcase the new LogStream class for routing logs via LogStream.context() instead of galileo_context(project=..., log_stream=...). Pages already covered by earlier work (Overview, Sessions Overview, Multimodal Observability, Distributed Tracing) are unchanged because their Python snippets do not have a meaningful beta variant — they either contain no code or use APIs (GalileoLogger, span/trace methods, galileo_context.init(mode=\"distributed\")) that are unchanged in the beta SDK.

Pages updated

  • sdk-api/logging/logging-basics.mdx — beta tabs for create-logger-with-project and context-get-logger
  • sdk-api/logging/galileo-logger.mdx — beta tab for create-logger
  • sdk-api/logging/log-decorator/log-decorator.mdx — beta tab for the context-management example
  • sdk-api/logging/galileo-context.mdx — beta tab for nesting-scopes
  • sdk-api/logging/tags-and-metadata.mdx — beta tabs for the initial setup (py-1) and the final combined sample (py-7)

New snippet files

```
snippets/code/python-beta/sdk/logging/create-logger-with-project.mdx
snippets/code/python-beta/sdk/logging/context-get-logger.mdx
snippets/code/python-beta/sdk/logging/nesting-scopes.mdx
snippets/code/python-beta/sdk/logging/create-logger.mdx
snippets/code/python-beta/sdk/decorators/log-decorator-context-management.mdx
snippets/code/python-beta/tags-and-metadata/tags-and-metadata-py-1.mdx
snippets/code/python-beta/tags-and-metadata/tags-and-metadata-py-7.mdx
```

Shortcut ticket

SC-63596

Checklist before requesting a review

  • - Is this ready for review? If not, raise as a draft PR
  • - This deployed to a staging environment correctly
  • - I have reviewed my changes
  • - I have reviewed the deployed version of my changes
  • - I have tested any code that is added or updated
  • - I have verified all images and videos are clear, with appropriate zoom
  • - I have verified all images and videos match production (or dev for unreleased features)
  • - I have tested that the content matches the functionality in production (or dev for unreleased features)
  • - All checks have passed
  • - This references a feature that is public. If not, add a note and we can schedule the merge for after the feature release

@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

Card links check

✅ No broken Card links found. Checked external links in 1.4s

@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

✅ Markdown Lint Passed

All markdown files meet the linting standards! 🎉

Add Python (Beta) snippet siblings for the observability nav group, mirroring the experiments-pages rollout (PR #850). Beta variants demonstrate the new `LogStream` class for routing logs via `LogStream.context()` instead of `galileo_context(project=..., log_stream=...)`.
@thiagobomfin-galileo
thiagobomfin-galileo force-pushed the fix/sc-63596-observability-pages branch from 34562da to aa60ba8 Compare May 13, 2026 14:00
@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

✅ Mintlify Dev Server Started Successfully!

The documentation can be served without errors.

@fercor-cisco

Copy link
Copy Markdown
Contributor

Cross-checked the new beta snippets against galileo-python main (94354537). Flagging two potential bugs for the author to verify:

GalileoLogger() inside with log_stream.context(): likely doesn't route to the stream

LogStream.context() (src/galileo/log_stream.py:819-841) returns galileo_context(project=..., log_stream=...), which sets the _project_context / _log_stream_context ContextVars (src/galileo/decorator.py:88-89, 240-243).

But GalileoLogger.__init__ (src/galileo/logger/logger.py:195-322) does not read those ContextVars — it only looks at constructor args or GALILEO_PROJECT / GALILEO_LOG_STREAM env vars (src/galileo/utils/env_helpers.py:39-74).

So in these two snippets:

snippets/code/python-beta/sdk/logging/create-logger-with-project.mdx

# Route every logger created in this scope to that Log stream
with log_stream.context():
    logger = GalileoLogger()

snippets/code/python-beta/sdk/logging/create-logger.mdx

with log_stream.context():
    logger = GalileoLogger()

At runtime this should raise GalileoLoggerException(\"User must provide project_name or project_id to GalileoLogger, or set it as an environment variable.\") unless the env vars are set — and if they are set, the logger will use those, not the stream from .context(). The Route every logger created in this scope to that Log stream comment would then be inaccurate.

The pattern used correctly elsewhere in the PR (context-get-logger.mdx, tags-and-metadata-py-7.mdx) is:

with log_stream.context():
    logger = galileo_context.get_logger_instance()

get_logger_instance() does read the ContextVars (src/galileo/decorator.py:1014-1019).

For create-logger-with-project.mdx an alternative without the context manager:

log_stream = LogStream.get(name=\"my-log-stream\", project_name=\"my-project\")
logger = GalileoLogger(project_id=log_stream.project_id, log_stream_id=log_stream.id)

Misleading scope comment in tags-and-metadata-py-1.mdx

The comment says "every logger created in this scope is routed to MyFirstTagandMetadata / MyFirstTagandMetatdata", but the snippet only resolves log_stream — there is no with log_stream.context(): block, so nothing is in scope yet. Worth rewording or moving the scope intro to a later step.

What checked out

  • LogStream.get(name=..., project_name=...) and LogStream(name=..., project_name=...).create() exist with the signatures used.
  • from galileo import LogStream is exported.
  • galileo_context.get_logger_instance() inside log_stream.context() works in nesting-scopes.mdx, context-get-logger.mdx, log-decorator-context-management.mdx, and tags-and-metadata-py-7.mdx.
  • GalileoPythonConfig.get(), logger.project_id, logger.log_stream_id all exist.

(The MyFirstTagandMetatdata typo was copied from the alpha snippet — pre-existing, not introduced here.)

@xke xke left a comment

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 beta snippet in /sdk-api/logging/galileo-logger seems unnecessary

@galileo-automation

Copy link
Copy Markdown
Contributor

No activity for 30 days — this PR will be closed in 5 days unless updated.

2 similar comments
@galileo-automation

Copy link
Copy Markdown
Contributor

No activity for 30 days — this PR will be closed in 5 days unless updated.

@galileo-automation

Copy link
Copy Markdown
Contributor

No activity for 30 days — this PR will be closed in 5 days unless updated.

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.

4 participants