Commit Graph

49 Commits

Author SHA1 Message Date
Eric Anderson 1551cc7403 Upgrade Protobuf Java to 3.22.3 (aka 22.3)
The version used by protoc-gen-grpc-java will be upgraded separately,
because of large C++ build changes necessary. But that won't impact
users at all. We are upgrading to protoc 22.3; only the grpc plugin is
not upgraded.

Bazel is upgraded for both Java and C++.
2023-04-17 13:16:20 -07:00
Vindhya Ningegowda 1e1b57e15b Removes the ExperimentalApi annotation from GcpObservability. 2023-04-06 12:44:23 -07:00
DNVindhya cc6be5f8c6
gcp-o11y: Remove monitored resource detection for logging (#10020)
* removed populating monitored resource to k8s_conatiner by default for logging; Delegating the resource detection to cloud logging library instead (enabled by default)

* remove kubernetes resource detection logic from observability
2023-04-06 11:48:46 -07:00
Larry Safran 58e2224df9
Fix order dependent tests regarding message duration b/271122310 (#9930)
* Fix order dependent test by changing the initializations and comparison so that elapsed time isn't as significant in identifying whether it was the context or call option's duration that was used.

fixes b/271122310
2023-03-24 16:40:35 -07:00
Stanley Cheung a6cdf498c9
Remove sleep from Observability Interop Test binary now that its done in close() (#9977)
After #9972, the `sleep()` is done inside Observability `close()`, we can remove this `sleep()` in the Observability Interop test binary.
2023-03-22 16:50:09 -07:00
DNVindhya 3634901849
gcp-o11y: add default custom tag for metrics exporter
This PR adds a default custom tag for metrics, irrespective of custom
tags being present in the observability configuration. 

OpenCensus by default adds a custom tag
[opencenus_task](https://docs.google.com/document/d/1sWC-XD277cM0PXxAhzJKY2X0Uj2W7bVoSv-jvnA0N8Q/edit?resourcekey=0-l-wqh1fctxZXHCUrvZv2BQ#heading=h.xy85j580eik0)
for metrics which gets overriden if custom tags are set.

The unique custom tag is required to ensure the uniqueness of the
Timeseries. The format of the default custom tag is:
`java-{PID}@{HOSTNAME}`, if `{PID}` is not available a random number
will be used.
2023-03-22 16:44:58 -07:00
DNVindhya 783de5dfc9
gcp-o11y: add sleep in Observability close()
This commit adds sleep in `close()` for metrics and/or traces to be
flushed before closing observability.

Currently sleep is set to 2 * [Metrics export interval (30 secs)].
2023-03-22 08:40:05 -07:00
Vindhya Ningegowda 9039d4dcff disable recording real-time metrics using in gcp-o11y 2023-03-21 16:17:30 -07:00
DNVindhya 844de39c26
gcp-observability, census: add trace information to logs (#9963)
This commit adds trace information (TraceId, SpanId and TraceSampled)
fields to LogEntry, when both logging and tracing are enabled in
gcp-observability. 

For server-side logs, span information was readily available using
Span.getContext() propagated via `io.grpc.Context`. Similar approach is
not feasible for client-side architecture.

Client SpanContext which has all the information required to be added
to logs is propagated to the logging interceptor via `io.grpc.CallOptions`.
2023-03-20 14:18:16 -07:00
DNVindhya 1b799adc19
gcp-observability: Update logging fields for GA and use custom BatchingSettings (#9959)
This commit updates the following in gcp observability logging schema
* `payload.status_code` will be of type `google.rpc.Code` instead of `uint32`.
*  names in enum `Address.TYPE`

Use custom batching settings for [LoggingOptions](https://javadoc.io/doc/com.google.cloud/google-cloud-logging/latest/com/google/cloud/logging/LoggingOptions.html)

Note: Upgraded `com.google.cloud:google-cloud-logging` from `3.6.1` to `3.14.5`.
2023-03-17 15:53:46 -07:00
DNVindhya b09473b0d3
census: Trace annotation for reporting inbound message sizes (#9944)
This commit uses [OpenCensus Annotation][] to report message size
[bytes] for inbound/received messages in traces.

`addMessageEvent` API which is currently used expects both uncompressed
and compressed message (optional) sizes to be reported at the same.
Since decompression for messages happens at a later point in time,
reporting compressed message as is and reporting uncompressed size as
`-1` renders the size as _0 bytes received_ in cloud tracing front end.

As a workaround, we add _two annotations for each received message_:
* For compressed message size
* For uncompressed message size (when it is available)

This commit also removes `addMessageEvents` a flag introduced in
PR #9485 to temporarily suppress message events for gcp-observability.

[OpenCensus Annotation]: https://www.javadoc.io/static/io.opencensus/opencensus-api/0.31.0/io/opencensus/trace/Annotation.html
2023-03-10 16:19:21 -08:00
Eric Anderson 4229191a23 Move gcp-observability interop binary out of interop-testing
gcp-observability has many dependencies so is a bit annoying in some
build systems to get working... just for it not to be used in
non-observability scenarios.

grpc-go and c core are using separate binaries for gcp-observability
interop testing, so do the same in Java, which makes interop-testing a
bit lighter.
2023-03-07 10:57:38 -08:00
DNVindhya 66f95b7ade
census: add per call latency metric (#9906)
* updated call latency measure with AGGREGATION_WITH_MILLIS_HISTOGRAM; added test for call latency view
2023-03-03 09:36:14 -08:00
Eric Anderson c3f02d5957
gcp-observability: Fix transitive gRPC versions
google-cloud-logging brings in xds, services, and netty-shaded versions
1.43.2. grpc-netty-shaded and xds use internal APIs, so their version
needs to align with grpc-api and grpc-core.  OpenCensus stackdriver
components also brings in netty-shaded version 1.27.2, but it was later
in the dependency list so google-cloud-logging's versions won out even
if using Maven.

We don't need an explicit dependency on netty-shaded because xds depends
on it transitively.

This was discovered because our GAE interop test failed in the course of
PR #9858 which added grpc-gcp-observability to interop-testing (and thus
also gae-interop-test):
```
Caused by: java.lang.AbstractMethodError: io.grpc.ManagedChannelProvider.getSupportedSocketAddressTypes()Ljava/util/Collection;
    at io.grpc.ManagedChannelRegistry.newChannelBuilder(ManagedChannelRegistry.java:186)
    at io.grpc.ManagedChannelRegistry.newChannelBuilder(ManagedChannelRegistry.java:155)
    at io.grpc.Grpc.newChannelBuilder(Grpc.java:101)
    at io.grpc.testing.integration.LongLivedChannel.<init>(LongLivedChannel.java:44)
    ... 44 more
```
2023-02-24 13:45:19 -08:00
DNVindhya 7942b9e7f5
gcp-observability: add new *compressed_bytes_per_rpc views (#9893)
* Add new metric views; Register latency and bytes per metrics views for observability
* update view description to inlcude client/server
* Use pre-defined aggregation from OpenCensus for bytes histogram
* updated view names
2023-02-15 17:17:39 -08:00
Eric Anderson d17a2db4bd Upgrade to Checkstyle 8.28
Trying to upgrade Gradle to 7.6 improved the checkstyle plugin such that
it appears to have been running in new occasions. That in turn exposed
us to https://github.com/checkstyle/checkstyle/issues/5088. That bug was
fixed in 8.28, which also fixed lots of other bugs. So now we have
better checking and some existing volations needed fixing. Since the
code style fixes generated a lot of noise, this is a pre-fix to reduce
the size of a Gradle upgrade.

I did not upgrade past 8.28 because at some point some other bugs were
introduced, in particular with the Indentation module. I chose the
oldest version that had the particular bug impacting me fixed. Upgrading
to this old-but-newer version still makes it easier to upgrade to a
newer version in the future.
2023-01-05 17:07:04 -08:00
DNVindhya 13c2db1aa3
add period to service filter regular expression in logging config (#9631) 2022-10-19 11:07:41 -07:00
DNVindhya aeb90e3855
gcp-observability: updated config to public preview config (#9622) 2022-10-18 14:23:54 -07:00
DNVindhya 43942623fb
gcp-observability: update observability logging proto (#9608) 2022-10-17 22:47:54 -07:00
sanjaypujare 0cda133c52
observability: replace current OpenCensus registerAllGrpcViews with only selected views for GCP observability (#9561) 2022-09-23 13:24:27 -07:00
sanjaypujare 6131a85196
census,observability: suppress message-events in traces when used by observability (#9485) 2022-08-26 16:39:54 -07:00
DNVindhya 20ab369f3a
gcp-observability: update configuration variable to enable cloud tracing (#9463) 2022-08-19 17:09:17 -07:00
Larry Safran 01d5bd47cb
Cleanup some of the warnings across the code base (#9445)
No logic changes, just cleans up warnings to make spotting real problems easier.

Remove "public" declarations on interfaces
Remove duplicate semicolons (Java lines ending in ";;")
Remove unneeded import
Change non-javadoc comment to not start with "/**"
Remove unneeded explicit type declarations from generics
Fix broken javadoc links
2022-08-15 11:06:31 -07:00
DNVindhya 03430c786a
remove unregistering stackdriver exporters (#9442) 2022-08-12 12:20:43 -07:00
sanjaypujare 91aada316a
gcp-observability: implement exclusion of cloud backend RPCs for all 3 signals (#9427)
* gcp-observability: implement exclusion of cloud backend RPCs for all 3 signals
by using a ConditionalClientInterceptor that conditionally delegates
2022-08-10 14:19:27 -07:00
Eric Anderson 61f19d707a
Swap Animalsniffer to Java 8 and Android 19
Also added missing signatures. Swapping to version catalog will make
this process easier in the future.
2022-08-10 12:41:57 -07:00
DNVindhya 7bdca0c0ef
gcp-observability: remove logging channel/server providers (#9424) 2022-08-09 21:08:01 -07:00
sanjaypujare e89d43dde6
gcp-observability: add custom tags to metrics and traces using Stackdriver config-builders (#9407) 2022-07-26 21:27:46 +05:30
sanjaypujare 10979b2e2c
gcp-observability: add custom tags for all 3 - metrics, logging, traces and remove old env-vars impl (#9402)
* gcp-observability: add custom tags for all 3 - metrics, logging, traces and remove old env-vars impl
2022-07-23 01:32:18 +05:30
DNVindhya ef89bd3ac9
gcp-observability: Populate global interceptors from observability (#9309)
* Populate global interceptors from observability and added stackdriver exporters
2022-07-14 19:38:00 +05:30
Eric Anderson 0ff9f37b9e Use Gradle's task configuration avoidance APIs
This can avoid creating an additional 736 tasks (previously 502 out of
1591 were not created). That's not all that important as the build time
is essentially the same, but this lets us see the poor behavior of the
protobuf plugin in our own project and increase our understanding of how
to avoid task creation when developing the plugin. Of the tasks still
being created, protobuf is the highest contributor with 165 tasks,
followed by maven-publish with 76 and appengine with 53. The remaining
59 are from our own build, but indirectly caused by maven-publish.
2022-07-08 12:16:40 -07:00
Eric Anderson fb314d3631
Bump versions for assorted dependencies
If I didn't upgrade X there is probably a reason, but worst-case the
reason was "I was lazy." I did the easy stuff, so if upgrading caused
problems of any real sort I skipped it and moved on. The main other
reason is there's some stuff we're more conservative about upgrading,
but you can't distinguish one from the other in this commit.
2022-06-30 15:25:43 -07:00
Eric Anderson c0790283ec
Bump protobuf to 3.21.1 (#9311)
Fixes #9264
2022-06-30 11:18:49 -07:00
Eric Anderson b06942d63b Use Gradle's version catalog
This moves our depedencies into a plain file that can be read and
updated by tooling. While the current tooling is not particularly better
than just using gradle-versions-plugin, it should put us on better
footing. gradle-versions-plugin is actually pretty nice, but will be
incompatible with Gradle 8, so we need to wait a bit to see what the
future holds.

Left libraries as an alias for libs to reduce the commit size and make
it easier to revert if we don't end up liking this approach.

We're using Gradle 7.3.3 where it was an incubating fetaure. But in
Gradle 7.4 is became stable.
2022-06-14 14:04:10 -07:00
Feng Li 56e28bc9fa
Change the gRPC o11y logName when sending logs to GCP. (#9145)
* Change the gRPC o11y logName when sending logs to GCP.
2022-06-08 13:57:45 -07:00
Eric Anderson 746cb15fdd Bump Guava to 31.1
error_prone_core itself was not upgraded, even though the annotations
were to keep the change minimal.
2022-06-06 16:15:43 -07:00
Vladimir Chizhov 0490ced91c
Bump GSON to 2.9.0 (#9215) 2022-05-31 15:07:22 -07:00
sanjaypujare 8f1dab0470
gpc-observability: add configuration for metrics and tracing, sampler and sampler_rate and reading from file (#9151) 2022-05-11 08:20:12 -07:00
DNVindhya 15ecc0714e
gcp-observability: add grpc-census as a dependency and update opencensus version (#9140) 2022-05-03 20:52:34 -07:00
Ran e258fc743b
Use `ImmutableMap.Builder.buildOrThrow()` instead of deprecated `build()`. (#9132) 2022-05-02 11:51:42 -07:00
Eric Anderson 369f87becd Revert "auth: Add support for Retryable interface"
This reverts commit 0963f3151d. This
causes dependency problems when importing into Google, as
google-auth-library-java needs to be upgraded and that requires an
upgrade to google-http-java-client to bring in
https://github.com/googleapis/google-http-java-client/pull/1505 .
Reverting for now and will roll forward once those upgrades are
performed.
2022-04-27 15:38:13 -07:00
Eric Anderson 0963f3151d
auth: Add support for Retryable interface
Retryable was added in google-auth-library 1.5.3 to make clear the
situations that deserve a retry of the RPC. Bump to that version and
swap away from the imprecise IOException heuristic.
go/auth-correct-retry

Fixes #6808
2022-04-26 08:59:08 -07:00
sanjaypujare 538db03d56
api: add support for SocketAddress types in ManagedChannelProvider (#9076)
* api: add support for SocketAddress types in ManagedChannelProvider
also add support for SocketAddress types in NameResolverProvider
Use scheme in target URI to select a NameRseolverProvider and get
that provider's supported SocketAddress types.
implement selection in ManagedChannelRegistry of appropriate
ManagedChannelProvider based on NameResolver's SocketAddress types
2022-04-22 09:10:55 -07:00
DNVindhya 8d69a352a9
adding @Internal annotation for internal classes (#9063) 2022-04-05 15:02:43 -07:00
DNVindhya 6765fe1457
gcp-observability: add null check before trim() for non-GKE instances (#9060) 2022-04-05 14:42:38 -07:00
DNVindhya adab27bb0f
gcp-observability: add source project id to labels when cross project logging is enabled (#9056) 2022-04-05 11:29:45 -07:00
sanjaypujare fda3a2d6ff
gcp-observability: trim the string to remove newline for hostname and namespace name from files (#9043) 2022-04-01 10:11:54 -07:00
DNVindhya 86e3362298
observability: add configurable value for flush from configuration (#9034) 2022-03-30 18:03:36 -07:00
sanjaypujare 5113e92415
observability: rename Observability to GcpObservability (#9030)
* observability: rename Observability to GcpObservability
rename artifact to grpc-gcp-observability
enable maven publication of grpc-gcp-observability
2022-03-30 10:12:33 -07:00