Commit Graph

44 Commits

Author SHA1 Message Date
Esun Kim a47d91c7b2 [Clean-up] Tidy fix (#37104)
Applied two clang 17 tidy fixes;

- https://clang.llvm.org/extra/clang-tidy/checks/readability/container-size-empty.html
- https://clang.llvm.org/extra/clang-tidy/checks/modernize/make-shared.html

Closes #37104

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37104 from veblush:fix-tidy 7b905869b819ac3bd6c45feed665e1f98a0585ca
PiperOrigin-RevId: 650815403
2024-07-09 18:08:10 -07:00
Mark D. Roth 80d9cba5bc [StatsPlugin] Plumb channel args through StatsPluginChannelScope
This allows CallTracers to be created with parameters dictated by
channel args.

For the moment, I've used the EventEngine `EndpointConfig` API to expose
the channel args here, so as to avoid directly exposing
`grpc_core::ChannelArgs`.  We should determine a better API here before
we de-experimentalize the stats APIs.

Also add an experiment to be used in a subsequent PR.

PiperOrigin-RevId: 647730284
2024-06-28 10:44:26 -07:00
Craig Tiller a3b66f02d7 [channel_filter] Use UniqueTypeName for channel filter names (#36907)
Preparation for switching away from `grpc_channel_filter*` to identify channel filters.

Closes #36907

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36907 from ctiller:type-name e7ad4c67a2ebe40f8bbf95198dd84562c47d99b9
PiperOrigin-RevId: 644483948
2024-06-18 12:59:40 -07:00
Yijie Ma 87321f08b3 [OTPlugin] Per-channel OpenTelemetry plugin (#36729)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36729

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36729 from yijiem:per-channel-stats-plugin 4786bed42f11b0a164f21e040439c3145f5d1e3d
PiperOrigin-RevId: 642030366
2024-06-10 14:52:57 -07:00
Craig Tiller 53540ae5d6 [context] Move legacy tracing contexts to arena contexts (#36776)
Closes #36776

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36776 from ctiller:ctx2 8be4cdcf43f00a371dfd4ce0fb01594ecd5483a8
PiperOrigin-RevId: 639133808
2024-05-31 13:26:08 -07:00
Yash Tibrewal 7ccb51e2ea [StatsPlugin] Add API to check if an instrument is enabled (#36757)
Closes #36757

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36757 from yashykt:CheckIfMetricsAreEnabled 7755e98e6039d33220348ea8ccb777f0d2be549b
PiperOrigin-RevId: 639067118
2024-05-31 09:57:34 -07:00
Mark D. Roth 6c08d36c3b [reorg] move telemetry code to src/core/telemetry (#36644)
Closes #36644

PiperOrigin-RevId: 636702732
2024-05-23 15:54:07 -07:00
Yash Tibrewal d3960484c0 [StatsPlugin] Fix use-after-free issue (#36664)
Fix https://github.com/grpc/grpc/issues/36663

Closes #36664

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36664 from yashykt:StatsPluginFixUseAfterFree 107c34134999298353290e461d4353ade2027496
PiperOrigin-RevId: 635555326
2024-05-20 13:39:50 -07:00
Yijie Ma bc4766381a [metrics] Templatized Metrics API (#36449)
This adds compile-time checking that the type of the value and the size of the labels and optional labels passed when recording a metric must match with the type and the size specified when the metric is registered.

The RegistrationBuilder API idea is credited to @ctiller.

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36449

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36449 from yijiem:registration-builder-api a72781013699a985a8e06152594268d6c45a9589
PiperOrigin-RevId: 632271022
2024-05-09 14:31:47 -07:00
Yash Tibrewal 108ee944df [CSM] Fix CSM Observability for trailers-only response (#36413)
Before this change, on a trailers-only response, Metadata Exchange needed by CSM would just be dropped, and hence CSM labels would not be seen.

Changes -
* OTel call attempt tracer populates labels from trailers if it's a trailers-only response.
* HTTP2 layer propagates the Metadata Exchange field from headers to trailers for trailers-only responses.
* Add a test to make sure that retries continue to work when Metadata Exchange is enabled and a trailers-only response is sent. (This verifies that a trailers-only response remains a trailers-only response.)

Closes #36413

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36413 from yashykt:MetadataExchangeInTrailers e7d202685ee6f0f4c4ed3ad689e1b89eb36584ea
PiperOrigin-RevId: 630144618
2024-05-02 12:32:56 -07:00
Mark D. Roth 0944410d6c [reorg] move test/core/util -> test/core/test_util (#36446)
Closes #36446

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36446 from markdroth:reorg_test 5dcc85e006581a8fc52a3a914baa5f33e4a21589
PiperOrigin-RevId: 629229220
2024-04-29 17:06:40 -07:00
Craig Tiller 58b254dacf [call-v3] Channel filter construction returns pointers (#36355)
Currently channel filter construction returns a `StatusOr<T>`, this change makes it return a `StatusOr<P<T>>` where P is `unique_ptr`, `OrphanablePtr`, `RefCountedPtr`, `DualRefCountedPtr`, etc (most of the code really doesn't need to know, so I'm choosing to leave the flexibility).

That smart pointer is then stored in the channel stack instance, and dereferenced when needed.

This means that channel filters no longer need to be movable (which is a nice simplification), and puts these level-1 filters on a similar memory management track as the level-2 filters we have planned.

(this change also converts client load reporting to v3 apis -- it's a bit accidentally picked up, but seems ok to pull through too)

Closes #36355

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36355 from ctiller:objectify-me 0eb054b74826d3b04a5af420c8b7ec73e3fa12c2
PiperOrigin-RevId: 625390977
2024-04-17 01:10:30 +00:00
Craig Tiller b0cf42d86e [clang-format] Remove requirement that port_platform.h is at the top (#36281)
Closes #36281

PiperOrigin-RevId: 623176865
2024-04-09 08:58:34 -07:00
Yash Tibrewal 70839a9b19 [OTel C++] Add experimental optional locality label available to client per-attempt metrics (#36254)
As per https://github.com/grpc/proposal/pull/419, the experimental optional label `grpc.lb.locality` is added to the follow per-call metrics -
* grpc.client.attempt.duration
* grpc.client.attempt.sent_total_compressed_message_size
* grpc.client.attempt.rcvd_total_compressed_message_size

Closes #36254

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36254 from yashykt:OTelOptionalLabelsOnPerCall c5390c99a11c854bb15bb86434d38ec7329719e8
PiperOrigin-RevId: 622973959
2024-04-08 15:52:59 -07:00
Yijie Ma d37726298b [OpenTelemetry] Implement async gauges (#36182)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36182

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36182 from yijiem:grpc-metrics-async-gauge 8614485f3dddb514b0fbda4977e1425f41312984
PiperOrigin-RevId: 622182710
2024-04-05 08:14:44 -07:00
Yash Tibrewal 952a2421f9 [OTel C++] Add API to set channel scope filter (#36189)
Also addressing a TODO from previous PRs where `authority` is not being populated in the `ChannelScope`.

Closes #36189

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36189 from yashykt:OTelChannelScope e76f9ce0ca03d23770febc382bdcc9bde438d112
PiperOrigin-RevId: 621231764
2024-04-02 11:06:03 -07:00
Yash Tibrewal 1312ff0625 [OTel C++] Add APIs to enable/disable metrics (#36183)
Closes #36183

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36183 from yashykt:OTelEnableDisableMetrics 948abe7235023901f4ef2486770bcddb9b5dcb0d
PiperOrigin-RevId: 619696880
2024-03-28 17:35:14 +00:00
Yijie Ma c54c69dcdd [Metrics] New OpenTelemetry Plugin Implementation of Stats Plugin (#36070)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36070

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36070 from yijiem:grpc-metrics 72653727b165e30e13810ae39db4252b358a8932
PiperOrigin-RevId: 618529035
2024-03-23 19:37:26 -07:00
Yash Tibrewal 1ce894c977 [OTel] Add CI support for tests via CMake (#36087)
Earlier, the tests just had bazel support. With CMake support added in #36063, we can also add CI CMake support for the tests. A major benefit of this is that we also get coverage for the various platforms that we test from our portability test suite.

Closes #36087

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36087 from yashykt:OTelCISupport b28fbe02e5592b93f9286eb641bd2db25cbe4d9c
PiperOrigin-RevId: 615543685
2024-03-13 14:28:41 -07:00
Yash Tibrewal 3032b5c48d [OTel C++] Add CMake build support (#36063)
Changes -
* Add CMake build support to `grpcpp_otel_plugin`. Currently, we are only supporting the `find_package CONFIG` method for depending on `opentelemetry-cpp`.
* Since, `grpcpp_otel_plugin` is an extension of gRPC, it will not be built by default. To enable building of this target, a new CMake option `gRPC_BUILD_GRPCPP_OTEL_PLUGIN` is being added.
* Also add `CMakeLists.txt` to the otel example.

The `otel_plugin_test` can also be built through cmake but, for the CI to work, there are some additional changes. Those will be made in an upcoming PR.

Closes #36063

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36063 from yashykt:OTelCMakeSupport 3bc783823b17ed282ae9b6b7bf8a26cedaae30f9
PiperOrigin-RevId: 613734473
2024-03-07 16:12:10 -08:00
Yash Tibrewal 20e5e0cb29 [CSM] Modify CsmObservability to CsmOpenTelemetryPluginOption internally (#35803)
Changes -
* `CsmObservability` API will now use the `CsmOpenTelemetryPluginOption` internally. After this change, `CsmObservability` will enable observability for all channels and servers. (Earlier, `CsmObservability` only enabled observability for CSM-enabled channels and servers.) CSM labels will still be added just for CSM-enabled channels and servers.
* Also, we no longer need the ability to set `LabelInjector` on the `OpenTelemetryPluginBuilder` directly. Instead, we always use `PluginOption` to inject the `LabelInjector`. This simplifies the code as well.

Note that `SetTargetSelector` and `SetServerSelector` APIs on the `OpenTelemetryPluginBuilderImpl` are not being deleted yet since we might need them shortly. This is also why `OpenTelemetryPluginBuilderImpl` is not being deleted right now.

Closes #35803

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35803 from yashykt:CsmO11yApisUsePluginOption cf3d65900d460d3312aea0af91468c4228a18b5b
PiperOrigin-RevId: 604323898
2024-02-05 08:21:58 -08:00
Yash Tibrewal 76c45b98d1 [otel] Return absl::Status as a return from BuildAndRegisterGlobal (#35659)
Just to be future-proof, I'm amending the `void` return status of `BuildAndRegisterGlobal` in `OpenTelemetryPluginBuilder` to absl::Status.

This will be backported to 1.61 as well.

Closes #35659

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35659 from yashykt:UpdateOtelApiToAddStatus 07d3f41b8af09349db8bf572d2feb0405445ac93
PiperOrigin-RevId: 601458408
2024-01-25 08:40:16 -08:00
Yash Tibrewal f51f14e70c [otel] Re-structure otel_plugin_test initialization (#35631)
Closes #35631

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35631 from yashykt:UpdateOtelPluginTest ba1a9cecc2a985d0dbf598cd67ad2452cac6d222
PiperOrigin-RevId: 600950962
2024-01-23 17:11:09 -08:00
Yijie Ma 16b71d91d8 [CSM O11Y] Fix issue when CSM optional labels are present in server metrics (#35633)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35633

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35633 from yijiem:labels-injector-patch 68762439431fcc3ac66a157e1f7405d2f9ff7277
PiperOrigin-RevId: 600931754
2024-01-23 15:55:49 -08:00
Yash Tibrewal c5a8e5af64 [OTel] Add back server_selector that got deleted by a merge fiasco (#35532)
It looks like this ended up getting deleted in https://github.com/grpc/grpc/pull/34350 probably when merging.

Also, the `Init` method in the otel test library is getting unwieldy. I'm going to send out a follow-up PR to convert this into a builder instead.

Closes #35532

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35532 from yashykt:OTelPluginBuilderFix 372bf26338cb89b440fbb470a1fe3388d0002070
PiperOrigin-RevId: 597846622
2024-01-12 08:33:17 -08:00
Yijie Ma 77ad5a786e [CSM O11Y] CSM Service Label Plumbing from LB Policies to CallAttemptTracer (#35210)
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35210

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35210 from yijiem:csm-service-label 6a6a7d177478a31248be8f4e551c7c991157c4be
PiperOrigin-RevId: 597641393
2024-01-11 13:37:44 -08:00
Yash Tibrewal d2cc24f189 [OTel] De-experimentalize API (#35509)
Closes #35509

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35509 from yashykt:DeeexperimentalizeOTelPlugin f5edf94f2cc089ec584cb85c2e0d1473a6a300f4
PiperOrigin-RevId: 597613307
2024-01-11 11:44:57 -08:00
Yash Tibrewal 5888738c5a [OTel] Add a PluginOption API (#35434)
Closes #35434

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35434 from yashykt:OTelPluginOption 1db870bed4ba55cad5515c3586200fa17f5ce226
PiperOrigin-RevId: 596966190
2024-01-09 18:28:43 +00:00
Yash Tibrewal c12a5645f7 [OTel] Experimental API for metrics (#35348)
Provide a public experimental API and bazel compatible build target for OpenTelemetry metrics.

Details -
* New `OpenTelemetryPluginBuilder` class that provides the API specified in https://github.com/grpc/proposal/blob/master/A66-otel-stats.md
* The existing `grpc::internal::OpenTelemetryPluginBuilder` class is moved to `grpc::internal::OpenTelemetryPluginBuilderImpl` for disambiguation.
* Renamed `OTel` in some instances to `OpenTelemetry` for consistency.

Closes #35348

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35348 from yashykt:OTelPublicApi e32328825ee23042f125eb25cb9456cc7767f14e
PiperOrigin-RevId: 594271246
2023-12-28 09:45:29 -08:00
Yash Tibrewal 77824d8093 [chttp2] Fix outgoing data stats (#34693)
Earlier, the grpc message-length prefix for outgoing data messages was
incorrectly being counted towards `data_bytes` instead of
`framing_bytes`. This PR fixes it.

Note that the incoming stats collection properly attributes the grpc
message-length prefix to `framing_bytes`.

This change will affect all stats plugins (OpenCensus and OpenTelemetry)
that make use of this information for metrics.
2023-10-23 17:04:48 -07:00
Yash Tibrewal a0e3794f4b [OTel C++] Method attribute filtering (#34350)
Implements method attribute filtering as defined by the gRFC
https://github.com/grpc/proposal/pull/380
2023-09-22 23:48:01 +00:00
Yash Tibrewal 112fffcdb4 [OTel] Minor test cleanup (#34353)
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-09-21 09:23:47 -07:00
Stanley Cheung e66cb7f2de [GSM Observability] Update opentelemetry cpp bazel deps (#34290)
This is needed for the upcoming work for GSM Observability integration
testing.
2023-09-12 11:02:02 -07:00
Yash Tibrewal 03776a2f3e [OTel and Csm] Cosmetic API changes (#34294)
Changes - 
* OTel API - Metrics enabling/disabling is updated to reflect design
changes.
* GSM is renamed to CSM
2023-09-11 12:23:45 -07:00
Yash Tibrewal 1d136fd05f [OTel] Add API to allow filtering target attribute on client side call/attempt metrics (#34285)
Based on https://github.com/grpc/proposal/pull/380
2023-09-08 01:35:05 -07:00
Yash Tibrewal d4ca41d22d [OTel C++] Add ability to select channels for stats based on the target (#34273)
@ctiller PTAL for core configuration changes. I converted the type from
std::function to absl::AnyInvocable. Do you think the functor in
RegisteredBuilder should be callable just once or multiple times?
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-09-07 17:41:26 -07:00
Yash Tibrewal 0dd8a056b8 Revert "[GSM Observability] "Revert Metadata Exchange Implementation"" (#34234)
Reverts grpc/grpc#34233
2023-09-01 12:04:19 -07:00
Eugene Ostroukhov 9800546913 [GSM Observability] "Revert Metadata Exchange Implementation" (#34233)
Reverts grpc/grpc#34051 as it caused issues with import.
2023-09-01 09:06:45 -07:00
Yash Tibrewal 7c79712d13 [GSM Observability] Metadata Exchange Implementation (#34051)
A new metadata type `x-envoy-peer-metadata` is being introduced. We
don't have a better way to do this at the moment compared to just adding
it in `metadata_batch.h`.

The GSM Observability plugin uses this metadata to send topology
information to peers in the form of serialized and base64 encoded
`google::protobuf::Struct`. The individual keys being used inside the
struct are subject to change.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-08-31 22:43:36 -07:00
Yash Tibrewal f5e02f6c62 [OTel] Remove global fallback for meter provider (#34190)
Based on updates at https://github.com/grpc/proposal/pull/380

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-08-31 13:20:24 -07:00
Yash Tibrewal 2da74beb96 [OTel] Remove authority attribute from server metrics (#34189)
Based on updates at https://github.com/grpc/proposal/pull/380
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-08-28 17:13:01 -07:00
Yash Tibrewal 860167a7d0 [OTel] Add target on client-rpc metrics, and authority on server-rpc metrics (#33946) 2023-08-01 16:37:31 -07:00
Yash Tibrewal 9ea30fa9fd [OTel] Add an OpenTelemetryPluginBuilder (#33895)
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-07-27 14:05:19 -07:00
Yash Tibrewal d2f37b8b45 [OTel] Basic C++ OTel Stats Functionality (#33650)
Note that the plugin is still under `grpc::internal` namespace and not
under `experimental` intentionally.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-07-17 09:30:47 -07:00