{"id":15656428,"url":"https://github.com/bostrt/vsphere-ci-session-exporter","last_synced_at":"2025-04-06T14:27:54.983Z","repository":{"id":137793238,"uuid":"437117863","full_name":"bostrt/vsphere-ci-session-exporter","owner":"bostrt","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-30T16:26:47.000Z","size":195,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-12T20:35:01.352Z","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/bostrt.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}},"created_at":"2021-12-10T21:25:02.000Z","updated_at":"2022-06-09T14:42:29.000Z","dependencies_parsed_at":"2023-05-22T14:00:19.105Z","dependency_job_id":null,"html_url":"https://github.com/bostrt/vsphere-ci-session-exporter","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"06a7a6c7a9793849ba3a716070eba3419abf6553"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostrt%2Fvsphere-ci-session-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostrt%2Fvsphere-ci-session-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostrt%2Fvsphere-ci-session-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostrt%2Fvsphere-ci-session-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bostrt","download_url":"https://codeload.github.com/bostrt/vsphere-ci-session-exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247494788,"owners_count":20947937,"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","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-10-03T13:02:00.440Z","updated_at":"2025-04-06T14:27:54.963Z","avatar_url":"https://github.com/bostrt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vSphere + OpenShift CI Server Metrics\n\nThis application exports Prometheus metrics that bring together vSphere Sessions and related OpenShift CI jobs. This can\nbe used for troubleshooting session leaks or session limit issues.\n\nOnce application is running, metrics are exposed at `localhost:8090/metrics`. Of course, port is configurable.\n\nThese metrics can be scraped by Prometheus to view. In this screenshot, we can see a specific CI job and User Agent\nusing a notable number of sessions.\n\n![](./img/prometheus.png)\n\n# TODO\n\n- Error handle loss of vSphere session \n- Error handle loss of k8s/ocp auth\n  - Use service account\n\n# Usage\n\n```shell\nUsage:\n  vsphere-ci-session-metrics start [flags]\n\nFlags:\n  -h, --help                        help for start\n      --kubeconfig string           path to build cluster kubeconfig\n      --listen-port int             exporter will listen on this port (default 8090)\n      --log-level string            set log level (e.g. debug, warn, error) (default \"info\")\n      --prow string                 URL for Prow CI instance (default \"prow.ci.openshift.org\")\n      --vsphere string              vSphere hostname (do not include scheme)\n      --vsphere-passwd string       password for vSphere\n      --vsphere-user string         username for vSphere\n      --vsphere-user-agent string   user agent to vSphere communication (default \"vsphere-ci-session-metrics\")\n```\n\nThe following flags are **REQUIRED**:\n\n- `--kubeconfig`\n- `--vsphere`\n- `--vsphere-passwd`\n- `--vsphere-user`\n\nThe rest are entirely optional and have default values.\n\n## Environment Variables\n\nIf you'd rather use environment variables instead of CLI flags:\n\n- `KUBECONFIG`\n- `LISTEN_PORT`\n- `LOG_LEVEL`\n- `PROW`\n- `VSPHERE_PASSWD`\n- `VSPHERE_USER`\n- `VSPHERE_USER_AGENT`\n\n# Run Locally\n\nHere's an example command:\n\n```shell\n./vsphere-ci-session-metrics \\\n   --kubeconfig mykc \\\n   --vsphere vc.example.com \\\n   --vsphere-user administrator@vsphere.local \\\n   --vsphere-passwd tops3cret\n\nINFO[0000] Launching on :8090...                        \n```\n\n# Run in k8s\n\nTODO\n\n## Caveats\n\nIf there are 2 or more CI jobs running at the same time with the _same_ CI user, the metric \nwill essentially be duplicated, one for each job. This means if you were to run a query like this:\n\n`sum by(username) (vsphere_ci_user_sessions_correlated)`\n\nit would return an exaggerated session count. It is advised to _not_ use the query above without \nhaving a second `by(...)` field. For example:\n\n`sum by(username,ci_job) (vsphere_ci_user_sessions_correlated)` \n\nwould be fine. \n\nIt is important to keep in mind it's not currently possible to differeniate between 2 or more CI jobs\nin terms of their session usage in the event those CI jobs run at the same time. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbostrt%2Fvsphere-ci-session-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbostrt%2Fvsphere-ci-session-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbostrt%2Fvsphere-ci-session-exporter/lists"}