mirror of https://github.com/grpc/grpc-java.git
core: Update OpenCensus version to 0.17.0 (#4494)
This commit is contained in:
parent
4064123e0b
commit
09b13fecaa
|
@ -110,7 +110,7 @@ subprojects {
|
|||
protobufVersion = '3.5.1'
|
||||
protocVersion = '3.5.1-1'
|
||||
protobufNanoVersion = '3.0.0-alpha-5'
|
||||
opencensusVersion = '0.12.3'
|
||||
opencensusVersion = '0.17.0'
|
||||
|
||||
configureProtoCompilation = {
|
||||
String generatedSourcePath = "${projectDir}/src/generated"
|
||||
|
|
|
@ -36,7 +36,6 @@ import io.grpc.MethodDescriptor;
|
|||
import io.grpc.ServerStreamTracer;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.StreamTracer;
|
||||
import io.opencensus.contrib.grpc.metrics.RpcMeasureConstants;
|
||||
import io.opencensus.stats.MeasureMap;
|
||||
import io.opencensus.stats.Stats;
|
||||
import io.opencensus.stats.StatsRecorder;
|
||||
|
@ -325,13 +324,16 @@ public final class CensusStatsModule {
|
|||
boolean recordFinishedRpcs) {
|
||||
this.module = module;
|
||||
this.parentCtx = checkNotNull(parentCtx);
|
||||
TagValue methodTag = TagValue.create(fullMethodName);
|
||||
this.startCtx =
|
||||
module.tagger.toBuilder(parentCtx)
|
||||
.put(RpcMeasureConstants.RPC_METHOD, TagValue.create(fullMethodName)).build();
|
||||
.put(DeprecatedCensusConstants.RPC_METHOD, methodTag)
|
||||
.build();
|
||||
this.stopwatch = module.stopwatchSupplier.get().start();
|
||||
this.recordFinishedRpcs = recordFinishedRpcs;
|
||||
if (recordStartedRpcs) {
|
||||
module.statsRecorder.newMeasureMap().put(RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT, 1)
|
||||
module.statsRecorder.newMeasureMap()
|
||||
.put(DeprecatedCensusConstants.RPC_CLIENT_STARTED_COUNT, 1)
|
||||
.record(startCtx);
|
||||
}
|
||||
}
|
||||
|
@ -387,27 +389,31 @@ public final class CensusStatsModule {
|
|||
tracer = BLANK_CLIENT_TRACER;
|
||||
}
|
||||
MeasureMap measureMap = module.statsRecorder.newMeasureMap()
|
||||
.put(RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT, 1)
|
||||
// TODO(songya): remove the deprecated measure constants once they are completed removed.
|
||||
.put(DeprecatedCensusConstants.RPC_CLIENT_FINISHED_COUNT, 1)
|
||||
// The latency is double value
|
||||
.put(RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY, roundtripNanos / NANOS_PER_MILLI)
|
||||
.put(RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT, tracer.outboundMessageCount)
|
||||
.put(RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT, tracer.inboundMessageCount)
|
||||
.put(RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES, tracer.outboundWireSize)
|
||||
.put(RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES, tracer.inboundWireSize)
|
||||
.put(
|
||||
RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
|
||||
DeprecatedCensusConstants.RPC_CLIENT_ROUNDTRIP_LATENCY,
|
||||
roundtripNanos / NANOS_PER_MILLI)
|
||||
.put(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_COUNT, tracer.outboundMessageCount)
|
||||
.put(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_COUNT, tracer.inboundMessageCount)
|
||||
.put(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_BYTES, tracer.outboundWireSize)
|
||||
.put(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_BYTES, tracer.inboundWireSize)
|
||||
.put(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
|
||||
tracer.outboundUncompressedSize)
|
||||
.put(
|
||||
RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
|
||||
tracer.inboundUncompressedSize);
|
||||
if (!status.isOk()) {
|
||||
measureMap.put(RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT, 1);
|
||||
measureMap.put(DeprecatedCensusConstants.RPC_CLIENT_ERROR_COUNT, 1);
|
||||
}
|
||||
TagValue statusTag = TagValue.create(status.getCode().toString());
|
||||
measureMap.record(
|
||||
module
|
||||
.tagger
|
||||
.toBuilder(startCtx)
|
||||
.put(RpcMeasureConstants.RPC_STATUS, TagValue.create(status.getCode().toString()))
|
||||
.put(DeprecatedCensusConstants.RPC_STATUS, statusTag)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +504,8 @@ public final class CensusStatsModule {
|
|||
this.tagger = tagger;
|
||||
this.recordFinishedRpcs = recordFinishedRpcs;
|
||||
if (recordStartedRpcs) {
|
||||
module.statsRecorder.newMeasureMap().put(RpcMeasureConstants.RPC_SERVER_STARTED_COUNT, 1)
|
||||
module.statsRecorder.newMeasureMap()
|
||||
.put(DeprecatedCensusConstants.RPC_SERVER_STARTED_COUNT, 1)
|
||||
.record(parentCtx);
|
||||
}
|
||||
}
|
||||
|
@ -587,23 +594,31 @@ public final class CensusStatsModule {
|
|||
stopwatch.stop();
|
||||
long elapsedTimeNanos = stopwatch.elapsed(TimeUnit.NANOSECONDS);
|
||||
MeasureMap measureMap = module.statsRecorder.newMeasureMap()
|
||||
.put(RpcMeasureConstants.RPC_SERVER_FINISHED_COUNT, 1)
|
||||
// TODO(songya): remove the deprecated measure constants once they are completed removed.
|
||||
.put(DeprecatedCensusConstants.RPC_SERVER_FINISHED_COUNT, 1)
|
||||
// The latency is double value
|
||||
.put(RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY, elapsedTimeNanos / NANOS_PER_MILLI)
|
||||
.put(RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT, outboundMessageCount)
|
||||
.put(RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT, inboundMessageCount)
|
||||
.put(RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES, outboundWireSize)
|
||||
.put(RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES, inboundWireSize)
|
||||
.put(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES, outboundUncompressedSize)
|
||||
.put(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES, inboundUncompressedSize);
|
||||
.put(
|
||||
DeprecatedCensusConstants.RPC_SERVER_SERVER_LATENCY,
|
||||
elapsedTimeNanos / NANOS_PER_MILLI)
|
||||
.put(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_COUNT, outboundMessageCount)
|
||||
.put(DeprecatedCensusConstants.RPC_SERVER_REQUEST_COUNT, inboundMessageCount)
|
||||
.put(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_BYTES, outboundWireSize)
|
||||
.put(DeprecatedCensusConstants.RPC_SERVER_REQUEST_BYTES, inboundWireSize)
|
||||
.put(
|
||||
DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES,
|
||||
outboundUncompressedSize)
|
||||
.put(
|
||||
DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES,
|
||||
inboundUncompressedSize);
|
||||
if (!status.isOk()) {
|
||||
measureMap.put(RpcMeasureConstants.RPC_SERVER_ERROR_COUNT, 1);
|
||||
measureMap.put(DeprecatedCensusConstants.RPC_SERVER_ERROR_COUNT, 1);
|
||||
}
|
||||
TagValue statusTag = TagValue.create(status.getCode().toString());
|
||||
measureMap.record(
|
||||
module
|
||||
.tagger
|
||||
.toBuilder(parentCtx)
|
||||
.put(RpcMeasureConstants.RPC_STATUS, TagValue.create(status.getCode().toString()))
|
||||
.put(DeprecatedCensusConstants.RPC_STATUS, statusTag)
|
||||
.build());
|
||||
}
|
||||
|
||||
|
@ -632,10 +647,11 @@ public final class CensusStatsModule {
|
|||
if (parentCtx == null) {
|
||||
parentCtx = tagger.empty();
|
||||
}
|
||||
TagValue methodTag = TagValue.create(fullMethodName);
|
||||
parentCtx =
|
||||
tagger
|
||||
.toBuilder(parentCtx)
|
||||
.put(RpcMeasureConstants.RPC_METHOD, TagValue.create(fullMethodName))
|
||||
.put(DeprecatedCensusConstants.RPC_METHOD, methodTag)
|
||||
.build();
|
||||
return new ServerTracer(
|
||||
CensusStatsModule.this,
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright 2018 The gRPC 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 io.grpc.internal;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import io.opencensus.contrib.grpc.metrics.RpcMeasureConstants;
|
||||
import io.opencensus.stats.Measure.MeasureDouble;
|
||||
import io.opencensus.stats.Measure.MeasureLong;
|
||||
import io.opencensus.tags.TagKey;
|
||||
|
||||
/** Holder class for the deprecated OpenCensus constants. */
|
||||
@SuppressWarnings("deprecation")
|
||||
@VisibleForTesting
|
||||
public final class DeprecatedCensusConstants {
|
||||
|
||||
public static final TagKey RPC_STATUS = RpcMeasureConstants.RPC_STATUS;
|
||||
public static final TagKey RPC_METHOD = RpcMeasureConstants.RPC_METHOD;
|
||||
|
||||
public static final MeasureLong RPC_CLIENT_ERROR_COUNT =
|
||||
RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT;
|
||||
public static final MeasureDouble RPC_CLIENT_REQUEST_BYTES =
|
||||
RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES;
|
||||
public static final MeasureDouble RPC_CLIENT_RESPONSE_BYTES =
|
||||
RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES;
|
||||
public static final MeasureDouble RPC_CLIENT_ROUNDTRIP_LATENCY =
|
||||
RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY;
|
||||
public static final MeasureDouble RPC_CLIENT_SERVER_ELAPSED_TIME =
|
||||
RpcMeasureConstants.RPC_CLIENT_SERVER_ELAPSED_TIME;
|
||||
public static final MeasureDouble RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES =
|
||||
RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES;
|
||||
public static final MeasureDouble RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES =
|
||||
RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES;
|
||||
public static final MeasureLong RPC_CLIENT_STARTED_COUNT =
|
||||
RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT;
|
||||
public static final MeasureLong RPC_CLIENT_FINISHED_COUNT =
|
||||
RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT;
|
||||
public static final MeasureLong RPC_CLIENT_REQUEST_COUNT =
|
||||
RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT;
|
||||
public static final MeasureLong RPC_CLIENT_RESPONSE_COUNT =
|
||||
RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT;
|
||||
|
||||
public static final MeasureLong RPC_SERVER_ERROR_COUNT =
|
||||
RpcMeasureConstants.RPC_SERVER_ERROR_COUNT;
|
||||
public static final MeasureDouble RPC_SERVER_REQUEST_BYTES =
|
||||
RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES;
|
||||
public static final MeasureDouble RPC_SERVER_RESPONSE_BYTES =
|
||||
RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES;
|
||||
public static final MeasureDouble RPC_SERVER_SERVER_ELAPSED_TIME =
|
||||
RpcMeasureConstants.RPC_SERVER_SERVER_ELAPSED_TIME;
|
||||
public static final MeasureDouble RPC_SERVER_SERVER_LATENCY =
|
||||
RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY;
|
||||
public static final MeasureDouble RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES =
|
||||
RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES;
|
||||
public static final MeasureDouble RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES =
|
||||
RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES;
|
||||
public static final MeasureLong RPC_SERVER_STARTED_COUNT =
|
||||
RpcMeasureConstants.RPC_SERVER_STARTED_COUNT;
|
||||
public static final MeasureLong RPC_SERVER_FINISHED_COUNT =
|
||||
RpcMeasureConstants.RPC_SERVER_FINISHED_COUNT;
|
||||
public static final MeasureLong RPC_SERVER_REQUEST_COUNT =
|
||||
RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT;
|
||||
public static final MeasureLong RPC_SERVER_RESPONSE_COUNT =
|
||||
RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT;
|
||||
|
||||
private DeprecatedCensusConstants() {}
|
||||
}
|
|
@ -63,7 +63,6 @@ import io.grpc.internal.testing.StatsTestUtils.FakeTagContextBinarySerializer;
|
|||
import io.grpc.internal.testing.StatsTestUtils.FakeTagger;
|
||||
import io.grpc.internal.testing.StatsTestUtils.MockableSpan;
|
||||
import io.grpc.testing.GrpcServerRule;
|
||||
import io.opencensus.contrib.grpc.metrics.RpcMeasureConstants;
|
||||
import io.opencensus.tags.TagContext;
|
||||
import io.opencensus.tags.TagValue;
|
||||
import io.opencensus.trace.BlankSpan;
|
||||
|
@ -279,8 +278,8 @@ public class CensusModulesTest {
|
|||
|
||||
StatsTestUtils.MetricsRecord record = statsRecorder.pollRecord();
|
||||
assertNotNull(record);
|
||||
TagValue methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
TagValue methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
if (nonDefaultContext) {
|
||||
TagValue extraTag = record.tags.get(StatsTestUtils.EXTRA_TAG);
|
||||
assertEquals("extra value", extraTag.asString());
|
||||
|
@ -313,10 +312,10 @@ public class CensusModulesTest {
|
|||
// The intercepting listener calls callEnded() on ClientCallTracer, which records to Census.
|
||||
record = statsRecorder.pollRecord();
|
||||
assertNotNull(record);
|
||||
methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
TagValue statusTag = record.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.PERMISSION_DENIED.toString(), statusTag.asString());
|
||||
methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
TagValue statusTagOld = record.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.PERMISSION_DENIED.toString(), statusTagOld.asString());
|
||||
if (nonDefaultContext) {
|
||||
TagValue extraTag = record.tags.get(StatsTestUtils.EXTRA_TAG);
|
||||
assertEquals("extra value", extraTag.asString());
|
||||
|
@ -365,9 +364,10 @@ public class CensusModulesTest {
|
|||
assertNotNull(record);
|
||||
assertNoServerContent(record);
|
||||
assertEquals(1, record.tags.size());
|
||||
TagValue methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT));
|
||||
TagValue methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
assertEquals(
|
||||
1, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_STARTED_COUNT));
|
||||
} else {
|
||||
assertNull(statsRecorder.pollRecord());
|
||||
}
|
||||
|
@ -399,25 +399,33 @@ public class CensusModulesTest {
|
|||
StatsTestUtils.MetricsRecord record = statsRecorder.pollRecord();
|
||||
assertNotNull(record);
|
||||
assertNoServerContent(record);
|
||||
TagValue methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
TagValue statusTag = record.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.OK.toString(), statusTag.asString());
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
assertEquals(2, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
TagValue methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
TagValue statusTagOld = record.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.OK.toString(), statusTagOld.asString());
|
||||
assertEquals(
|
||||
1028 + 99, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
1, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_FINISHED_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
assertEquals(
|
||||
2, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
assertEquals(
|
||||
1028 + 99,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertEquals(
|
||||
1128 + 865,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(2, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(
|
||||
33 + 154, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertEquals(67 + 552,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
2, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
assertEquals(
|
||||
33 + 154,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertEquals(
|
||||
67 + 552,
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertEquals(30 + 100 + 16 + 24,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
} else {
|
||||
assertNull(statsRecorder.pollRecord());
|
||||
}
|
||||
|
@ -493,31 +501,45 @@ public class CensusModulesTest {
|
|||
assertNotNull(record);
|
||||
assertNoServerContent(record);
|
||||
assertEquals(1, record.tags.size());
|
||||
TagValue methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT));
|
||||
TagValue methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
assertEquals(
|
||||
1,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_STARTED_COUNT));
|
||||
|
||||
// Completion record
|
||||
record = statsRecorder.pollRecord();
|
||||
assertNotNull(record);
|
||||
assertNoServerContent(record);
|
||||
methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
TagValue statusTag = record.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.DEADLINE_EXCEEDED.toString(), statusTag.asString());
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT));
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
assertEquals(0, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
assertEquals(0, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertEquals(0,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(0, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
assertEquals(0, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertEquals(0,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
TagValue statusTagOld = record.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.DEADLINE_EXCEEDED.toString(), statusTagOld.asString());
|
||||
assertEquals(
|
||||
3000, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_SERVER_ELAPSED_TIME));
|
||||
1,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_FINISHED_COUNT));
|
||||
assertEquals(
|
||||
1,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
assertEquals(
|
||||
0, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
assertEquals(
|
||||
0, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertEquals(
|
||||
0,
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(
|
||||
0, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
assertEquals(
|
||||
0, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertEquals(0,
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertEquals(
|
||||
3000,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_SERVER_ELAPSED_TIME));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -583,8 +605,8 @@ public class CensusModulesTest {
|
|||
assertNotNull(clientRecord);
|
||||
assertNoServerContent(clientRecord);
|
||||
assertEquals(2, clientRecord.tags.size());
|
||||
TagValue clientMethodTag = clientRecord.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), clientMethodTag.asString());
|
||||
TagValue clientMethodTagOld = clientRecord.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), clientMethodTagOld.asString());
|
||||
TagValue clientPropagatedTag = clientRecord.tags.get(StatsTestUtils.EXTRA_TAG);
|
||||
assertEquals("extra-tag-value-897", clientPropagatedTag.asString());
|
||||
}
|
||||
|
@ -604,9 +626,11 @@ public class CensusModulesTest {
|
|||
Context serverContext = serverTracer.filterContext(Context.ROOT);
|
||||
// It also put clientCtx in the Context seen by the call handler
|
||||
assertEquals(
|
||||
tagger.toBuilder(clientCtx).put(
|
||||
RpcMeasureConstants.RPC_METHOD,
|
||||
TagValue.create(method.getFullMethodName())).build(),
|
||||
tagger.toBuilder(clientCtx)
|
||||
.put(
|
||||
DeprecatedCensusConstants.RPC_METHOD,
|
||||
TagValue.create(method.getFullMethodName()))
|
||||
.build(),
|
||||
TAG_CONTEXT_KEY.get(serverContext));
|
||||
|
||||
// Verifies that the server tracer records the status with the propagated tag
|
||||
|
@ -618,8 +642,8 @@ public class CensusModulesTest {
|
|||
assertNotNull(serverRecord);
|
||||
assertNoClientContent(serverRecord);
|
||||
assertEquals(2, serverRecord.tags.size());
|
||||
TagValue serverMethodTag = serverRecord.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), serverMethodTag.asString());
|
||||
TagValue serverMethodTagOld = serverRecord.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), serverMethodTagOld.asString());
|
||||
TagValue serverPropagatedTag = serverRecord.tags.get(StatsTestUtils.EXTRA_TAG);
|
||||
assertEquals("extra-tag-value-897", serverPropagatedTag.asString());
|
||||
|
||||
|
@ -627,11 +651,11 @@ public class CensusModulesTest {
|
|||
serverRecord = statsRecorder.pollRecord();
|
||||
assertNotNull(serverRecord);
|
||||
assertNoClientContent(serverRecord);
|
||||
serverMethodTag = serverRecord.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), serverMethodTag.asString());
|
||||
TagValue serverStatusTag = serverRecord.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.OK.toString(), serverStatusTag.asString());
|
||||
assertNull(serverRecord.getMetric(RpcMeasureConstants.RPC_SERVER_ERROR_COUNT));
|
||||
serverMethodTagOld = serverRecord.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), serverMethodTagOld.asString());
|
||||
TagValue serverStatusTagOld = serverRecord.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.OK.toString(), serverStatusTagOld.asString());
|
||||
assertNull(serverRecord.getMetric(DeprecatedCensusConstants.RPC_SERVER_ERROR_COUNT));
|
||||
serverPropagatedTag = serverRecord.tags.get(StatsTestUtils.EXTRA_TAG);
|
||||
assertEquals("extra-tag-value-897", serverPropagatedTag.asString());
|
||||
}
|
||||
|
@ -645,11 +669,11 @@ public class CensusModulesTest {
|
|||
StatsTestUtils.MetricsRecord clientRecord = statsRecorder.pollRecord();
|
||||
assertNotNull(clientRecord);
|
||||
assertNoServerContent(clientRecord);
|
||||
TagValue clientMethodTag = clientRecord.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), clientMethodTag.asString());
|
||||
TagValue clientStatusTag = clientRecord.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.OK.toString(), clientStatusTag.asString());
|
||||
assertNull(clientRecord.getMetric(RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
TagValue clientMethodTagOld = clientRecord.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), clientMethodTagOld.asString());
|
||||
TagValue clientStatusTagOld = clientRecord.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.OK.toString(), clientStatusTagOld.asString());
|
||||
assertNull(clientRecord.getMetric(DeprecatedCensusConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
TagValue clientPropagatedTag = clientRecord.tags.get(StatsTestUtils.EXTRA_TAG);
|
||||
assertEquals("extra-tag-value-897", clientPropagatedTag.asString());
|
||||
}
|
||||
|
@ -814,9 +838,11 @@ public class CensusModulesTest {
|
|||
assertNotNull(record);
|
||||
assertNoClientContent(record);
|
||||
assertEquals(1, record.tags.size());
|
||||
TagValue methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_STARTED_COUNT));
|
||||
TagValue methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
assertEquals(
|
||||
1,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_STARTED_COUNT));
|
||||
} else {
|
||||
assertNull(statsRecorder.pollRecord());
|
||||
}
|
||||
|
@ -827,7 +853,7 @@ public class CensusModulesTest {
|
|||
tagger
|
||||
.emptyBuilder()
|
||||
.put(
|
||||
RpcMeasureConstants.RPC_METHOD,
|
||||
DeprecatedCensusConstants.RPC_METHOD,
|
||||
TagValue.create(method.getFullMethodName()))
|
||||
.build(),
|
||||
statsCtx);
|
||||
|
@ -857,25 +883,33 @@ public class CensusModulesTest {
|
|||
StatsTestUtils.MetricsRecord record = statsRecorder.pollRecord();
|
||||
assertNotNull(record);
|
||||
assertNoClientContent(record);
|
||||
TagValue methodTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTag.asString());
|
||||
TagValue statusTag = record.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.CANCELLED.toString(), statusTag.asString());
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_FINISHED_COUNT));
|
||||
assertEquals(1, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_ERROR_COUNT));
|
||||
assertEquals(2, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT));
|
||||
TagValue methodTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertEquals(method.getFullMethodName(), methodTagOld.asString());
|
||||
TagValue statusTagOld = record.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertEquals(Status.Code.CANCELLED.toString(), statusTagOld.asString());
|
||||
assertEquals(
|
||||
1028 + 99, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES));
|
||||
1, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_FINISHED_COUNT));
|
||||
assertEquals(
|
||||
1, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_ERROR_COUNT));
|
||||
assertEquals(
|
||||
2, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_COUNT));
|
||||
assertEquals(
|
||||
1028 + 99,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_BYTES));
|
||||
assertEquals(
|
||||
1128 + 865,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertEquals(2, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertEquals(
|
||||
34 + 154, record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES));
|
||||
2, record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_REQUEST_COUNT));
|
||||
assertEquals(
|
||||
34 + 154,
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_REQUEST_BYTES));
|
||||
assertEquals(67 + 552,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(100 + 16 + 24,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY));
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_SERVER_LATENCY));
|
||||
} else {
|
||||
assertNull(statsRecorder.pollRecord());
|
||||
}
|
||||
|
@ -995,26 +1029,26 @@ public class CensusModulesTest {
|
|||
}
|
||||
|
||||
private static void assertNoServerContent(StatsTestUtils.MetricsRecord record) {
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_ERROR_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_SERVER_ELAPSED_TIME));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_ERROR_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_REQUEST_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_SERVER_ELAPSED_TIME));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_SERVER_LATENCY));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
}
|
||||
|
||||
private static void assertNoClientContent(StatsTestUtils.MetricsRecord record) {
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_SERVER_ELAPSED_TIME));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_ERROR_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_SERVER_ELAPSED_TIME));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ import io.grpc.StatusRuntimeException;
|
|||
import io.grpc.auth.MoreCallCredentials;
|
||||
import io.grpc.internal.AbstractServerImplBuilder;
|
||||
import io.grpc.internal.CensusStatsModule;
|
||||
import io.grpc.internal.DeprecatedCensusConstants;
|
||||
import io.grpc.internal.GrpcUtil;
|
||||
import io.grpc.internal.testing.StatsTestUtils;
|
||||
import io.grpc.internal.testing.StatsTestUtils.FakeStatsRecorder;
|
||||
|
@ -92,7 +93,6 @@ import io.grpc.testing.integration.Messages.StreamingInputCallRequest;
|
|||
import io.grpc.testing.integration.Messages.StreamingInputCallResponse;
|
||||
import io.grpc.testing.integration.Messages.StreamingOutputCallRequest;
|
||||
import io.grpc.testing.integration.Messages.StreamingOutputCallResponse;
|
||||
import io.opencensus.contrib.grpc.metrics.RpcMeasureConstants;
|
||||
import io.opencensus.tags.TagKey;
|
||||
import io.opencensus.tags.TagValue;
|
||||
import io.opencensus.trace.Span;
|
||||
|
@ -1065,7 +1065,8 @@ public abstract class AbstractInteropTest {
|
|||
// Stream may not have been created before deadline is exceeded, thus we don't test the tracer
|
||||
// stats.
|
||||
MetricsRecord clientStartRecord = clientStatsRecorder.pollRecord(5, TimeUnit.SECONDS);
|
||||
checkStartTags(clientStartRecord, "grpc.testing.TestService/StreamingOutputCall");
|
||||
checkStartTags(
|
||||
clientStartRecord, "grpc.testing.TestService/StreamingOutputCall");
|
||||
MetricsRecord clientEndRecord = clientStatsRecorder.pollRecord(5, TimeUnit.SECONDS);
|
||||
checkEndTags(
|
||||
clientEndRecord,
|
||||
|
@ -1100,7 +1101,8 @@ public abstract class AbstractInteropTest {
|
|||
// Stream may not have been created when deadline is exceeded, thus we don't check tracer
|
||||
// stats.
|
||||
MetricsRecord clientStartRecord = clientStatsRecorder.pollRecord(5, TimeUnit.SECONDS);
|
||||
checkStartTags(clientStartRecord, "grpc.testing.TestService/StreamingOutputCall");
|
||||
checkStartTags(
|
||||
clientStartRecord, "grpc.testing.TestService/StreamingOutputCall");
|
||||
MetricsRecord clientEndRecord = clientStatsRecorder.pollRecord(5, TimeUnit.SECONDS);
|
||||
checkEndTags(
|
||||
clientEndRecord,
|
||||
|
@ -1920,20 +1922,20 @@ public abstract class AbstractInteropTest {
|
|||
|
||||
private static void checkStartTags(MetricsRecord record, String methodName) {
|
||||
assertNotNull("record is not null", record);
|
||||
TagValue methodNameTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertNotNull("method name tagged", methodNameTag);
|
||||
assertEquals("method names match", methodName, methodNameTag.asString());
|
||||
TagValue methodNameTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertNotNull("method name tagged", methodNameTagOld);
|
||||
assertEquals("method names match", methodName, methodNameTagOld.asString());
|
||||
}
|
||||
|
||||
private static void checkEndTags(
|
||||
MetricsRecord record, String methodName, Status.Code status) {
|
||||
assertNotNull("record is not null", record);
|
||||
TagValue methodNameTag = record.tags.get(RpcMeasureConstants.RPC_METHOD);
|
||||
assertNotNull("method name tagged", methodNameTag);
|
||||
assertEquals("method names match", methodName, methodNameTag.asString());
|
||||
TagValue statusTag = record.tags.get(RpcMeasureConstants.RPC_STATUS);
|
||||
assertNotNull("status tagged", statusTag);
|
||||
assertEquals(status.toString(), statusTag.asString());
|
||||
TagValue methodNameTagOld = record.tags.get(DeprecatedCensusConstants.RPC_METHOD);
|
||||
assertNotNull("method name tagged", methodNameTagOld);
|
||||
assertEquals("method names match", methodName, methodNameTagOld.asString());
|
||||
TagValue statusTagOld = record.tags.get(DeprecatedCensusConstants.RPC_STATUS);
|
||||
assertNotNull("status tagged", statusTagOld);
|
||||
assertEquals(status.toString(), statusTagOld.asString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1985,39 +1987,43 @@ public abstract class AbstractInteropTest {
|
|||
if (isServer) {
|
||||
assertEquals(
|
||||
requests.size(),
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT));
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_REQUEST_COUNT));
|
||||
assertEquals(
|
||||
responses.size(),
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT));
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_COUNT));
|
||||
assertEquals(
|
||||
uncompressedRequestsSize,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(
|
||||
uncompressedResponsesSize,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertNotNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertNotNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_SERVER_LATENCY));
|
||||
// It's impossible to get the expected wire sizes because it may be compressed, so we just
|
||||
// check if they are recorded.
|
||||
assertNotNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES));
|
||||
assertNotNull(record.getMetric(RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES));
|
||||
assertNotNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_REQUEST_BYTES));
|
||||
assertNotNull(record.getMetric(DeprecatedCensusConstants.RPC_SERVER_RESPONSE_BYTES));
|
||||
} else {
|
||||
assertEquals(
|
||||
requests.size(),
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_COUNT));
|
||||
assertEquals(
|
||||
responses.size(),
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
record.getMetricAsLongOrFail(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_COUNT));
|
||||
assertEquals(
|
||||
uncompressedRequestsSize,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES));
|
||||
assertEquals(
|
||||
uncompressedResponsesSize,
|
||||
record.getMetricAsLongOrFail(RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertNotNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
record.getMetricAsLongOrFail(
|
||||
DeprecatedCensusConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES));
|
||||
assertNotNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_ROUNDTRIP_LATENCY));
|
||||
// It's impossible to get the expected wire sizes because it may be compressed, so we just
|
||||
// check if they are recorded.
|
||||
assertNotNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertNotNull(record.getMetric(RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
assertNotNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_REQUEST_BYTES));
|
||||
assertNotNull(record.getMetric(DeprecatedCensusConstants.RPC_CLIENT_RESPONSE_BYTES));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -292,15 +292,15 @@ def io_netty_transport():
|
|||
def io_opencensus_api():
|
||||
native.maven_jar(
|
||||
name = "io_opencensus_opencensus_api",
|
||||
artifact = "io.opencensus:opencensus-api:0.12.3",
|
||||
sha1 = "743f074095f29aa985517299545e72cc99c87de0",
|
||||
artifact = "io.opencensus:opencensus-api:0.17.0",
|
||||
sha1 = "0b9c91321f9c9f20f3a4627bfd9e3097164f85e6",
|
||||
)
|
||||
|
||||
def io_opencensus_grpc_metrics():
|
||||
native.maven_jar(
|
||||
name = "io_opencensus_opencensus_contrib_grpc_metrics",
|
||||
artifact = "io.opencensus:opencensus-contrib-grpc-metrics:0.12.3",
|
||||
sha1 = "a4c7ff238a91b901c8b459889b6d0d7a9d889b4d",
|
||||
artifact = "io.opencensus:opencensus-contrib-grpc-metrics:0.17.0",
|
||||
sha1 = "4b82972073361704f57fa2107910242f1143df25",
|
||||
)
|
||||
|
||||
def javax_annotation():
|
||||
|
|
|
@ -328,6 +328,7 @@ public class StatsTestUtils {
|
|||
/**
|
||||
* Creates a MockableSpan with a random trace ID and span ID.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static MockableSpan generateRandomSpan(Random random) {
|
||||
return new MockableSpan(
|
||||
SpanContext.create(
|
||||
|
|
Loading…
Reference in New Issue