Commit Graph

36 Commits

Author SHA1 Message Date
Eric Anderson 847ea7cfc9 Upgrade Mockito to 3.12.4
MockitoAnnotations.initMocks() is deprecated.
2023-05-08 16:39:42 -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
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
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
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
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
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
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
Ran e258fc743b
Use `ImmutableMap.Builder.buildOrThrow()` instead of deprecated `build()`. (#9132) 2022-05-02 11:51:42 -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