{"id":20410270,"url":"https://github.com/kuadrant/gateway-api-state-metrics","last_synced_at":"2025-10-11T20:36:11.893Z","repository":{"id":188795547,"uuid":"679338689","full_name":"Kuadrant/gateway-api-state-metrics","owner":"Kuadrant","description":"Kube State Metrics `CustomResourceState` configurations for Gateway API resources","archived":false,"fork":false,"pushed_at":"2025-02-13T12:37:40.000Z","size":2836,"stargazers_count":22,"open_issues_count":4,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T11:02:18.237Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kuadrant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-16T16:05:28.000Z","updated_at":"2025-04-25T20:04:15.000Z","dependencies_parsed_at":"2023-09-27T07:27:43.303Z","dependency_job_id":"c3ff3e9f-0ff2-415b-a9c0-0bae1b30eb90","html_url":"https://github.com/Kuadrant/gateway-api-state-metrics","commit_stats":null,"previous_names":["david-martin/gateway-api-state-metrics","kuadrant/gateway-api-state-metrics"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Kuadrant/gateway-api-state-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kuadrant%2Fgateway-api-state-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kuadrant%2Fgateway-api-state-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kuadrant%2Fgateway-api-state-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kuadrant%2Fgateway-api-state-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kuadrant","download_url":"https://codeload.github.com/Kuadrant/gateway-api-state-metrics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kuadrant%2Fgateway-api-state-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008617,"owners_count":26084480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T05:45:17.185Z","updated_at":"2025-10-11T20:36:11.847Z","avatar_url":"https://github.com/Kuadrant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gateway API State Metrics\n\n\"Standard metrics and dashboards for Gateway API resources\"\n\n[Kube State Metrics](https://github.com/kubernetes/kube-state-metrics) `CustomResourceState` configurations for [Gateway API](https://gateway-api.sigs.k8s.io/) resources.\n\nThe contents of this repository are intended to be used with kube-state-metrics.\nTo use the CustomResourceState, see the [configuration information](https://github.com/kubernetes/kube-state-metrics/blob/main/docs/metrics/extend/customresourcestate-metrics.md#configuration) for how to\nconfigure an existing or separate kube-state-metrics instance with a custom\nresource configuration.\n\nThe CustomResourceState is available at [./config/default/custom-resource-state.yaml](./config/default/custom-resource-state.yaml)\n\nFor easier consumption via kustomize, a [./kustomization.yaml](./kustomization.yaml)\nis available that generates a ConfigMap named `custom-resource-state` with the\nCustomResourceState data in a key called `custom-resource-state.yaml`.\n\n## Kube Prometheus Example\n\nAn example of how to use this with kube-promethues in shown in [./config/examples/kube-prometheus](./config/examples/kube-prometheus)\nThe kustomization config does the following:\n\n- mounts the ConfigMap as a volume in the kube-state-metrics Deployment\n- adds the `--custom-resource-state-config-file` arg to the container, referencing the file in the ConfigMap\n- patches the `kube-state-metrics` ClusterRole with permissions for `customresourcedefinitions`\nand the various Gateway API resources in the `gateway.networking.k8s.io` apiGroup\n- changes the kube-state-metrics image to a version that supports CustomResourceState and has various issues fixed.\n- includes example Grafana dashboards\n- includes example Prometheus Alert rules\n\n## Dashboards\n\nA set of Grafana dashboards are available in [./config/examples/dashboards](./config/examples/dashboards)\nand on [grafana.com](https://grafana.com/grafana/dashboards/?search=Gateway+API+State)\nYou can import them directly into Grafana and modify as needed.\nThe dashboards are divided by resources (GatewayClasses, Gateways, HTTPRoutes, GRPCRoutes, TLSRoutes, TCPRoutes and UDPRoutes),\nwith variables for filtering, and links to drill down from a GatewayClass to a\nGateway to all the routes.\n\nhttps://grafana.com/grafana/dashboards/19432\n\u003cimg src=\"gatewayclasses.png\" alt=\"gatewayclasses\" width=\"800\"/\u003e\n\nhttps://grafana.com/grafana/dashboards/19433\n\u003cimg src=\"gateways.png\" alt=\"gateways\" width=\"800\"/\u003e\n\nhttps://grafana.com/grafana/dashboards/19434\n\u003cimg src=\"httproutes.png\" alt=\"httproutes\" width=\"800\"/\u003e\n\nhttps://grafana.com/grafana/dashboards/19570\n\u003cimg src=\"grpcroutes.png\" alt=\"grpcroutes\" width=\"800\"/\u003e\n\nhttps://grafana.com/grafana/dashboards/19572\n\u003cimg src=\"tlsroutes.png\" alt=\"tlsroutes\" width=\"800\"/\u003e\n\nhttps://grafana.com/grafana/dashboards/19571\n\u003cimg src=\"tcproutes.png\" alt=\"tcproutes\" width=\"800\"/\u003e\n\nhttps://grafana.com/grafana/dashboards/19573\n\u003cimg src=\"udproutes.png\" alt=\"udproutes\" width=\"800\"/\u003e\n\n## Alerts\n\nA set of example Alerts are available in [./config/examples/rules](./config/examples/rules).\nYou can create the PrometheusRule resource directly or modify it as needed.\n\n## Metrics\n\nAll metrics have GVK labels to allow more specific matching and filtering.\nFor example:\n\n```yaml\n{\n  customresource_group=\"gateway.networking.k8s.io\"\n  customresource_kind=\"Gateway\",\n  customresource_version=\"v1beta1\"\n}\n```\n\nIn addition, all metrics have a `name` and `namespace` label, where applicable:\n\n```yaml\n{\n  namespace=\"\u003cNAMESPACE\u003e\",\n  name=\"\u003cNAME\u003e\"\n}\n```\n\nAll metrics are prefixed with `gatewayapi_`.\nFor example, `gatewayapi_gateway_status`.\n\nThe full list of metrics is available at [./METRICS.md](METRICS.md)\n\n## Local dashboard development\n\nDashboards are written in jsonnet, and use the [grafonnet library](https://github.com/grafana/grafonnet).\nResulting dashboard json files are checked in.\nTo generate dashboards, run `make generate-dashboards`.\n\nLocal development can be done using a combination of automatic jsonnet execution\nand using the [grafana-operator](https://github.com/grafana-operator/grafana-operator)\nto automatically update dashboards in Grafana. This allows for a relatviely fast\ndevelopment loop where you can change a dashboard jsonnet file, save it, then\nsee the changes automically in a browser.\n\nTo set up the local development environment, run the following:\n\n```shell\n./hack/local_dev.sh\n```\n\n## Grafonnet Development Guidelines\n\n### Experiment and Learn\n\nGrafonnet is a powerful tool, but it may not cover all scenarios in its documentation. If you encounter issues or roadblocks, don’t be afraid to experiment with different approaches. Learning through trial and error can often lead to better understanding and innovative solutions. Remember, every challenge is an opportunity to learn.\n\n### Use Grafana UI Reference\n\nGrafana’s user interface can be an invaluable reference when working with transformations and overrides in Grafonnet. If you’re unsure about how to implement a specific feature in Grafonnet, try creating it in the Grafana UI first. Then, export the dashboard as JSON. This exported JSON can serve as a reference for how to implement the same feature in Grafonnet.\n\n### Panel Abstraction and Reuse\n\nConsider creating abstract representations of panels that are used repeatedly across your dashboards. This not only helps avoid repetition but also ensures consistency in the layout and design of your panels.\n\nAbstraction can also make your code more readable and maintainable, especially when dealing with complex input patterns. When deciding whether to create a new abstraction or reuse an existing one, keep the “Don’t Repeat Yourself” (DRY) principle in mind. If you find yourself writing similar code for multiple panels, it might be time to consider abstraction.\n\nBy following these guidelines, you can navigate Grafonnet development more effectively and efficiently. Remember, the goal is not just to create functional dashboards, but also to write clean, maintainable code that can be understood and modified by others.\n\n## Contributing\n\nContributions are welcome in the form of bugs, feature requests \u0026 pull requests.\nBefore submitting a new issue, please use the search function to see if there\nis already a similar report or pull request.\nRoadmap items will be represented as Issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuadrant%2Fgateway-api-state-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuadrant%2Fgateway-api-state-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuadrant%2Fgateway-api-state-metrics/lists"}