Commit Graph

275 Commits

Author SHA1 Message Date
Eric Anderson 6bab82eeb6 auth: Use async version of getRequestMetadata
This avoids using DelayedStream and a thread hop when the credentials
are known immediately.
2017-11-17 11:52:07 -08:00
Kun Zhang ca9a41a46e
core: record RPC upstarts to Census. (#3708)
RPC upstarts are counted into metrics
RPC_{CLIENT,SERVER}_STARTED_COUNT. In addition, RPC completions are
counted into metrics RPC_{CLIENT,SERVER}_FINISHED_COUNT.  From these
metrics, users will be able to derive count of RPCs that are currently
active.
2017-11-10 17:22:22 -08:00
sebright ef2ec94911 core: use new OpenCensus stats/tagging API. (#3647)
This commit updates gRPC core to use io.opencensus:opencensus-api and
io.opencensus:opencensus-contrib-grpc-metrics instead of
com.google.instrumentation:instrumentation-api for stats and tagging. The gRPC
Monitoring Service continues to use instrumentation-api.

The main changes affecting gRPC:

- The StatsContextFactory is replaced by three objects, StatsRecorder, Tagger,
  and TagContextBinarySerializer.

- The StatsRecorder, Tagger, and TagContextBinarySerializer are never null,
  but the objects are no-ops when the OpenCensus implementation is not
  available.

This commit includes changes written by @songy23 and @sebright.
2017-11-07 12:25:03 -08:00
Carl Mastrangelo 1bc7d76d3a
interop-testing: make max size tests more deterministic
This change removes some of the non deterministic size outputs for
proto.  Instead of serializing the message and measuring the size,
measure before serialization.  As long as the remote always returns
using the same encoder, this should be stable.
2017-11-06 12:34:10 -08:00
Eric Anderson f9f603570d Allow tests to run on IPv6-less machines
Our Travis-CI builds are failing with "Protocol family unavailable" due
to the usage of ::1. Although it's 2017 and we'd expect to have ipv6
_loopback_ anywhere that mattered, apparently that's not the case.

The tests now work equally well on IPv4-only and IPv6-only machines.
2017-11-02 13:32:34 -07:00
Kun Zhang d87ef74082
core: set sampled for local span per MethodDescriptor. (#3627)
This moves away from the global String-based Span name registry which
is not as flexible as we desire.

Also renamed the option name to be more accurate.  This is not
API-breaking because the origianl addition to MethodDescriptor and
code-gen didn't make it into the 1.7.0 release.
2017-11-01 16:46:05 -07:00
ZHANG Dapeng 8a9660c700
testing: move TestUtils.recordServerCallInterceptor internal 2017-11-01 09:37:42 -07:00
ZHANG Dapeng d6ff4c259f
testing: move io.grpc.testing.StreamRecorder to internal 2017-11-01 09:37:22 -07:00
Carl Mastrangelo 87c8791983
compiler: remove references to static fields 2017-10-31 15:24:48 -07:00
Carl Mastrangelo 30b59885b7
compiler: add methods for accessing method descriptors
* MethodDescriptor is lazy loaded, so protobuf loading only happens on demand.  This also means tracing registration happens  on demand.
* The names of the getters all being with `method`.  This makes it harder for autocomplete to pick them up.
* A new field is used, which matches the getter name.  Rather than make the new-getters reference the old-fields, make the old-fields reference the new getters.  This makes removal of the old-fields a simple operation.
* The getters may not be inlineable, but thats an easy fix if it ends up being a problem.  Not worth premature optimization (but is worth future work).

The expected timeline for this is adding this to the 1.8 cut, and deprecating the old-fields.  They will be removed in 1.9.
2017-10-30 10:30:34 -07:00
ZHANG Dapeng 7a4aa47070 core: remove unnecessary type params in ServerStreamTracer 2017-10-26 12:05:41 -07:00
Kun Zhang 9c817e5bb0 interop-test: disable message size check in interop-test client. (#3569)
The check fails in Java-Go interop test because of
grpc/grpc-go#1572

This is also needed for the internal gRPC-GFE test.

Resolves #3562
2017-10-12 17:14:16 -07:00
Kun Zhang 1e02b65c08 Fix interop_test client. 2017-10-10 13:46:51 -07:00
Kun Zhang 8edead0851 core: make in-process transport support StreamTracer
This is needed for both completeness and stats/tracing contexts propagation.

Stats recording with Census is intentionally disabled (#2284), while the rest of the Census-related logic work the same as on the other transports.
2017-10-09 10:14:36 -07:00
zpencer b07c70a09f gae-interop-testing: add GAE interop tests (#3535)
See `gae-interop-testing/README.md` for details on how to run the tests.
2017-10-06 10:44:58 -07:00
ZHANG Dapeng 80ac407c6c interop-testing: fix ErrorProne and Unused 2017-10-05 14:15:43 -07:00
Carl Mastrangelo 5e36a8deb5 all: upgrade to JUnit 4.12 2017-10-05 11:24:15 -07:00
zpencer 0d5943614e Make AbstractInteropTest runnable in GAE+jdk7 (#3533)
Avoid mocking and detect when a N/A test should be skipped.
2017-10-02 18:28:24 -07:00
Kun Zhang a6653bb135 core/compiler: register Span names for code-generated methods (take 2)
This is a more favorable approach than #3467. Doing the registration
in MethodDescriptor should allow us to deregister in case the
generated stub and its MethodDescriptors are garbage-collected
routinely, e.g., if they are loaded by a separate ClassLoader.
2017-09-25 15:38:48 -07:00
Eric Gribkoff 5ac9ad0c1f core: client supports inbound gzipped streams (#3403) 2017-09-25 09:01:53 -07:00
Kun Zhang 7e534ed704 core: record individual messages with sizes to Census/tracing (#3461)
Two methods, outboundMessageSent() and inboundMessageRead() are added to StreamTracer in order to associate individual messages with sizes. Both types of sizes are optional, as allowed by Census tracing.

Both methods accept a sequence number as the type ID as required by Census. The original outboundMesage() and inboundMessage() are also replaced by overrides that take the sequence number, to better match the new methods. The deprecation of the old overrides are tracked by #3460
2017-09-19 09:22:11 -07:00
Eric Anderson a3ff9cd784 all: Keep artifacts dependencyConvergence-clean
Maven Enforcer's dependencyConvergence is commonly used in Spring
projects, as it is inherited by all starter projects[1]. While I find
that option to be crazy and harmful (and would instead support
requireUpperBoundDeps), it does bother people.

1. https://github.com/spring-projects/spring-boot/blob/v1.5.6.RELEASE/spring-boot-starters/pom.xml#L94
2017-09-18 16:20:18 -07:00
Lukasz Strzalkowski 731bbefb17 core, compiler, protobuf: introduce MethodDescriptor#setSchemaDescriptor 2017-09-11 09:57:03 -07:00
Carl Mastrangelo 53f56a32f1 inprocess,core: add ManagedChannelBuilder and ServerBuilder factory hiders
* inprocess,core: add ManagedChannelBuilder and ServerBuilder factory hiders

Because the factory for Channels and Servers resides on the builder
itself, it is easy for subclasses to accidentally inherit the
factory.  This causes confusion, because calling a static method on
a specific class may result in a different class.

This change adds hiding static factories to each builder, and a test
to enforce that each subclass hides the factory.  The test lives in
the interop tests, because it has a classpath dependency on all the
existing transports.

Minor note: the test scans the classpath using a Beta Guava API.
The test can be disabled if the API goes away.
2017-09-06 15:21:17 -07:00
Carl Mastrangelo 24ff2748b7 all: update to proto 3.4.0 2017-08-25 11:25:36 -07:00
ZHANG Dapeng 23dfc84ccf interop-testing: fix dealineExceeded test flakiness by increasing time interval
Should resolve #1399
2017-08-24 14:27:49 -07:00
Eric Anderson 182164eafc compiler: Add option to disable version output
If the option becomes popular, we can just remove the version.
2017-08-23 12:37:40 -07:00
zpencer ab85c5ae76 Start 1.7.0 development cycle (#3357)
This bump changelist is applied a bit late with respect to the
1.6.0 branch cut. Look at the 1.6.0 to see the source of truth of
where it was cut. Do not assume it is the commit that precedes
this one.
2017-08-22 12:29:03 -07:00
Eric Gribkoff 15ca50ac7c interop-testing: larger timeout for HTTP/2 client 2017-08-10 13:48:25 -07:00
myPrecious f46280ae9f core: Java Refactor
Duplicate throws exception, and Javadoc issues: ManagedChannelImplTransportManagerTest.java has been deleted.
2017-08-09 09:11:19 -07:00
Eric Gribkoff 8585cd5e0d interop-testing: fix NPE on empty args to test service client 2017-08-07 17:20:54 -07:00
Kun Zhang 16f4de4636 core/stats: report message count metrics to Census. (#3312) 2017-08-04 15:58:21 -07:00
Carl Mastrangelo 02cb718767 testing,core: don't use mocks for stream tracers (#3305)
This is a big, but mostly mechanical change.  The newly added Test*StreamTracer classes are designed to be extended which is why they are non final and have protected fields.  There are a few notable things in this:

1.  verifyNoMoreInteractions is gone.   The API for StreamTracers doesn't make this guarantee.  I have recovered this behavior by failing duplicate calls.  This has resulted in a few bugs in the test code being fixed.

2.  StreamTracers cannot be mocked anymore.  Tracers need to be thread safe, which mocks simply are not.  This leads to a HUGE number of reports when trying to find real races in gRPC.

3.  If these classes are useful, we can promote them out of internal.  I just put them here out of convenience.
2017-08-03 16:59:06 -07:00
Eric Anderson c4f91272d2 all: Remove unused variables and squelch incorrect ErrorProne warning 2017-08-02 15:48:23 -07:00
Eric Gribkoff c0e010af8f interop-testing: implement compression interop tests 2017-07-31 16:08:23 -07:00
Kun Zhang 04e0450304 core: pass CallOptions to newClientStreamTracer(). (#3276)
Resolves #3256
2017-07-27 12:07:25 -07:00
Eric Anderson 924b0b2b00 Revert "interop-testing: overrideAuthority breaks JWT"
This reverts commit 57b9105c7f.

Issue #2682 is fixed, so we can revert the commit as planned. This
re-applies a previously-reverted modernization.
2017-07-19 13:54:32 -07:00
Ian Haken 677c84e1d4 okhttp: Add support for specifying a custom hostname verifier when using on OkHttpChannelBuilder. 2017-07-14 16:04:15 -07:00
ZHANG Dapeng ff0ad5fac3 testing: refactor part of TestUtils to internal
Moved the following APIs from `io.grpc.testing.TestUtils` to `io.grpc.internal.TestUtils`:

`InetSocketAddress testServerAddress(String host, int port)`
`InetSocketAddress testServerAddress(int port)`
`List<String> preferredTestCiphers()`
`File loadCert(String name)`
`X509Certificate loadX509Cert(String fileName)`
`SSLSocketFactory newSslSocketFactoryForCa(Provider provider, File certChainFile)`
`void sleepAtLeast(long millis)`

APIs not to be moved:

`ServerInterceptor recordRequestHeadersInterceptor()`
`ServerInterceptor recordServerCallInterceptor()`
2017-07-10 16:30:38 -07:00
ZHANG Dapeng 0a36c9d8a3 all: migrate .proto files from testing-proto to interop-testing
and provide a simple protobuf service for test in testing-proto instead.
2017-07-06 15:26:08 -07:00
Eric Gribkoff 7c60510794 all,interop-testing: update google-auth-library-oauth2-http (#3188) 2017-07-06 13:22:43 -07:00
Eric Anderson 361f0381be interop-testing: Support conscrypt at runtime with OkHttp
Conscrypt can thus be an alternative to Jetty ALPN for running these
OkHttp integration tests.
2017-06-30 17:07:38 -07:00
Eric Anderson 9052d4245f interop-testing: Skip Netty Jetty ALPN tests if it is unavailable 2017-06-30 16:25:31 -07:00
ZHANG Dapeng b7e50ddd05 testing: move NoopClientCall & NoopServerCall to internal
one step for #3105
2017-06-22 15:10:58 -07:00
ZHANG Dapeng 544ceded6b netty: rename HandlerSettings to InternalHandlerSettings 2017-06-19 09:04:04 -07:00
Eric Gribkoff a2a42e3396 interop-testing: add alpnagent to support okhttp in test client 2017-06-05 16:28:37 -07:00
Carl Mastrangelo 82fce837e4 core: don't return concrete type from AbstractServerImplBuilder 2017-06-01 14:38:05 -07:00
Carl Mastrangelo 166108a943 all: fix licence whitespace 2017-06-01 14:28:37 -07:00
Carl Mastrangelo 3bfd630bff all: update to Apache 2 licence
Also, update the authors.
2017-05-31 13:29:01 -07:00
Eric Anderson cefcd39396 Fix incorrect assertEquals argument ordering
The expected value should be first.
2017-05-24 08:47:02 -07:00