Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ The `cf-java-client` project is a Java language binding for interacting with a C
* `cloudfoundry-operations` – An API and implementation that corresponds to the [Cloud Foundry CLI][c] operations. This project builds on the `cloudfoundry-client` and therefore has a single implementation.

## Versions
The Cloud Foundry Java Client has two active versions. The `5.x` line is compatible with Spring Boot `2.4.x - 2.6.x` just to manage its dependencies, while the `4.x` line uses Spring Boot `2.3.x`.
The Cloud Foundry Java Client has two active versions. The `6.x` line includes breaking changes (see below), while the `5.x` line maintains backward compatibility.

## Deprecations
## Breaking Changes (6.x)

### `DopplerClient.recentLogs()` — Recent Logs via Doppler

> [!WARNING]
> **Deprecated since cf-java-client `5.17.x`**
> **Removed since cf-java-client `6.0.x`**
>
> The `DopplerClient.recentLogs()` endpoint (and the related `RecentLogsRequest` / `LogMessage` types from the `org.cloudfoundry.doppler` package) are **deprecated** and will be removed in a future release.
> The `DopplerClient.recentLogs()` endpoint (and the related `RecentLogsRequest` / `LogMessage` types from the `org.cloudfoundry.doppler` package) have been **removed**.
>
> This API relies on the [Loggregator][loggregator] Doppler/Traffic Controller endpoint `/apps/{id}/recentlogs`, which was removed in **Loggregator ≥ 107.0**.
> This API relied on the [Loggregator][loggregator] Doppler/Traffic Controller endpoint `/apps/{id}/recentlogs`, which was removed in **Loggregator ≥ 107.0**.
> The affected platform versions are:
>
> | Platform | Last version with Doppler recent-logs support |
Expand Down Expand Up @@ -61,11 +61,16 @@ The Cloud Foundry Java Client has two active versions. The `5.x` line is compati
>
> See the [`org.cloudfoundry.doppler`][doppler-pkg] and [`org.cloudfoundry.logcache.v1`][logcache-pkg] Javadoc for full type details.

[doppler-pkg]: https://javadoc.io/doc/org.cloudfoundry/cloudfoundry-client/latest/org/cloudfoundry/doppler/package-summary.html
[logcache-pkg]: https://javadoc.io/doc/org.cloudfoundry/cloudfoundry-client/latest/org/cloudfoundry/logcache/v1/package-summary.html

> [!NOTE]
> **Operations API users:** `Applications.logs(ApplicationLogsRequest)` now uses Log Cache under the hood for recent logs (the default). No migration is needed at the Operations layer.
> **Operations API users:** Use `Applications.logs(ApplicationLogsRequest)` instead of the removed `Applications.logs(LogsRequest)`.

### `Applications.logs(LogsRequest)` — Removed

> [!WARNING]
> **Removed since cf-java-client `6.0.x`**
> The `Applications.logs(LogsRequest)` method (and the `LogsRequest` type) have been **removed**.
>
> **Migration:** Use `Applications.logs(ApplicationLogsRequest)` instead. For recent logs, set `recent(true)` (the default). For streaming, set `recent(false)`.

[loggregator]: https://github.com/cloudfoundry/loggregator
[log-cache-api]: https://github.com/cloudfoundry/log-cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.cloudfoundry.doppler.ContainerMetricsRequest;
import org.cloudfoundry.doppler.Envelope;
import org.cloudfoundry.doppler.FirehoseRequest;
import org.cloudfoundry.doppler.RecentLogsRequest;
import org.cloudfoundry.doppler.StreamRequest;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
Expand Down Expand Up @@ -57,17 +56,6 @@ Flux<Envelope> firehose(FirehoseRequest request) {
.checkpoint();
}

Flux<Envelope> recentLogs(RecentLogsRequest request) {
return get(
builder ->
builder.pathSegment(
"apps", request.getApplicationId(), "recentlogs"),
MultipartCodec::createDecoder,
MultipartCodec::decode)
.map(ReactorDopplerEndpoints::toEnvelope)
.checkpoint();
}

Flux<Envelope> stream(StreamRequest request) {
return ws(builder -> builder.pathSegment("apps", request.getApplicationId(), "stream"))
.map(ReactorDopplerEndpoints::toEnvelope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.cloudfoundry.doppler.DopplerClient;
import org.cloudfoundry.doppler.Envelope;
import org.cloudfoundry.doppler.FirehoseRequest;
import org.cloudfoundry.doppler.RecentLogsRequest;
import org.cloudfoundry.doppler.StreamRequest;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
Expand All @@ -47,11 +46,6 @@ public Flux<Envelope> firehose(FirehoseRequest request) {
return getDopplerEndpoints().firehose(request);
}

@Override
public Flux<Envelope> recentLogs(RecentLogsRequest request) {
return getDopplerEndpoints().recentLogs(request);
}

@Override
public Flux<Envelope> stream(StreamRequest request) {
return getDopplerEndpoints().stream(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
import org.cloudfoundry.doppler.ContainerMetricsRequest;
import org.cloudfoundry.doppler.Envelope;
import org.cloudfoundry.doppler.EventType;
import org.cloudfoundry.doppler.LogMessage;
import org.cloudfoundry.doppler.MessageType;
import org.cloudfoundry.doppler.RecentLogsRequest;
import org.cloudfoundry.reactor.InteractionContext;
import org.cloudfoundry.reactor.TestRequest;
import org.cloudfoundry.reactor.TestResponse;
Expand Down Expand Up @@ -137,108 +134,4 @@ void containerMetricsLarge() {
.expectComplete()
.verify(Duration.ofSeconds(5));
}

@Test
void recentLogs() {
mockRequest(
InteractionContext.builder()
.request(
TestRequest.builder()
.method(GET)
.path("/apps/test-application-id/recentlogs")
.build())
.response(
TestResponse.builder()
.status(OK)
.contentType(
"multipart/x-protobuf;"
+ " boundary=92d42123ec83c0af6a27ba0de34528b702a53e2e67ba99636286b6a4cafb")
.payload(
"fixtures/doppler/apps/GET_{id}_recentlogs_response.bin")
.build())
.build());

this.dopplerEndpoints
.recentLogs(
RecentLogsRequest.builder().applicationId("test-application-id").build())
.as(StepVerifier::create)
.expectNext(
Envelope.builder()
.deployment("cf-cfapps-io2-diego")
.eventType(EventType.LOG_MESSAGE)
.index("33")
.ip("10.10.115.68")
.job("cell_z2")
.logMessage(
LogMessage.builder()
.applicationId(
"1a95eadc-95c6-4675-aa07-8c02f80ea8a4")
.message(
"2016-04-21 22:36:28.035 INFO 24 --- [ "
+ " main]"
+ " o.s.j.e.a.AnnotationMBeanExporter "
+ " : Located managed bean"
+ " 'rabbitConnectionFactory':"
+ " registering with JMX server as"
+ " MBean"
+ " [org.springframework.amqp.rabbit.connection:name=rabbitConnectionFactory,type=CachingConnectionFactory]")
.messageType(MessageType.OUT)
.sourceInstance("0")
.sourceType("APP")
.timestamp(1461278188035928339L)
.build())
.origin("rep")
.timestamp(1461278188035930425L)
.build(),
Envelope.builder()
.deployment("cf-cfapps-io2-diego")
.eventType(EventType.LOG_MESSAGE)
.index("33")
.ip("10.10.115.68")
.job("cell_z2")
.logMessage(
LogMessage.builder()
.applicationId(
"1a95eadc-95c6-4675-aa07-8c02f80ea8a4")
.message("Container became healthy")
.messageType(MessageType.OUT)
.sourceInstance("0")
.sourceType("CELL")
.timestamp(1461278188715651492L)
.build())
.origin("rep")
.timestamp(1461278188715653514L)
.build())
.expectComplete()
.verify(Duration.ofSeconds(5));
}

@Test
void recentLogsLarge() {
mockRequest(
InteractionContext.builder()
.request(
TestRequest.builder()
.method(GET)
.path("/apps/test-application-id/recentlogs")
.build())
.response(
TestResponse.builder()
.status(OK)
.contentType(
"multipart/x-protobuf;"
+ " boundary=74684f6bed3ee99aa98a13c609c354cd849b01a6e6051226906140ad31b2")
.payload(
"fixtures/doppler/apps/GET_{id}_recentlogs_response-large.bin")
.build())
.build());

this.dopplerEndpoints
.recentLogs(
RecentLogsRequest.builder().applicationId("test-application-id").build())
.as(StepVerifier::create)
.expectNextCount(3093)
.expectComplete()
.verify(Duration.ofSeconds(5));
}
}
Loading
Loading