Skip to content

fix(limits): Read the consumer group and topic from the ingest-limits config #17831

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

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

Conversation

periklis
Copy link
Collaborator

@periklis periklis commented May 27, 2025

What this PR does / why we need it:
This pull request enables a separate configuration of the topic and consumer-group for the ingest-limits service. This enables to separate consumers from other components like partition-ingesters.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@periklis periklis force-pushed the use-cfg-consumer-group branch from 648566c to bce467e Compare May 27, 2025 12:04
@periklis periklis marked this pull request as ready for review May 27, 2025 12:04
@periklis periklis requested a review from a team as a code owner May 27, 2025 12:04
@periklis periklis self-assigned this May 27, 2025
@pull-request-size pull-request-size bot added size/L and removed size/S labels May 28, 2025
Copy link
Contributor

github-actions bot commented May 28, 2025

@grobinson-grafana
Copy link
Contributor

Looks good but I think you also need to remove this function:

// MetadataTopic returns the metadata topic name for the given topic.
func MetadataTopic(topic string) string {
	return topic + ".metadata"
}

and update its usage in different places like the stream generator.

@pull-request-size pull-request-size bot added size/M and removed size/L labels May 29, 2025
Comment on lines +292 to +298
if c.IngestLimits.Enabled {
if err := c.IngestLimits.Validate(); err != nil {
errs = append(errs, errors.Wrap(err, "CONFIG ERROR: invalid ingest_limits config"))
}
if err := c.IngestLimitsFrontend.Validate(); err != nil {
errs = append(errs, errors.Wrap(err, "CONFIG ERROR: invalid ingest_limits_frontend config"))
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed this to conditional to fix the conflict with make validate-example-configs looking for a valid ingest limits section.

@periklis periklis changed the title fix(limits): Read the consumer group from the config fix(limits): Read the consumer group and topic from the ingest-limits config May 29, 2025
@@ -107,7 +107,7 @@ func (s *Generator) sendStreamsToKafka(ctx context.Context, streams []distributo
Key: []byte(tenant),
Value: b,
Partition: partitionID,
Topic: limits.MetadataTopic(s.cfg.Kafka.Topic),
Topic: fmt.Sprintf("%s.metadata", s.cfg.Kafka.Topic),
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this read s.cfg.IngestLimits.Topic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

s.cfg is not loki's config, but you are partially right we configure the topic for the generator via cli args, so this should be s.cfg.Kafka.Topic

f.StringVar(
&cfg.Topic,
"ingest-limits.topic",
"",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should set a default here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I kept this as we do in kafka_config.topic to make this an explicit user choice.

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

Successfully merging this pull request may close these issues.

2 participants