diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/EventType.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/EventType.java index e35d7d8077a..56526926a21 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/EventType.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/EventType.java @@ -29,12 +29,8 @@ public enum EventType { ERROR, - HTTP_START, - HTTP_START_STOP, - HTTP_STOP, - LOG_MESSAGE, VALUE_METRIC; @@ -47,12 +43,8 @@ static EventType from(org.cloudfoundry.dropsonde.events.Envelope.EventType drops return COUNTER_EVENT; case Error: return ERROR; - case HttpStart: - return HTTP_START; case HttpStartStop: return HTTP_START_STOP; - case HttpStop: - return HTTP_STOP; case LogMessage: return LOG_MESSAGE; case ValueMetric: diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_Envelope.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_Envelope.java index 1876a3023d2..06155f4630e 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_Envelope.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_Envelope.java @@ -45,9 +45,7 @@ public static Envelope from(org.cloudfoundry.dropsonde.events.Envelope dropsonde Optional.ofNullable(dropsonde.containerMetric).ifPresent(d -> envelope.containerMetric(ContainerMetric.from(d))); Optional.ofNullable(dropsonde.counterEvent).ifPresent(d -> envelope.counterEvent(CounterEvent.from(d))); Optional.ofNullable(dropsonde.error).ifPresent(d -> envelope.error(Error.from(d))); - Optional.ofNullable(dropsonde.httpStart).ifPresent(d -> envelope.httpStart(HttpStart.from(d))); Optional.ofNullable(dropsonde.httpStartStop).ifPresent(d -> envelope.httpStartStop(HttpStartStop.from(d))); - Optional.ofNullable(dropsonde.httpStop).ifPresent(d -> envelope.httpStop(HttpStop.from(d))); Optional.ofNullable(dropsonde.logMessage).ifPresent(d -> envelope.logMessage(LogMessage.from(d))); Optional.ofNullable(dropsonde.valueMetric).ifPresent(d -> envelope.valueMetric(ValueMetric.from(d))); @@ -83,24 +81,12 @@ public static Envelope from(org.cloudfoundry.dropsonde.events.Envelope dropsonde */ abstract EventType getEventType(); - /** - * The enclosed {@link HttpStart} - */ - @Nullable - abstract HttpStart getHttpStart(); - /** * The enclosed {@link HttpStartStop} */ @Nullable abstract HttpStartStop getHttpStartStop(); - /** - * The enclosed {@link HttpStop} - */ - @Nullable - abstract HttpStop getHttpStop(); - /** * Index of job (used to uniquely identify source) */ diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStart.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStart.java deleted file mode 100644 index db533bad3ae..00000000000 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStart.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.cloudfoundry.doppler; - -import org.cloudfoundry.Nullable; -import org.immutables.value.Value; - -import java.util.Objects; -import java.util.UUID; - -/** - * The event emitted when a client sends a request (or immediately when a server receives the request). - */ -@Value.Immutable -abstract class _HttpStart { - - public static HttpStart from(org.cloudfoundry.dropsonde.events.HttpStart dropsonde) { - Objects.requireNonNull(dropsonde, "dropsonde"); - - return HttpStart.builder() - .applicationId(UuidUtils.from(dropsonde.applicationId)) - .instanceId(dropsonde.instanceId) - .instanceIndex(dropsonde.instanceIndex) - .method(Method.from(dropsonde.method)) - .parentRequestId(UuidUtils.from(dropsonde.parentRequestId)) - .peerType(PeerType.from(dropsonde.peerType)) - .remoteAddress(dropsonde.remoteAddress) - .requestId(UuidUtils.from(dropsonde.requestId)) - .timestamp(dropsonde.timestamp) - .uri(dropsonde.uri) - .userAgent(dropsonde.userAgent) - .build(); - } - - /** - * The application id - */ - @Nullable - abstract UUID getApplicationId(); - - /** - * The ID of the application instance - */ - @Nullable - abstract String getInstanceId(); - - /** - * The index of the application instance - */ - @Nullable - abstract Integer getInstanceIndex(); - - /** - * The method of the request - */ - abstract Method getMethod(); - - /** - * The ID of the parent request of any request made to service an incoming request - */ - @Nullable - abstract UUID getParentRequestId(); - - /** - * The role of the emitting process in the request cycle - */ - abstract PeerType getPeerType(); - - /** - * The remote address of the request. (For a server, this should be the origin of the request.) - */ - abstract String getRemoteAddress(); - - /** - * The ID for tracking lifecycle of request. Should match requestId of a {@link HttpStop} event - */ - abstract UUID getRequestId(); - - /** - * The UNIX timestamp (in nanoseconds) when the request was sent (by a client) or received (by a server) - */ - abstract Long getTimestamp(); - - /** - * The uri of the request - */ - abstract String getUri(); - - /** - * The contents of the UserAgent header on the request - */ - abstract String getUserAgent(); - -} diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStartStop.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStartStop.java index c64fb13e95e..bbab10196b4 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStartStop.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStartStop.java @@ -94,7 +94,7 @@ public static HttpStartStop from(org.cloudfoundry.dropsonde.events.HttpStartStop abstract String getRemoteAddress(); /** - * The ID for tracking lifecycle of request. Should match requestId of a {@link HttpStop} event + * The ID for tracking lifecycle of request. */ abstract UUID getRequestId(); diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStop.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStop.java deleted file mode 100644 index ee1a87f7601..00000000000 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/doppler/_HttpStop.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.cloudfoundry.doppler; - -import org.cloudfoundry.Nullable; -import org.immutables.value.Value; - -import java.util.Objects; -import java.util.UUID; - -/** - * The event emitted when a client receives a response to its request (or when a server completes its handling and returns a response) - */ -@Value.Immutable -abstract class _HttpStop { - - public static HttpStop from(org.cloudfoundry.dropsonde.events.HttpStop dropsonde) { - Objects.requireNonNull(dropsonde, "dropsonde"); - - return HttpStop.builder() - .applicationId(UuidUtils.from(dropsonde.applicationId)) - .contentLength(dropsonde.contentLength) - .peerType(PeerType.from(dropsonde.peerType)) - .requestId(UuidUtils.from(dropsonde.requestId)) - .statusCode(dropsonde.statusCode) - .timestamp(dropsonde.timestamp) - .uri(dropsonde.uri) - .build(); - } - - /** - * The application id - */ - @Nullable - abstract UUID getApplicationId(); - - /** - * The length of the response in bytes - */ - abstract Long getContentLength(); - - /** - * The role of the emitting process in the request cycle - */ - abstract PeerType getPeerType(); - - /** - * The ID for tracking lifecycle of request. Should match requestId of a {@link HttpStop} event - */ - abstract UUID getRequestId(); - - /** - * The status code returned with the response to the request - */ - abstract Integer getStatusCode(); - - /** - * The UNIX timestamp (in nanoseconds) when the request was received - */ - abstract Long getTimestamp(); - - /** - * The uri of the request - */ - abstract String getUri(); - - -} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/doppler/HttpStartTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/doppler/HttpStartTest.java deleted file mode 100644 index e8af9fcd830..00000000000 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/doppler/HttpStartTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.cloudfoundry.doppler; - -import org.junit.Test; - -import java.util.UUID; - -public final class HttpStartTest { - - @Test - public void dropsonde() { - HttpStart.from(new org.cloudfoundry.dropsonde.events.HttpStart.Builder() - .method(org.cloudfoundry.dropsonde.events.Method.GET) - .peerType(org.cloudfoundry.dropsonde.events.PeerType.Client) - .remoteAddress("test-remote-address") - .requestId(new org.cloudfoundry.dropsonde.events.UUID.Builder() - .high(0L) - .low(0L) - .build()) - .timestamp(0L) - .uri("test-uri") - .userAgent("test-user-agent") - .build()); - } - - @Test(expected = IllegalStateException.class) - public void noMethod() { - HttpStart.builder() - .peerType(PeerType.CLIENT) - .remoteAddress("test-remote-address") - .requestId(UUID.randomUUID()) - .timestamp(0L) - .uri("test-uri") - .userAgent("test-user-agent") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noPeerType() { - HttpStart.builder() - .method(Method.GET) - .remoteAddress("test-remote-address") - .requestId(UUID.randomUUID()) - .timestamp(0L) - .uri("test-uri") - .userAgent("test-user-agent") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noRemoteAddress() { - HttpStart.builder() - .method(Method.GET) - .peerType(PeerType.CLIENT) - .requestId(UUID.randomUUID()) - .timestamp(0L) - .uri("test-uri") - .userAgent("test-user-agent") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noRequestId() { - HttpStart.builder() - .method(Method.GET) - .peerType(PeerType.CLIENT) - .remoteAddress("test-remote-address") - .timestamp(0L) - .uri("test-uri") - .userAgent("test-user-agent") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noTimestamp() { - HttpStart.builder() - .method(Method.GET) - .peerType(PeerType.CLIENT) - .remoteAddress("test-remote-address") - .requestId(UUID.randomUUID()) - .uri("test-uri") - .userAgent("test-user-agent") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noUri() { - HttpStart.builder() - .method(Method.GET) - .peerType(PeerType.CLIENT) - .remoteAddress("test-remote-address") - .requestId(UUID.randomUUID()) - .timestamp(0L) - .userAgent("test-user-agent") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noUserAgent() { - HttpStart.builder() - .method(Method.GET) - .peerType(PeerType.CLIENT) - .remoteAddress("test-remote-address") - .requestId(UUID.randomUUID()) - .timestamp(0L) - .uri("test-uri") - .build(); - } - - @Test - public void valid() { - HttpStart.builder() - .method(Method.GET) - .peerType(PeerType.CLIENT) - .remoteAddress("test-remote-address") - .requestId(UUID.randomUUID()) - .timestamp(0L) - .uri("test-uri") - .userAgent("test-user-agent") - .build(); - } - -} diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/doppler/HttpStopTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/doppler/HttpStopTest.java deleted file mode 100644 index 3971233ace4..00000000000 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/doppler/HttpStopTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.cloudfoundry.doppler; - -import org.junit.Test; - -import java.util.UUID; - -public final class HttpStopTest { - - @Test - public void dropsonde() { - HttpStop.from(new org.cloudfoundry.dropsonde.events.HttpStop.Builder() - .contentLength(0L) - .peerType(org.cloudfoundry.dropsonde.events.PeerType.Client) - .requestId(new org.cloudfoundry.dropsonde.events.UUID.Builder() - .high(0L) - .low(0L) - .build()) - .statusCode(0) - .timestamp(0L) - .uri("test-uri") - .build()); - } - - @Test(expected = IllegalStateException.class) - public void noContentLength() { - HttpStop.builder() - .peerType(PeerType.CLIENT) - .requestId(UUID.randomUUID()) - .statusCode(0) - .timestamp(0L) - .uri("test-uri") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noPeerType() { - HttpStop.builder() - .contentLength(0L) - .requestId(UUID.randomUUID()) - .statusCode(0) - .timestamp(0L) - .uri("test-uri") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noRequestId() { - HttpStop.builder() - .contentLength(0L) - .peerType(PeerType.CLIENT) - .statusCode(0) - .timestamp(0L) - .uri("test-uri") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noStatusCode() { - HttpStop.builder() - .contentLength(0L) - .peerType(PeerType.CLIENT) - .requestId(UUID.randomUUID()) - .timestamp(0L) - .uri("test-uri") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noTimestamp() { - HttpStop.builder() - .contentLength(0L) - .peerType(PeerType.CLIENT) - .requestId(UUID.randomUUID()) - .statusCode(0) - .uri("test-uri") - .build(); - } - - @Test(expected = IllegalStateException.class) - public void noUri() { - HttpStop.builder() - .contentLength(0L) - .peerType(PeerType.CLIENT) - .requestId(UUID.randomUUID()) - .statusCode(0) - .timestamp(0L) - .build(); - } - - @Test - public void valid() { - HttpStop.builder() - .contentLength(0L) - .peerType(PeerType.CLIENT) - .requestId(UUID.randomUUID()) - .statusCode(0) - .timestamp(0L) - .uri("test-uri") - .build(); - } - -} diff --git a/vendor/dropsonde-protocol b/vendor/dropsonde-protocol index e87740324b3..a49759cec1f 160000 --- a/vendor/dropsonde-protocol +++ b/vendor/dropsonde-protocol @@ -1 +1 @@ -Subproject commit e87740324b365ea9b514e7c396fa3f6615d45ca0 +Subproject commit a49759cec1f195f3749289239164919c0b99cd22