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

continuous-test as module #7747

Merged
merged 22 commits into from
Apr 1, 2024
Merged

continuous-test as module #7747

merged 22 commits into from
Apr 1, 2024

Conversation

johannaratliff
Copy link
Contributor

@johannaratliff johannaratliff commented Mar 28, 2024

What this PR does

Puts continuous-test into a mimir module so we can run mimir -target=continuous-test

Checklist

  • Tests updated n/a
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features. n/a

Comment on lines 12 to 13
ServerMetricsPort int `yaml:"server_metrics_port"`
LogLevel log.Level `yaml:"log_level"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

These 2 settings should be removed, because we should use the Mimir ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Leaving in for the backwards compatibility of cmd/mimir-continuous-test/main.go for right now and will eventually remove. Unused in module now.

pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
pkg/mimir/modules.go Outdated Show resolved Hide resolved
@johannaratliff johannaratliff marked this pull request as ready for review March 29, 2024 19:15
@johannaratliff johannaratliff requested a review from a team as a code owner March 29, 2024 19:15
pkg/continuoustest/config.go Outdated Show resolved Hide resolved
@@ -135,6 +136,7 @@ type Config struct {
MemberlistKV memberlist.KVConfig `yaml:"memberlist"`
QueryScheduler scheduler.Config `yaml:"query_scheduler"`
UsageStats usagestats.Config `yaml:"usage_stats"`
ContinuousTest continuoustest.Config `yaml:"-"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we should add a YAML section if this is going to be a standard part of Mimir.

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 disagree as it doesn't run as a default startup piece of Mimir with target=all. It's currently usable as a standalone docker image with flags passed and doesn't take a config file and I think keeping it as close to current usage as possible is the best approach. I was including config for it originally and decided that passing config via file isn't something currently anyone has asked for so to hold off

Copy link
Contributor

Choose a reason for hiding this comment

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

Other components of Mimir that have CLI flags have a corresponding YAML configuration. That makes this particular feature inconsistent.

Copy link
Member

Choose a reason for hiding this comment

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

I agree re consistency. Adding YAML support will also expose all the continuous-test flags in reference documentation, which would be quite ugly, but now that continuous-test is part of Mimir, I think we should do it.

pkg/mimir/modules.go Outdated Show resolved Hide resolved
@@ -1034,6 +1037,23 @@ func (t *Mimir) initUsageStats() (services.Service, error) {
return t.UsageStatsReporter, nil
}

func (t *Mimir) initContinuousTest() (services.Service, error) {
start := func(ctx context.Context) error {
Copy link
Contributor

@56quarters 56quarters Mar 29, 2024

Choose a reason for hiding this comment

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

Doesn't seem necessary to create a start method here for the service. Should be fine to just execute this as regular code here and pass nil for the start method Better idea below

return nil
}

return services.NewBasicService(start, func(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually the way you'd use the service stuff is to have continoustest.Manager implement the service.Service interface and return an instance of it from this method. Then the module system handles calling start and run methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True! That was the original design. I don't know how I got here from there, but happy to go back to it as that's how the other modules behave.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope! Nevermind. I just converted it and got the errors I was getting beforehand when using the Manager as the service. Basically yes, that is the pattern we use in many other modules but they are meant to be continuously running with different behaviors for stopping etc. whereas if you look at ActivityTracker as an example for NewIdleService, it's worth it to use that dskit infrastructure instead of writing a new AwaitRunning func etc for it to behave properly. All I want is to init, and then be able to call Run and wrapping in BasicService does that here cleanly I think. I do agree with your previous comment for cleanly running it all as init, and then just pass it the Run func.

@johannaratliff johannaratliff merged commit 63865eb into main Apr 1, 2024
29 checks passed
@johannaratliff johannaratliff deleted the continuous-test-subcommand branch April 1, 2024 16:21
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