Skip to content

Comments

Adds possibility to call BBS to retrieve stats for application's processes states.#129

Merged
benjaminguttmann-avtq merged 13 commits intocloudfoundry:masterfrom
gmllt:use-bbs-to-fetch-instances-running
Jul 22, 2025
Merged

Adds possibility to call BBS to retrieve stats for application's processes states.#129
benjaminguttmann-avtq merged 13 commits intocloudfoundry:masterfrom
gmllt:use-bbs-to-fetch-instances-running

Conversation

@gmllt
Copy link
Member

@gmllt gmllt commented May 30, 2024

The purpose of this PR is to propose the use of BBS to fetch the RUNNING state of the main application process.
This should help to avoid calls to /v2/space/:space_guid/summary endpoints

bbs internal client is configurable with :

      --bbs.api_url=BBS.API_URL  BBS API URL ($CF_EXPORTER_BBS_API_URL)
      --bbs.ca_file=BBS.CA_FILE  BBS CA File ($CF_EXPORTER_BBS_CA_FILE)
      --bbs.cert_file=BBS.CERT_FILE
                                 BBS Cert File ($CF_EXPORTER_BBS_CERT_FILE)
      --bbs.key_file=BBS.KEY_FILE
                                 BBS Key File ($CF_EXPORTER_BBS_KEY_FILE)
      --bbs.skip_ssl_verify      Disable SSL Verify for BBS ($CF_EXPORTER_BBS_SKIP_SSL_VERIFY)
      --bbs.timeout=5            BBS API Timeout ($CF_EXPORTER_BBS_TIMEOUT)

If bbs is not configured or unreachable, the code switch to the old method using /v2/space/:space_guid/summary to retrieve application running instances number.

Buildpacks information are retrieve with the new relationship introduced since CAPI 1.189.0

@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch 4 times, most recently from 2d914f6 to 71eb8b8 Compare June 21, 2024 09:57
@gmllt
Copy link
Member Author

gmllt commented Jun 28, 2024

Waiting for cloudfoundry/cloud_controller_ng!3863 to be merged and released.
This will only work with capi shipping the correct version of cloud_controller_ng

@gmllt
Copy link
Member Author

gmllt commented Aug 9, 2024

Waiting for cloudfoundry/cli!2933 to be merged.

@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch from 337713f to aea97bd Compare January 8, 2025 21:41
@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch 2 times, most recently from 8550d41 to e1bad98 Compare February 12, 2025 18:49
@gmllt gmllt changed the title Draft: Adds possibility to call BBS to retrieve stats for application's processes states. Adds possibility to call BBS to retrieve stats for application's processes states. Feb 12, 2025
@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch from 28375f6 to 6d6a189 Compare February 12, 2025 22:16
@gmllt gmllt changed the title Adds possibility to call BBS to retrieve stats for application's processes states. Draft: Adds possibility to call BBS to retrieve stats for application's processes states. Feb 12, 2025
@benjaminguttmann-avtq
Copy link
Contributor

@benjaminguttmann-avtq
Copy link
Contributor

I receive always

ERRO[0100] unable to initialize bbs client error="failed to ping BBS"
so would be good if you have an example config, so I can find out what I am doing wrong here

@benjaminguttmann-avtq
Copy link
Contributor

got it to work, setting skip-ssl to true made the trick. Unfortunately the logs do not give you any insights why the connection did not work.

I don't think we do a fallback to the old logic, as it gets removed nevertheless. I would remove the fallback and make the BBS config optional, e.g. if the BBS config is not present do not gather the summary metrics as maybe not everyone wants to make BBS available to their monitoring VMs.

@benjaminguttmann-avtq
Copy link
Contributor

@gmllt could you look into my latest comments and see if you can adjust accordingly?

@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch 2 times, most recently from 9f8a89a to 5393af3 Compare May 1, 2025 09:41
@gmllt
Copy link
Member Author

gmllt commented May 1, 2025

got it to work, setting skip-ssl to true made the trick. Unfortunately the logs do not give you any insights why the connection did not work.

Unfortunately, I haven't found any methods in the bbs client that allow me to retrieve anything other than a boolean on the connection test. I'll see if it's possible to suggest a modification.

I don't think we do a fallback to the old logic, as it gets removed nevertheless. I would remove the fallback and make the BBS config optional, e.g. if the BBS config is not present do not gather the summary metrics as maybe not everyone wants to make BBS available to their monitoring VMs.

I removed the fallback.

@gmllt
Copy link
Member Author

gmllt commented May 1, 2025

@benjaminguttmann-avtq
Currently, it's impossible to go beyond v8.11.0 of the Cloudfoundry CLI; cf_exporter depends on cf-go-client, which no longer works after a breaking change in v8.12.0.
I'll look into this.

@gmllt
Copy link
Member Author

gmllt commented May 3, 2025

Currently, it's impossible to go beyond v8.11.0 of the Cloudfoundry CLI; cf_exporter depends on cf-go-client, which no longer works after a breaking change in v8.12.0.
I'll look into this.

cf-go-client-helper is now compatible with cloudfoundry/cli 8.13.0

@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch from 5f7d5ed to 8fe4fe8 Compare May 3, 2025 09:03
@gmllt
Copy link
Member Author

gmllt commented May 3, 2025

got it to work, setting skip-ssl to true made the trick. Unfortunately the logs do not give you any insights why the connection did not work.

Unfortunately, I haven't found any methods in the bbs client that allow me to retrieve anything other than a boolean on the connection test. I'll see if it's possible to suggest a modification.

Now using ActualLRPs request instead of Ping request. This brings more information is case of error.

@gmllt gmllt changed the title Draft: Adds possibility to call BBS to retrieve stats for application's processes states. Adds possibility to call BBS to retrieve stats for application's processes states. May 3, 2025
@gmllt
Copy link
Member Author

gmllt commented May 3, 2025

@benjaminguttmann-avtq as this is a breaking change, do you think it's interesting to start a github.com/cloudfoundry/cf_exporter/v2 ?

@benjaminguttmann-avtq
Copy link
Contributor

@benjaminguttmann-avtq as this is a breaking change, do you think it's interesting to start a github.com/cloudfoundry/cf_exporter/v2 ?

Yes, I think it makes sense if we go with a v2 to mark the start of the only v3-api version

@gmllt
Copy link
Member Author

gmllt commented May 4, 2025

@benjaminguttmann-avtq as this is a breaking change, do you think it's interesting to start a github.com/cloudfoundry/cf_exporter/v2 ?

Yes, I think it makes sense if we go with a v2 to mark the start of the only v3-api version

Done.

You can consider to merge this PR (or create a new v2 branch) if everything looks good for you :

  • Up to date with latest cloudfoundry/cli v8.13.0.
  • Using BBS in place of /v2/spaces/:space_guid/summary to retrieve running instances.
  • Using ActualLRPs BBS requests to test if BBS configuration works.
  • No Fallback to /v2/spaces/:space_guid/summary.

@benjaminguttmann-avtq
Copy link
Contributor

@gmllt you think we should mentioned in the README that configuring the BBS values is optional?

@gmllt gmllt force-pushed the use-bbs-to-fetch-instances-running branch from d9cecf1 to 3afab11 Compare May 18, 2025 17:17
@benjaminguttmann-avtq
Copy link
Contributor

@gmllt is it expected that without configuring BBS I still get cf_application_instances and cf_application_running_instance ?

@github-project-automation github-project-automation bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jul 22, 2025
@benjaminguttmann-avtq benjaminguttmann-avtq merged commit fea465d into cloudfoundry:master Jul 22, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants