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

WIP: Fix1858: Ability to search all tenants in multi-tenant set up #2854

Closed
wants to merge 1 commit into from

Conversation

mghildiy
Copy link
Contributor

Adds ability to search all tenants in multi-tenant setup:

Which issue(s) this PR fixes:
Fixes #1858

Checklist

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

@mghildiy
Copy link
Contributor Author

Its WIP. Test part is pending

logger log.Logger
}

func (p parseQuery) RoundTrip(r *http.Request) (*http.Response, error) {
Copy link
Member

Choose a reason for hiding this comment

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

we will need this same functionality on all paths: tags, metrics, trace by id and search. i think we should try to implement this as a generic piece of middleware.

the middleware would define a "combiner" interface that it used to recombine the incoming http requests. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. So every path then would provide implementation for this new combiner interface as per path's requirements.

Copy link
Member

Choose a reason for hiding this comment

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

yes, but tbh i don't think this is possible atm on the metrics endpoints. maybe just return an error there for now since it's experimental?

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 check that search and trace by id have diff ways of processing requests and combining the responses. So another approach may be to pass this behaviour as a function to the middleware.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

type Combiner interface {
	Consume(input any) (count int)
	Result(statusCode int, statusMsg string) (*http.Response, error)
}

This is the Combiner interface I plan to have.

Consume is for merging responses of individual requests.
Result is for putting together final response based on merge result(and final statuscode, status message after all requests are processed).

Copy link
Member

Choose a reason for hiding this comment

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

  • Consume() should take an *http.Response. the middleware should just give it all responses it receives and rely on the interface's implementation to work out the details
  • Does result need the status code/message? These values will be in each consumed http.response?

I'm thinking like:

type Combiner interface {
	Consume(*http.Response)
	Result() (*http.Response, error)
}

as discussed out of band, let's:

  1. make this configurable (off by defafult)
  2. only worry about the trace by id path right now

if we establish a good generic set of code we can add the others later.

Copy link
Contributor Author

@mghildiy mghildiy Sep 8, 2023

Choose a reason for hiding this comment

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

As consuming a response may result into an error too(like when reading response body or during unmarshalling the body), so Consume must return error which we then use to build final response, and then maybe we call it Process.

Process(*http.Response) error

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with either Process or Result. I think they are clear enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a cross tenant middleware which takes combiner as input, and added one such combiner for traces

Copy link
Contributor Author

@mghildiy mghildiy Sep 20, 2023

Choose a reason for hiding this comment

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

Please review it. I plan to modify test accordingly.

@mghildiy mghildiy force-pushed the fix1858 branch 2 times, most recently from 5e6e857 to c19a069 Compare September 9, 2023 08:45
@electron0zero
Copy link
Member

Thank you, @mghildiy for putting in time into this feature. This feature requires significant efforts and we are thankful for your time and efforts you have put into this.

As mentioned here, We have decided to take this feature from our enterprise version(GET) and move it into OSS Tempo.

We believe that it's better if someone from the team takes our enterprise code and moves it into OSS tempo. It will avoid the duplicate efforts.

I am working on the PR to move it from Enterprise to OSS and will have a PR out soon.

Thank you for the contribution ❤️

Copy link
Contributor

github-actions bot commented Dec 6, 2023

This PR has been automatically marked as stale because it has not had any activity in the past 60 days.
The next time this stale check runs, the stale label will be removed if there is new activity. This pull request will be closed in 15 days if there is no new activity.
Please apply keepalive label to exempt this Pull Request.

@github-actions github-actions bot added the stale Used for stale issues / PRs label Dec 6, 2023
@github-actions github-actions bot closed this Dec 22, 2023
@electron0zero
Copy link
Member

update: multi-tenant search support was added via #3087 & #3262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used for stale issues / PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to search all tenants in multi-tenant setups
3 participants