Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sync-service): Expand the set of OT span attributes assigned in ServeShapePlug #1736

Merged
merged 14 commits into from
Oct 2, 2024

Conversation

alco
Copy link
Member

@alco alco commented Sep 17, 2024

Part of #1664.

@KyleAMathews WIP so far:
Screenshot from 2024-09-17 17-33-51
Screenshot from 2024-09-17 17-34-08

Copy link

netlify bot commented Sep 17, 2024

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit a85d8d2
🔍 Latest deploy log https://app.netlify.com/sites/electric-next/deploys/66fd022755dd240008a9f82c
😎 Deploy Preview https://deploy-preview-1736--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@KyleAMathews
Copy link
Contributor

Looks great!

@alco
Copy link
Member Author

alco commented Sep 24, 2024

@KyleAMathews Just pushed new changes that largely implement the ideas described in #1664.

The name of the root span for shape requests is now ShapeGet:
Screenshot from 2024-09-24 04-05-56

Grouping by shape_req.is_cached:
Screenshot from 2024-09-24 04-05-24

Serving a largish initial snapshot or 2000 linearlite issues:
Screenshot from 2024-09-24 04-11-48

Bits that are still no there:

  • propagating tracing context on the write path, all the way from Postgres to individual shape logs
  • recording exceptions in ShapeGet processing as errors in the OT span (can be done by using Plug.ErrorHandler)
  • estimating shape size and assigning it as an attribute to tracing spans. This is doable by keeping track of how much data has been streamed to the client and then setting that as a dynamic attr on the span.

@KyleAMathews
Copy link
Contributor

  • is ShapeGet.load_shape_data when we run the actual SQL query? It'd be nice to have it clear what's the query. Also adding the query as an attribute would be great too.
  • ShapeGet is camel case while all the sub-spans are snake case — perhaps just do shape_get as well?

Nice progress!

@alco
Copy link
Member Author

alco commented Sep 24, 2024

  • is ShapeGet.load_shape_data when we run the actual SQL query? It'd be nice to have it clear what's the query. Also adding the query as an attribute would be great too.

You're probably referring to load_shape_info. This span covers the "get_or_create_shape_id" function, so it's going to be cached data after the shape is first created. It makes sense to only trace the shape creation bit. I'll try adding the SQL query to that.

  • ShapeGet is camel case while all the sub-spans are snake case — perhaps just do shape_get as well?

Naming convention can be anything we like here. I kinda like the way the root span's name stands out. Also makes it easy to see when a non-root span shows up as a root one in Honeycomb because of incorrect context tracking in the code.

So I would make all root spans use CamelCase. But we could use some other convention to keep everything snake case, e.g. _shape_get or R_shape_get for the root span.

@KyleAMathews
Copy link
Contributor

I kinda like the way the root span's name stands out

Hmm yeah interesting point. I don't feel that strongly about specifics of the conventions — just that we're consistent.

@KyleAMathews KyleAMathews added this to the Production Readiness milestone Sep 24, 2024
@alco alco marked this pull request as ready for review October 2, 2024 08:25
@alco alco requested a review from robacourt October 2, 2024 08:35
Copy link
Contributor

@robacourt robacourt left a comment

Choose a reason for hiding this comment

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

Great work!

@alco alco merged commit 841922d into main Oct 2, 2024
5 of 7 checks passed
@alco alco deleted the alco/ot-spans branch October 2, 2024 09:43
KyleAMathews pushed a commit that referenced this pull request Nov 1, 2024
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