graphile / graphile/crystal

Support injecting SQL comments for traceability (e.g., trace IDs)

Open
#2,491 2 comments 33 reactions 0 assignees View on GitHub
✨ feature
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

### Feature description

It would be incredibly helpful if PostGraphile v5 provided a way to inject SQL comments into the queries it generates—specifically to include trace IDs (e.g., /* trace_id=abc123 */) for observability purposes.

### Motivating example

We're using Google Cloud, which supports tracing SQL queries via comments. By appending a trace ID from the incoming HTTP request to the SQL query as a comment, it's possible to correlate the request through all layers—HTTP, GraphQL, and SQL—via tools like Cloud Trace and Cloud Logging.

Benifits:
- Improved observability and debugging.
- Makes it easier to track performance bottlenecks and trace requests across distributed systems.

### Supporting development

I [tick all that apply]:

- [ ] am interested in building this feature myself
- [x] am interested in collaborating on building this feature
- [x] am willing to help testing this feature before it's released
- [ ] am willing to write a test-driven test suite for this feature (before it exists)
- [ ] am a [Graphile sponsor](https://www.graphile.org/sponsor/) ❤️
- [ ] have an active [support or consultancy contract](https://www.graphile.org/support/) with Graphile

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.