Skip to content

draft: adding filter eval for client spans #250

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

draft: adding filter eval for client spans #250

wants to merge 3 commits into from

Conversation

varkey98
Copy link
Contributor

Not complete yet, have to add filter call for db clients as well

@varkey98 varkey98 marked this pull request as draft June 26, 2025 16:31
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

Attention: Patch coverage is 64.17910% with 24 lines in your changes missing coverage. Please review.

Project coverage is 48.09%. Comparing base (95e853c) to head (3e9b294).

Files with missing lines Patch % Lines
...k/instrumentation/google.golang.org/grpc/client.go 61.11% 6 Missing and 1 partial ⚠️
...n/hypertrace/google.golang.org/hypergrpc/client.go 0.00% 6 Missing ⚠️
...trumentation/hypertrace/net/hyperhttp/transport.go 0.00% 6 Missing ⚠️
sdk/instrumentation/net/http/transport.go 84.84% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
+ Coverage   47.79%   48.09%   +0.30%     
==========================================
  Files          62       62              
  Lines        3013     3071      +58     
==========================================
+ Hits         1440     1477      +37     
- Misses       1499     1518      +19     
- Partials       74       76       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -58,6 +62,29 @@ func (rt *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
req.Body = io.NopCloser(bytes.NewBuffer(body))
}

filterResult := rt.filter.Evaluate(span)
if filterResult.Block {
Copy link
Collaborator

@prodion23 prodion23 Jun 26, 2025

Choose a reason for hiding this comment

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

is this for blocking client requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, since we are anyways calling libtraceable, thought we can add blocking support as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I guess I'm wondering on use case, I understand that because we want to add sampling, we could add blocking support.
I think question is if we should.

This seems like it introduces ambiguity in our blocking feature as a whole. Up to this point, blocking has specifically been about preventing bad requests from making it into the system.

Since we don't currently propagate string taint from the original request to downstream client spans, it's unclear what would drive the decision to block here. The only scenarios I can think of are:

1.) The app loads something from a DB or config and decides to block the outbound request - which is totally unrelated to the original inbound request.
2.) We're trying to enforce some kind of policy based purely on app-generated or static context - which feels more like something the app should handle directly.

If we allow blocking here, we're essentially saying: "some internal logic or app state, something not tied to the inbound request caused us to block an outbound call."

Copy link
Contributor Author

@varkey98 varkey98 Jun 26, 2025

Choose a reason for hiding this comment

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

Agreed. But we also have DLP based blocking which is basically to prevent data leaks and was made for client spans only, but at that time none of our agents did blocking eval on client spans and hence user said they'll put all of their egress under a proxy and instrument our agent there so that DLP based blocking will work.
Also, I was thinking that even if we dont turn it on today, we can add the blocking capability in code and later when we want to turn it on, we can enable blocking for client spans as well, since we have a config on libtraceable, which by default skips client spans for blocking eval.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But if you think even having the capability makes our feature ambiguous, then definitely removing this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, okay, but don't remove just because I don't think worth it -

i think worth identifying what we are trying to do..(I see you also did header injections) so is the purpose of these tickets to add sampling support, or add sampling support, header injections & blocking.
(my main intention was to ensure feature parity in the lang agents.., if we are adding these here, we need to make sure we do them in other lang agents)

I'd think this is a product question, if we see value in blocking client spans then sure..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, lets start a thread with protection team/pm involved as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sampling makes sense for client spans. Blocking I am not so sure. Let's get clarity from PM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have started a thread here: https://harness.slack.com/archives/C08SEG313E3/p1751005003984389

We kind of discussed it back when rolling dlp out, but since its a huge lift, never prioritised it. I am unsure if we should prioritise it now as well, but I thought I can add it here since its not a lot of extra changes from adding sampling support to get it supported in goagent.

@prodion23
Copy link
Collaborator

prodion23 commented Jun 27, 2025

maybe 2 more questions:
what is use case for the db call blocking, is it the same case as http clients, DLP?

& similarly can db spans be sampled today?

spanAttributes map[string]string) grpc.UnaryClientInterceptor {
var filter filter.Filter = &filter.NoopFilter{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the filter be an interface type instead of just using the NoopFilter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its an interface type. I am initialising the variable in this way because the interface variable can be assigned from 2 different interface implementations

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok. I see we are reading it from the options below too.

@varkey98
Copy link
Contributor Author

maybe 2 more questions: what is use case for the db call blocking, is it the same case as http clients, DLP?

& similarly can db spans be sampled today?

From a product perspective, I dont think dbclient spans blocking makes a lot of sense. Sampling still makes sense to me

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