Skip to content

feat: Report feature server URLs to the registry and store them per project - #389

Merged
vanitabhagwat merged 18 commits into
masterfrom
feat/feature-server-reports
Nov 9, 2026
Merged

vanitabhagwat merged 18 commits into
masterfrom
feat/feature-server-reports

Conversation

@vanitabhagwat

@vanitabhagwat vanitabhagwat commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

Nothing records where a deployed feature server can be called. With this PR, each Go feature server reports its own URLs to the registry it already uses, and the registry stores them with the project so they can be listed.

  • Registry: two new RPCs, ReportFeatureServer and ListFeatureServers.
    • Reports are stored as project metadata (feast_metadata), so they are deleted with the project.
    • The registry only checks that URLs are well-formed, that the project exists, and that size limits hold.
    • An identical report within an hour isn't written again.
    • Off by default: registry.enable_feature_server_reports.
  • Clients: list_feature_servers and report_feature_server on RemoteRegistry (gRPC) and HttpRegistry (REST: /projects/{project}/feature_servers).
  • Auth: auth.feature_server_report_auth is off (default), optional or required. Reports have their own category, outside WRITE_RPC_METHODS, so auth for definition writes is unchanged, and listing stays open. Records are stored as unverified until the app-identity check exists (check_reporter_identity, a TODO).
  • Go feature server: reports at startup and then once a day, in the background, over the registry connection it already has (HTTP or gRPC). Off by default: FEATURE_SERVER_REPORTING, with the URLs in FEATURE_SERVER_ADVERTISED_URLS.

Tested with unit tests (Python and Go), and end to end locally: the Go server in grpc and hybrid mode reported to feast serve_registry, and the record read back through ListFeatureServers.

Which issue(s) this PR fixes:

EAPC-23485

🤖 Generated with Claude Code

vanitabhagwat and others added 6 commits November 4, 2026 22:39
… the proto

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…RPCs

Generated with grpcio-tools 1.62.3 and mypy-protobuf 3.3.0, the versions
that reproduce the committed stubs byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r gRPC

A running feature server reports the URLs it can be called at; both
registries keep one record per distinct URL list as project metadata, so
Feature Hub can show callable endpoints per project (EAPC-23485).

- feast/infra/registry/feature_server_reports.py: pydantic models, the
  generic checks (URL format, size limits), the record key, the hourly
  throttle, 48 h version pruning, 30-day expiry, proto converters and the
  outcome log line plus a StatsD counter.
- SqlRegistry.report_feature_server / list_feature_servers, behind
  SqlRegistryConfig.enable_feature_server_reports (default off), plus the
  list_project_metadata_by_prefix and delete_project_metadata helpers.
  Reports require an existing project, never touch feature definitions and
  never write the audit log.
- BaseRegistry signatures (NotImplementedError by default), RemoteRegistry
  (gRPC) and HttpRegistry (POST/GET /projects/{project}/feature_servers)
  clients, and ReportFeatureServer / ListFeatureServers handlers.
- New errors: FeatureServerReportInvalid, FeatureServerReportLimitExceeded,
  FeatureServerReportsDisabled, FeatureServerReportUnavailable.
- Auth: AuthConfig.feature_server_report_auth (off|optional|required,
  YAML-boolean safe) and REPORT_RPC_METHODS, applied by
  WritePathAuthInterceptor; ReportFeatureServer stays out of
  WRITE_RPC_METHODS. The registry server refuses to start with no_auth and
  a setting other than off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- verified is now the result of check_reporter_identity, which fails
  closed (always False) until EAPC-23485 open question 8 decides which
  claim identifies the app. A valid token only records the identity
  (the authenticated user name, never the token), normalized to drop
  empty, over-long or control-character values.
- An unverified report never downgrades a verified record: stored URLs,
  labels, registry, verified flag and identity are kept; only last_seen
  and the reported version are refreshed.
- At the 50-record cap a new verified report evicts an unreadable row or
  the least recently seen unverified record; it is rejected only when all
  50 are verified. New unverified reports are still rejected at the cap.
- validate_report rejects Unicode control characters (category Cc) in
  URLs, scopes, label keys and values, version and registry
  (INVALID_ARGUMENT, reason control_character_in_<field>). The outcome log
  line escapes project, app and identity, and the metric drops the
  unbounded app tag (outcome and reason only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…server

When FEATURE_SERVER_REPORTING=on, the Go feature server sends a
FeatureServerReport (advertised URLs, version, registry type, labels) to
the registry it already uses: a JSON POST to
<registry path>/projects/{project}/feature_servers for an HTTP registry,
or the ReportFeatureServer RPC on the existing connection for a gRPC
registry. Other registry types are skipped with an info log.

The reporter runs in a background goroutine in http, grpc and hybrid
modes: once at startup, then every FEATURE_SERVER_REPORT_INTERVAL
(default 24h) at a random per-process offset, with a 2 s timeout per
call. No response, 5xx, UNAVAILABLE and DEADLINE_EXCEEDED get one retry
an hour later; other rejections are logged as warnings and not retried.
It never affects serving.

Settings: FEATURE_SERVER_REPORTING, FEATURE_SERVER_ADVERTISED_URLS
(scope=url entries), FEATURE_SERVER_REPORT_LABELS (k=v entries),
FEATURE_SERVER_REPORT_VERSION (default: build version),
FEATURE_SERVER_REPORT_INTERVAL. Malformed entries are dropped with a
warning. Refs EAPC-23485.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Optional report auth never aborts on an unusable Authorization header
  (malformed shape, undecodable token) and logs only the exception type,
  not the header, which can carry credentials.
- The Bearer token extractor rejects "Bearer a b" / "Bearer " as an
  authentication failure instead of a ValueError (INTERNAL).
- ReportFeatureServer / ListFeatureServers return UNIMPLEMENTED on registry
  types without report storage instead of INTERNAL.
- Startup warns when feature_server_report_auth is set but write-path auth
  is not in use (every RPC already needs a token there).
- Reject an empty port ("http://host:") and duplicate URLs in a report.
- Keep at most 20 versions per record, newest first, so a server that puts
  a build id in `version` cannot grow its record without bound.
- Remove unreadable feature_server: rows on write so they cannot hold the
  per-project cap; match the key prefix case-sensitively (MySQL LIKE is not).
- Refuse reports in purge_feast_metadata mode, which deletes them anyway.
- Answer throttled repeats without locking the projects row; correct the
  lock-order comment.
- Go: bind the HTTP listener before starting the reporter (http and hybrid),
  so a server never reports before its port accepts connections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vanitabhagwat and others added 2 commits November 6, 2026 12:20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
master's ValidationReference.from_proto passes profiler=None for a proto
without a profiler (added with the from_proto equality change), which fails
make lint-python. Cast at the call; behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
if errors.Is(err, context.DeadlineExceeded) {
code = codes.DeadlineExceeded
}
retryable := code == codes.Unavailable || code == codes.DeadlineExceeded

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

UNAVAILABLE (and HTTP 5xx) is treated as worth retrying. But when reports are off (enable_feature_server_reports, off by default), the registry returns FeatureServerReportsDisabled as UNAVAILABLE / 503. So on every registry that hasn't turned reports on, each pod logs "failed; will retry once" and retries every interval, indefinitely. A setting that is off is being treated as an outage. Either have the registry return a distinct status (e.g. FAILED_PRECONDITION or UNIMPLEMENTED), or recognise "disabled" here and skip the retry.


// invalidUrlReason mirrors the registry's URL check so one bad entry is
// dropped here instead of getting the whole report rejected.
func invalidUrlReason(rawUrl string) string {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The comment says invalidUrlReason "mirrors the registry's URL check so one bad entry is dropped here instead of getting the whole report rejected", but it skips most of the registry's checks:

  • whitespace or control characters
  • port outside 1-65535 (http://h:99999 parses fine in Go)
  • empty port (http://h:)
  • URL longer than 2048
  • duplicate URLs
  • more than 10 URLs
  • scope longer than 32

parseLabels (line 129) also doesn't limit label count or key/value length. Any one of these gets the whole report rejected with INVALID_ARGUMENT or RESOURCE_EXHAUSTED, which is never retried. The server is then never reported, and the only sign is one warning per interval.

// periodic report comes first. Rejections are logged and never retried.
func (r *Reporter) Run(ctx context.Context) {
start := r.Clock.Now()
nextTick := start.Add(r.Offset(r.Interval))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The random offset can be anywhere from 0 to the full interval, so the first periodic report can fire seconds after the startup report. That adds a second registry call per pod during rollout, when every pod is starting at once. The registry throttles it, but it is still one extra call per pod. Pick the offset from [interval/2, interval), or count it from the startup report, so the first periodic report always comes well after the startup one.

Comment thread sdk/python/feast/infra/registry/http.py Outdated
The route answers 204 whether the record was written or unchanged,
so this returns True on success.
"""
url = f"{self.base_url}/projects/{project}/feature_servers"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

project goes into the URL path unescaped (here and at line 1070). The Go HTTP transport escapes it with url.PathEscape. A project name containing /, ? or # would hit a different route from the Python client than from the Go server. Use urllib.parse.quote(project, safe="") to match.

if merged.verified
else None
)
if evict is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Once a project has 50 records (MAX_RECORDS_PER_PROJECT), a new record can only push out an old one if the new one is verified. With report auth off, nothing is ever verified, so the cap becomes a hard wall. Records are keyed on the URL list, so URL changes, renamed deployments and short-lived test servers each add a new record over the 30-day window. Once there are 50, every new feature server in the project is rejected with RESOURCE_EXHAUSTED (never retried) until old records expire. Suggest pushing out the least recently seen record when the project is at the cap, or allowing unverified records to push out other unverified ones.

]
return min(unverified)[1] if unverified else None

def list_feature_servers(self, project: str) -> List["fsr.FeatureServerRecord"]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

list_feature_servers returns every stored record without checking is_record_expired. Expired records are deleted only inside _report_feature_server's write path, which runs only when a report in the same project changes data. If a project stops getting reports, servers last seen more than 30 days ago stay listed as live indefinitely. Filter out expired records here.

vanitabhagwat and others added 7 commits November 6, 2026 14:19
- Reports switched off are a setting, not an outage: FeatureServerReportsDisabled
  is now FAILED_PRECONDITION / 409 (was UNAVAILABLE / 503), and the Go reporter
  logs it at info as outcome=disabled and never retries it. A database outage
  stays UNAVAILABLE / 503 and is still retried once.
- The Go reporter applies the registry's checks before sending, dropping the
  offending entry with a warning instead of getting the whole report rejected:
  whitespace and control characters, port 1-65535, empty port, URL length,
  duplicate URLs, at most 10 URLs, scope length, label count and key/value
  length, version length, and the 16 KB report size (URLs dropped from the end).
- The first periodic report is sent at a random point in [interval/2, interval),
  so it never comes right after the startup report.
- HttpRegistry escapes the project in the path (quote(project, safe="")),
  matching the Go reporter's url.PathEscape.
- At the 50-record cap, a new record replaces the least recently seen
  unverified record, so a project keeps accepting new servers while report auth
  is off. Verified records are never pushed out.
- list_feature_servers leaves out records past the 30-day retention, which are
  otherwise only deleted on a write to the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At the 50-record cap, an unverified report (every report while report auth is
off) may replace only an unverified record not seen for 48 hours. Servers
that stopped reporting still free their slot, but a flood of unauthenticated
reports can no longer push out servers that are still reporting. A verified
report may still replace any unverified record; verified records are never
pushed out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
minio/minio is no longer published on Docker Hub or quay.io, so every MinIO
test container failed to start ('pull access denied for minio/minio,
repository does not exist'), erroring all minio_registry tests. Use one
S3-compatible image, chainguard/minio pinned by digest, in all three places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pr-local-integration-tests ran 8 pytest workers on a 4-CPU GitHub-hosted
runner; with Spark, Ray and the test containers it ran out of memory and the
runner was shut down about 5 minutes in, every run. Default to 4 workers via
INTEGRATION_TEST_WORKERS, which can still be overridden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub no longer supports the macos-14 runner ('The configuration
macos-14-arm64-us-default is not supported'), so the macOS unit-test jobs
were cancelled before starting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

// fitReportSize drops URLs from the end until the report fits the registry's
// size limit; the first URLs are the most useful (external before internal).
func fitReportSize(cfg Config) []AdvertisedUrl {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fitReportSize only ever drops URLs, but URLs aren't always what makes the report too big. Labels can be: 20 labels with 256-character multibyte values come to 20 KB or more. In that case every advertised URL gets dropped, with a warning for each one, and the report is still over 16 KB. The registry rejects it, the rejection is never retried, and the same thing happens every interval. Suggestion: if the report without any URLs is still over the limit, keep the URLs and trim labels instead, or log a single warning that the labels are the problem.

"""
material: object
if report.urls:
material = sorted(entry.url for entry in report.urls)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The record key hashes only the URL strings, but the throttle check at line 380 also compares labels, registry and scope. Two deployments that advertise the same URL list share one record. Examples: blue/green behind one load balancer, or two apps behind a shared ingress URL. If their labels or registry type differ, every report from one overwrites the other's labels. Each of those reports also skips the 1h throttle and becomes a locked write, so the stored record keeps flip-flopping between the two. Either include the labels that identify a deployment (e.g. "app") in the key, or document that the URL list alone identifies a deployment and that the last report's labels win.

Comment thread sdk/python/feast/infra/registry/sql.py Outdated
enable_feature_server_reports: StrictBool = False
""" bool: When true, report_feature_server stores feature server reports as
project metadata. Off by default: reports are rejected with
FeatureServerReportsDisabled (UNAVAILABLE / 503) and nothing is stored.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This docstring says a disabled registry rejects reports "with FeatureServerReportsDisabled (UNAVAILABLE / 503)", but errors.py now maps FeatureServerReportsDisabled to FAILED_PRECONDITION / 409. The Go reporter depends on that: 409 / FAILED_PRECONDITION means "disabled, never retry" and 503 / UNAVAILABLE means "retry". Anyone writing a client or an alert from this docstring will treat a config switch as an outage. Should read "(FAILED_PRECONDITION / 409)".

vanitabhagwat and others added 2 commits November 9, 2026 11:44
- Go reporter: when the labels alone put a report over the registry's 16 KB
  limit (20 labels of 256 multibyte characters can), drop the largest labels
  with one warning instead of dropping every URL and still being rejected.
- Record key: hash every value that identifies a deployment, not only the URL
  strings: the (url, scope) pairs, the labels and the registry type.
  Deployments that share URLs (blue/green behind one load balancer, a shared
  ingress) now get separate records instead of overwriting each other's labels
  and defeating the throttle. Pods of one deployment, and rollouts (the
  version is not in the key), still share one record. A report that copies
  a verified record's URLs with other labels can no longer touch that record.
- SqlRegistryConfig.enable_feature_server_reports docstring: reports switched
  off are FAILED_PRECONDITION / 409, not UNAVAILABLE / 503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Elasticsearch 8 sizes its JVM heap from the host's memory (about half of it)
when the container has no limit. In pr-local-integration-tests two of these
started together and used up the runner's memory: every run was shut down
(SIGTERM, 'The runner has received a shutdown signal') while an Elasticsearch
container was starting. Set ES_JAVA_OPTS=-Xms512m -Xmx512m and mem_limit=1g on
both Elasticsearch test containers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cOS 14

CI's macOS unit tests moved to macos-15 because GitHub retired macos-14. The
class was skipped on macOS 14 by its own condition, so it never ran in CI, and
it fails on master on macOS 15 (KeyError in write_to_online_store with
transform_on_write=False; a docling PDF parse error). Skip it on 15 too so CI
runs what it ran before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vanitabhagwat
vanitabhagwat merged commit 4e73821 into master Nov 9, 2026
45 of 49 checks passed
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.

2 participants