Skip to content

docs: document public SDK APIs#581

Merged
marandaneto merged 2 commits into
mainfrom
docs/document-public-apis
May 19, 2026
Merged

docs: document public SDK APIs#581
marandaneto merged 2 commits into
mainfrom
docs/document-public-apis

Conversation

@marandaneto
Copy link
Copy Markdown
Member

💡 Motivation and Context

Public SDK APIs should be discoverable from source docstrings as well as the published docs. Several customer-facing methods and configuration options were undocumented or only partially documented in code.

This updates docstrings for public SDK methods/configuration that are documented in the official Python SDK docs or exposed as customer-facing APIs, while leaving internal/private helpers alone.

💚 How did you test it?

  • python3 -m compileall -q posthog

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

@marandaneto marandaneto requested review from a team May 19, 2026 14:55
@posthog-project-board-bot posthog-project-board-bot Bot moved this to In Progress in Feature Flags May 19, 2026
@marandaneto
Copy link
Copy Markdown
Member Author

1st of many PRs documenting all public APIs and configurations so your favorite agent will have a better hint before using outdated docs or making wrong assumptions, well if your agent was heavily depending on that ofc.

@marandaneto marandaneto marked this pull request as ready for review May 19, 2026 15:00
@marandaneto marandaneto requested a review from a team as a code owner May 19, 2026 15:00
@posthog-project-board-bot posthog-project-board-bot Bot moved this from In Progress to In Review in Feature Flags May 19, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
posthog/ai/otel/exporter.py:74-80
The `force_flush` docstring is missing a `Returns:` section, making it inconsistent with the `export` method directly above it which documents its return value. The method signature declares `-> bool`, so the return value should be described.

```suggestion
    def force_flush(self, timeout_millis: Optional[int] = None) -> bool:
        """
        Flush pending spans from the underlying OTLP exporter.

        Args:
            timeout_millis: Optional flush timeout in milliseconds.

        Returns:
            True if the flush succeeded within the timeout, False otherwise.
        """
```

### Issue 2 of 2
posthog/ai/otel/processor.py:79-85
Same missing `Returns:` section as in `exporter.py` — the `force_flush` method returns `bool` but the docstring does not document the return value.

```suggestion
    def force_flush(self, timeout_millis: Optional[int] = None) -> bool:
        """
        Flush pending spans from the underlying batch span processor.

        Args:
            timeout_millis: Optional flush timeout in milliseconds.

        Returns:
            True if the flush succeeded within the timeout, False otherwise.
        """
```

Reviews (1): Last reviewed commit: "docs: document public SDK APIs" | Re-trigger Greptile

Comment thread posthog/ai/otel/exporter.py
Comment thread posthog/ai/otel/processor.py
Copy link
Copy Markdown
Contributor

@dustinbyrne dustinbyrne left a comment

Choose a reason for hiding this comment

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

nice nice nice

@github-project-automation github-project-automation Bot moved this from In Review to Approved in Feature Flags May 19, 2026
@marandaneto marandaneto merged commit 39be7c9 into main May 19, 2026
25 of 26 checks passed
@marandaneto marandaneto deleted the docs/document-public-apis branch May 19, 2026 17:42
@github-project-automation github-project-automation Bot moved this from Approved to Done in Feature Flags May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants