Skip to content

feat: Replace deprecated Doppler recentLogs with Log Cache client#1237

Draft
ZPascal wants to merge 16 commits intocloudfoundry:mainfrom
ZPascal:issue-1181
Draft

feat: Replace deprecated Doppler recentLogs with Log Cache client#1237
ZPascal wants to merge 16 commits intocloudfoundry:mainfrom
ZPascal:issue-1181

Conversation

@ZPascal
Copy link

@ZPascal ZPascal commented Aug 1, 2024

Feat: Replace deprecated Doppler recentLogs with Log Cache client

Problem

The DopplerClient.recentLogs() endpoint relies on the Loggregator Traffic Controller /apps/{id}/recentlogs HTTP endpoint, which was removed in Loggregator ≥ 107.0 (shipped with CF Deployment ≥ 24.3 and Tanzu Application Service ≥ 4.0). Calls to this endpoint on modern CF foundations fail at runtime, and the related types (LogsRequest, LogMessage from org.cloudfoundry.doppler) caused compilation errors in the integration tests.

Out of the scope

  • LogCache client-based log streaming support

Fixes #1181 & #1230


Changes

cloudfoundry-client

  • Marked DopplerClient.recentLogs() as @Deprecated with a Javadoc @deprecated note pointing to the replacement API and documenting the platform version boundary (Loggregator < 107.0 / CFD < 24.3 / TAS < 4.0).
  • Added LogCacheClient.recentLogs(ReadRequest) as the new, non-deprecated entry point.

cloudfoundry-client-reactor

  • Implemented ReactorLogCacheEndpoints.recentLogs() — delegates to the existing read() method.
  • Wired the implementation in _ReactorLogCacheClient.

cloudfoundry-operations

  • Extended Applications interface with logsRecent(ReadRequest) backed by LogCacheClient.
  • Updated DefaultApplications to accept and hold a Mono<LogCacheClient> alongside the existing Mono<DopplerClient>.
  • The existing logs(LogsRequest) / logs(ApplicationLogsRequest) methods are now marked @Deprecated.
  • Updated _DefaultCloudFoundryOperations to expose logCacheClient as an optional builder field (mirrors the existing dopplerClient pattern; missing client yields a descriptive IllegalStateException on first use).

Integration & unit tests

  • Updated AbstractOperationsTest and DefaultApplicationsTest to supply the new LogCacheClient mock.
  • Renamed / split test cases to clearly distinguish Doppler (logsRecentDoppler, logsDoppler, logsNoAppDoppler) from Log Cache (logsRecentLogCache) paths; added @SuppressWarnings("deprecation") where the old API is still exercised.
  • Added ApplicationsTest.logsRecent() integration test that provisions an application, fetches recent logs via LogCacheClient, and asserts that each entry carries a valid LogType (OUT or ERR).
  • Updated IntegrationTestConfiguration to inject and wire LogCacheClient into DefaultCloudFoundryOperations.

Documentation (README.md)

  • Added a ## Deprecations section (with a [!WARNING] callout) right after ## Versions, covering:
    • the deprecated API surface (DopplerClient.recentLogs(), RecentLogsRequest, LogMessage),
    • platform version boundaries,
    • a before/after migration code example.
  • Added an inline [!NOTE] callout in the ### CloudFoundryClient, DopplerClient, UaaClient Builders section cross-linking to the new deprecation notice.

Migration guide

// Before (deprecated — only works on CFD < 24.3 / TAS < 4.0)
dopplerClient.recentLogs(RecentLogsRequest.builder()
    .applicationId(appId)
    .build());

// After
logCacheClient.recentLogs(ReadRequest.builder()
    .sourceId(appId)
    .build());

// Or via CloudFoundryOperations
cloudFoundryOperations.applications()
    .logsRecent(ReadRequest.builder()
        .sourceId(appId)
        .build());

Checklist

  • Existing unit tests updated and passing
  • New unit test added (logsRecentLogCache)
  • New integration test added (logsRecent)
  • Deprecated API annotated with @Deprecated + Javadoc @deprecated
  • README.md updated with deprecation notice and migration guide
  • Integration tests verified against a live CF foundation (requires CF Deployment ≥ 24.3 or TAS ≥ 4.0 for the Log Cache path)

Integrationtest results

@pivotal-david-osullivan
Copy link
Contributor

Thank you for the PR!

Compilation is currently failing on the implementation missing the new recentLogs method that you added to the client

@ZPascal
Copy link
Author

ZPascal commented Nov 1, 2024

Thank you @pivotal-david-osullivan & @anthonydahanne for fixing the tests and the reactor part. I am also working on the issue again from the SAP side and I plan to set up a BBL environment to test the change in a CF environment. Let's sync on Slack how we can handle it together and we can discuss the test setup/steps.

@anthonydahanne
Copy link
Contributor

Thank you @pivotal-david-osullivan & @anthonydahanne for fixing the tests and the reactor part. I am also working on the issue again from the SAP side and I plan to set up a BBL environment to test the change in a CF environment. Let's sync on Slack how we can handle it together and we can discuss the test setup/steps.

cool!
the current struggle is supporting recent , since there does not seem to be a Websocket or SSE endpoint for streaming logs; apparently the CLI polls, so we'd need to do just that.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 9, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Kehrlann added a commit to Kehrlann/cf-java-client that referenced this pull request Apr 9, 2025
- The DopplerClient does not work with Loggregator >= 107.0.0, and we
  cannot obtain "recent" logs. Until this is fixed, we cannot cut a
  release. That is the only blocking test.
- See cloudfoundrygh-1181, cloudfoundrygh-1230, cloudfoundrygh-1237
pivotal-david-osullivan pushed a commit that referenced this pull request Apr 11, 2025
…CF 2.x line (#1265)

* Restrict ApplicationsTests#logs to CF 2.x line

- The DopplerClient does not work with Loggregator >= 107.0.0, and we
  cannot obtain "recent" logs. Until this is fixed, we cannot cut a
  release. That is the only blocking test.
- See gh-1181, gh-1230, gh-1237

* Introduce Applications#logs API that will replace the doppler-based implementation

Signed-off-by: Daniel Garnier-Moiroux <daniel.garnier-moiroux@broadcom.com>

---------

Signed-off-by: Daniel Garnier-Moiroux <daniel.garnier-moiroux@broadcom.com>
@Kehrlann Kehrlann self-assigned this May 28, 2025
@Kehrlann Kehrlann added this to the 6.0.0 release milestone May 28, 2025
@ZPascal ZPascal force-pushed the issue-1181 branch 5 times, most recently from 1edaf8c to 210376c Compare February 26, 2026 16:11
ZPascal and others added 9 commits February 26, 2026 17:18
* because of the findFirst() on the envelopes, it could be type OUT or ERR, so we don't really care, as long as the payload is the same.
Also, we don't care about the precise argument to the recentLogs call
The old "Applications.logs" method is keept for
compatibility and when a log stream is needed.

Adding new "logsRecent" method to access the logCache.

integration-tests "ApplicationTest.logs" and
"ApplicationTest.logsRecent" work.

Minor changes in DefaultApplicationsTest in other JUnit tests
to make them execute in Eclipse.
@ZPascal ZPascal changed the title feat: Add RecentLogs support feat: Replace deprecated Doppler recentLogs with Log Cache client Mar 3, 2026
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.

recentLogs in DopplerClient does not work anymore since loggregator-release v107.0.0

6 participants