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

feat: include unscoped queries and default the batch size to 7 #4436

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

javiermolinar
Copy link
Contributor

@javiermolinar javiermolinar commented Dec 11, 2024

What this PR does:
It checks for unscoped attributes to weigh the request.
It sets the default batch size to 7. Our tests have proved that a batch size of less than 7 in combination with weighted requests introduces a latency penalty due to contention.

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Contributor

@carles-grafana carles-grafana left a comment

Choose a reason for hiding this comment

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

Looks good but the new manifest check has been merged so I think you'll need to rebase on main and run `make generate-manifest``

@@ -114,12 +114,17 @@ func (c weightRequestWare) setTraceQLWeight(req Request) {
if c.Op != traceql.OpNone {
conditions++
}

if c.Attribute.Intrinsic == traceql.IntrinsicNone && c.Attribute.Scope == traceql.AttributeScopeNone {
Copy link
Member

Choose a reason for hiding this comment

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

what are we trying to catch here?

Copy link
Member

Choose a reason for hiding this comment

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

oh, you are looking for unscoped attributes. it may be safer to test spanRequest.AllConditions at the bottom?

i'm fine with this, but perhaps do a bit of testing before we merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean something like?:

if heavyQuery  && !spanRequest.AllConditions{
		req.SetWeight(c.weights.TraceQLSearchWeight + 1)
	}

Copy link
Member

Choose a reason for hiding this comment

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

apologies, i meant to edit this comment and got sidetracked. AllConditions will only be true if its a single spanset selector will all conditions &&'ed. It will be true even with unscoped attributes, so it will be true on both of these:

{ span.foo = "bar" && resource.baz = "bat" }
{  .foo = "bar" && .baz = "bat" }

If AllConditions is false -OR- there are unscoped attributes the querier is a heavier query b/c it cannot be evaluated in the fetch layer and requires the engine.

It's possible that both unscoped attributes and AllConditions false should result in TraceQLSerachWeight + 1 but would need some testing.

Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

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

good with the change. needs a changelog and a quick test to confirm that the unscoped attributes change is a winner

@@ -114,12 +114,17 @@ func (c weightRequestWare) setTraceQLWeight(req Request) {
if c.Op != traceql.OpNone {
conditions++
}

if c.Attribute.Intrinsic == traceql.IntrinsicNone && c.Attribute.Scope == traceql.AttributeScopeNone {
Copy link
Member

Choose a reason for hiding this comment

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

oh, you are looking for unscoped attributes. it may be safer to test spanRequest.AllConditions at the bottom?

i'm fine with this, but perhaps do a bit of testing before we merge?

@knylander-grafana
Copy link
Contributor

Does this impact configuration or how a user would run queries? In other words, are there any changes in this PR that would impact how a user interacts or configures Tempo? If so, we should consider updating the docs.

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.

4 participants