Skip to content

Conversation

elevran
Copy link
Contributor

@elevran elevran commented Aug 11, 2025

This PR introduces several interfaces and wrappers to allow users of backend/metrics code to work with datalayer as an implementation.

  • Redefined structures in backend and metrics (e.g., MetricsState, PodMetrics, Pod) as aliases to corresponding types in datalayer
  • Introduced interfaces to decouple rest of system (e.g., datastore) from the concrete implementations of backend/metrics.
    For example, EndpointFactory interface variable in datastore instead of a concrete PodMetricsFactory struct.
  • Added no-op methods to podMetrics so it implements the expected extended attribute interface (another option is to define Endpoint without it and type assert from Endpoint to (e.g.,) EndpointWithExtendedAttributes inside the datalayer).
  • RefreshLoop handling is now delegated to the EndpointFactory which allows removing StopRefreshLoop from the public interface (the factory was already calling the private startRefreshLoop method).

In terms of next steps to complete the co-existence:

  • Implement EndpointFactory for datalayer (e.g., manage Collectors for endpoints).
  • Enable runner.go to create the right EndpointFactory type, based on environment variable (e.g., EXPERIMENTAL_DATALAYER_V2 set for datalayer package based implementation).
  • minor tweaks in implementation (e.g., automatic data source registration, error logging to match existing cases such as undefined Pool checked on collection).

Signed-off-by: Etai Lev Ran <elevran@gmail.com>
Signed-off-by: Etai Lev Ran <elevran@gmail.com>
Signed-off-by: Etai Lev Ran <elevran@gmail.com>
Signed-off-by: Etai Lev Ran <elevran@gmail.com>
Signed-off-by: Etai Lev Ran <elevran@gmail.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 11, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 11, 2025
Copy link

netlify bot commented Aug 11, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 244ade5
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6899fae5f71d14000824e94a
😎 Deploy Preview https://deploy-preview-1351--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@elevran elevran changed the title Transition podmetrics to use type aliases from datalayer package Pluggable data layer: transition backend/metrics to use type aliases from datalayer package Aug 11, 2025
@elevran
Copy link
Contributor Author

elevran commented Aug 11, 2025

/cc @ahg-g @kfswain

@k8s-ci-robot k8s-ci-robot requested review from ahg-g and kfswain August 11, 2025 19:27
@ahg-g
Copy link
Contributor

ahg-g commented Aug 14, 2025

/lgtm
/approve

Thanks

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 14, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, elevran

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 14, 2025
@k8s-ci-robot k8s-ci-robot merged commit bab851d into kubernetes-sigs:main Aug 14, 2025
9 checks passed
@elevran elevran deleted the datalayer_podmetrics_aliases branch August 14, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants