Skip to content

feat: filter tenant limits endpoint by allowlist - #18521

Merged
trevorwhitney merged 6 commits into
mainfrom
limits-endpoint
Jul 25, 2025
Merged

feat: filter tenant limits endpoint by allowlist#18521
trevorwhitney merged 6 commits into
mainfrom
limits-endpoint

Conversation

@trevorwhitney

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

The limits endpoint was added for self-serve config, but this information is useful to Logs Drilldown. In an effort to expose this information publicly, both in cloud and OSS, this PR adds an allowlist, so only properties in the allow list are exposed. This list is configurable, giving operators control over which limits they expose.

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
@trevorwhitney
trevorwhitney requested a review from a team as a code owner July 21, 2025 20:59
@github-actions

github-actions Bot commented Jul 21, 2025

Copy link
Copy Markdown
Contributor

💻 Deploy preview deleted.

trevorwhitney and others added 3 commits July 21, 2025 15:44
Add sensible default list of commonly needed, non-sensitive tenant
limit fields that are returned by the tenant limits endpoint. The
default includes fields like ingestion_rate_mb, max_query_series,
retention_period, and other essential configuration values while
excluding sensitive fields like S3 encryption keys.

Updated validation tests to expect the new default allowlist values
in all test cases to maintain test consistency.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread pkg/loki/config_handler.go Outdated

writeYAMLResponse(w, limit)
// Apply allowlist filtering if configured
allowlist := t.Cfg.LimitsConfig.TenantLimitsAllowPublish

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not using the tenant-scoped limit. So if we override the per-tenant TenantLimitsAllowPublish it will take no effect.

Should we use limit.TenantLimitsAllowPublish instead? limit comes fromt.TenantLimits.TenantLimits(user) or t.Overrides.DefaultLimits() if that's empty.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

While it's in the LimitsConfig, I actually wasn't thinking this should be a per-tenant limit. I thought this is something that would be configured once by the operator. What's the case an operator would want some tenants to see limits others couldn't. I think having it just be a regular config is simpler.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Problem is, as it is currently implemented, that can be configured per tenant, or at least it looks like it can from the docs.
Even if we hide the docs, we can see it on the code and think aha that's a hidden per-tenant limit and be misused.
If we don't want it per tenant (fine with that), IMO this should live somewhere else.

@salvacorts salvacorts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🙌

@trevorwhitney
trevorwhitney merged commit 73de7b5 into main Jul 25, 2025
67 checks passed
@trevorwhitney
trevorwhitney deleted the limits-endpoint branch July 25, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants