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

add support for thrift service name in server traces #686

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

marcoferrer
Copy link
Contributor

Closes #

💸 TL;DR

Right now server trace spans for thrift report the service name as unknown. Because the thrift compiler doesn't generate schema metadata, we can fallback to relying on compiler conventions to source the service name defined in the schema.

📜 Details

Design Doc

Jira

🧪 Testing Steps / Validation

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

@marcoferrer marcoferrer requested a review from a team as a code owner February 20, 2025 23:56
@marcoferrer marcoferrer requested review from fishy, pacejackson and mathyourlife-reddit and removed request for a team February 20, 2025 23:56
}

return fmt.Sprintf("%s.%s",
filepath.Base(value.PkgPath()),
Copy link
Member

Choose a reason for hiding this comment

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

why do we use filepath here? filepath is the one that uses / for *nix and \ for windows, I don't think that's how go package path works. it should always be / (as go package path is kind of url based) so we should use path instead.

also do you have an example/test what this is supposed to get? I'm not sure why we infer this from go package path instead of set explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call on filepath. Ill push that fix. I added a test to show what the expected output is. Im pulling the last part of the go path because that is usually defined by either go package set in the thrift file or the name of the thrift file itself. I then append the name of the processor with the processor suffix stripped since the thrift compiler matches that to the service schema name. Its not perfect. But I think its going to give us more consistent results. Especially since we can do something similar in the thrift client. This option should get us the closest to proper package and service names like grpc. But Im open to alternatives.

Copy link
Contributor

@mathyourlife-reddit mathyourlife-reddit left a comment

Choose a reason for hiding this comment

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

thanks @marcoferrer

trevorriles pushed a commit to reddit/baseplate.py that referenced this pull request Feb 21, 2025
This should align us with the upcoming baseplate.go changes.
reddit/baseplate.go#686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants