Commit Graph

597 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
Tanvi Jagtap
7091890ae7 [Gpr_To_Absl_Logging] [Gpr_To_Absl_Logging] Minor log formatting fixes
PiperOrigin-RevId: 648665041
2024-07-02 04:05:42 -07:00
Eugene Ostroukhov
5ff56f6bcf [test] Increase timeout in pre_stop_hook_server_test (#37126)
Closes #37126

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37126 from eugeneo:increase-timeout-hook-test 190cd3d60ca219660985958e132c7e7bf6072837
PiperOrigin-RevId: 648415617
2024-07-01 10:38:26 -07:00
Mark D. Roth
24318054bc [LB policy API] change metadata mutations to overwrite instead of append (#37075)
Closes #37075

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37075 from markdroth:lb_metadata_overwrite 1f56d2001e64e336df1615b4804a83419d911414
PiperOrigin-RevId: 647761256
2024-06-28 12:18:40 -07:00
Mark D. Roth
34a0318dbf [LB policy API] change metadata mutation API to handle discarded picks (#36968)
Previously, metadata mutations were made by the picker directly, which meant that they would be applied even if the channel winds up discarding the pick due to the returned subchannel having been disconnected by the time the pick result is returned.  This changes the API such that pickers return metadata mutations along with the pick result, so that the mutations won't get applied unless the pick result is actually used.

Closes #36968

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36968 from markdroth:lb_metadata_api 2765da61214f3ae63da3fdb8e362fac625b51c5a
PiperOrigin-RevId: 645451869
2024-06-21 11:35:39 -07:00
Tanvi Jagtap
b4fa67a452 [Gpr_To_Absl_Logging] Remove unused declaration of gpr_default_log.
This was removed as a part of gpr to absl migration.

PiperOrigin-RevId: 643863973
2024-06-16 20:55:53 -07:00
Tanvi Jagtap
03e91b6811 [Gpr_To_Absl_Logging] Move function to test header form log.h (#36860)
[Gpr_To_Absl_Logging] Move function to test header form log.h
This is not really needed in log.h

Closes #36860

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36860 from tanvi-jagtap:move_function_to_test_header e6494bd06f2e4a08c91eb41f420607f9568b22ac
PiperOrigin-RevId: 642080756
2024-06-10 17:52:44 -07:00
Tanvi Jagtap
1dbfd4c9f2 [grpc][Gpr_To_Absl_Logging] Deleting multiple instances of gpr_set_log_function (#36833)
Deleting multiple instances of gpr_set_log_function .
This function will be deleted soon.
https://github.com/grpc/proposal/pull/425

Closes #36833

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36833 from tanvi-jagtap:remove_gpr_log_partial_code 17517efee4795eb6e5ff7670252e7329c9cf12d7
PiperOrigin-RevId: 641268299
2024-06-07 09:14:44 -07:00
Yash Tibrewal
c495d2aa1f [CSM] Stop using xDS enabled server for CSM observability tests (#36725)
Closes #36725

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36725 from yashykt:RemoveXdsEnabledServerFromCsmInterop 91f3120f078068979274881bc02b7cd5905c61e5
PiperOrigin-RevId: 638313782
2024-05-29 09:36:43 -07:00
Tanvi Jagtap
d148728588 Use LOG_IF(FATAL, ...) instead of gpr_assertion_failed() in interop_client.cc
gpr_assertion_failed() will be deprecated soon.

LOG_IF(FATAL, condition) will terminate if condition is true.

PiperOrigin-RevId: 636770885
2024-05-23 20:48:30 -07:00
Mark D. Roth
fe817c8ab1 [reorg] move lib/json -> util/json (#36645)
Closes #36645

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36645 from markdroth:reorg_json 5b6434dd44a0d147731db08b7c2154f61d3b0ef9
PiperOrigin-RevId: 636757495
2024-05-23 19:51:49 -07:00
Tanvi Jagtap
154081a92a [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36678)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log
In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping

1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :

1. If the above mapping is correct.
2. The content of the log is as before.
gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36678

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36678 from tanvi-jagtap:test_cpp_gpr_log 81b8f4179f6111b902cbed9eb65ef6f41eb1e32d
PiperOrigin-RevId: 636410944
2024-05-22 21:59:06 -07:00
Tanvi Jagtap
986428d252 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36636)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log
In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping

1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :

1. If the above mapping is correct.
2. The content of the log is as before.
gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36636

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36636 from tanvi-jagtap:regex_test_cpp f2cac9c5a49f8d6025989160b9d9d6954dc8cc2d
PiperOrigin-RevId: 634954173
2024-05-17 20:10:09 -07:00
Mark D. Roth
58a4b9c922 [reorg] move src/core/lib/gpr -> src/core/util (#36543)
Closes #36543

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36543 from markdroth:reorg_util_gpr ba84e186beb1ec50d09bcf91ebd16e88b8e225aa
PiperOrigin-RevId: 634113744
2024-05-15 16:32:20 -07:00
AJ Heller
bc5570bec8 Revert "[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - BUILD (#36607)" (#36625)
This reverts commit 15850972dd.

Breaks the bazel distribtests. https://source.cloud.google.com/results/invocations/da317d7c-5240-445f-8953-68a840ccc892/targets/%2F%2Ftools%2Fbazelify_tests%2Ftest:bazel_distribtest_6.5.0_buildtest/log

Closes #36625

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36625 from drfloob:revert-36607 395191f9c700e9b5206cef3bb44d875924602898
PiperOrigin-RevId: 633995522
2024-05-15 10:18:57 -07:00
Tanvi Jagtap
15850972dd [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - BUILD (#36607)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - BUILD
In this CL we are just editing the build and bzl files to add dependencies.
This is done to prevent merge conflict and constantly having to re-make the make files using generate_projects.sh for each set of changes.

Closes #36607

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36607 from tanvi-jagtap:build_test_cpp 3e17d778d03272cd51da86baa38b67f77760735c
PiperOrigin-RevId: 633523097
2024-05-14 03:37:04 -07:00
Tanvi Jagtap
b943668f95 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36570)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log

In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping
1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :
1. If the above mapping is correct.
2. The content of the log is as before.

gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36570

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36570 from tanvi-jagtap:test_cpp_interop_tjagtap c50744629540020e2bb0e27158a6437d82c5bc64
PiperOrigin-RevId: 632375773
2024-05-09 22:18:42 -07:00
Tanvi Jagtap
7cc547dfd9 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36526)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log

In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping
1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :
1. If the above mapping is correct.
2. The content of the log is as before.

gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36526

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36526 from tanvi-jagtap:test_large_interop_client_gpr_log 46a657fe203be59a5e8ad87c0dbfd9c52ba2f1f6
PiperOrigin-RevId: 630993244
2024-05-06 03:50:34 -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
Tanvi Jagtap
30386413c0 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36438)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT
Replacing GPR_ASSERT with absl CHECK

These changes have been made using string replacement and regex.

Will not be replacing all instances of CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites. Only ones which are doable using very simple regex with least chance of failure will be replaced.

Given that we have 5000+ instances of GPR_ASSERT to edit, Doing it manually is too much work for both the author and reviewer.

<!--

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 #36438

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36438 from tanvi-jagtap:tjagtap_cpp 405efd63c33aaef551368578c06d01eb85e2a629
PiperOrigin-RevId: 628281347
2024-04-25 21:03:38 -07:00
AJ Heller
1a8b22f2de [build] Restrict visibility for creating core credentials types. (#36216)
Closes #36216

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36216 from drfloob:conceal-core-cred-creation a44a2992736c2c45c044452ec892e6ac4d173b7b
PiperOrigin-RevId: 625425746
2024-04-17 01:21:29 +00:00
Tanvi Jagtap
259f0e7903 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - GPR_ASSERT (#36222)
Replacing GPR_ASSERT with absl CHECK

Will not be replacing CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites.

This could be done using Cider-V once these changes are submitted if we want to clean up later. Given that we have 4000+ instances of GPR_ASSERT to edit, Doing it manually is too much work for both the author and reviewer.

<!--

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 #36222

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36222 from tanvi-jagtap:assert_interop adcc660e78c74cc1f8257d9925b9ed1215dab4a8
PiperOrigin-RevId: 623366969
2024-04-09 21:32:34 -07:00
Eugene Ostroukhov
493d873411 [test] increase timeout (#36308)
This fixes rare failure under MSAN. This does not increate the test run time:

MSAN build:
```
//test/cpp/interop:backend_metrics_lb_policy_test@poller=poll            PASSED in 59.2s
  Stats over 5000 runs: max = 59.2s, min = 4.9s, avg = 6.5s, dev = 2.8s
```

Opt/no MSAN:
```
//test/cpp/interop:backend_metrics_lb_policy_test@poller=poll            PASSED in 26.7s
  Stats over 5000 runs: max = 26.7s, min = 4.9s, avg = 7.7s, dev = 2.8s
```

Closes #36308

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36308 from eugeneo:333396468-msan-backend_metrics_lb_policy_test 4ad9443131e2cbe50a0c214dbba93cfc7dd7db60
PiperOrigin-RevId: 623250444
2024-04-09 12:40:20 -07: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
AJ Heller
f238e5399c [security] Reland: Refactor credentials types to remove special handling for insecure creds (#36242)
See #36176. The only difference is a temporary shim for Secure credentials types, which was already discussed and approved separately.

Closes #36242

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36242 from drfloob:reland/36176 f07bebe289b334b0dbf090bc67264e77c0821e9d
PiperOrigin-RevId: 621879911
2024-04-04 09:20:02 -07:00
AJ Heller
da43a61322 Automated rollback of commit 822311c0d9.
PiperOrigin-RevId: 621025232
2024-04-01 19:51:52 -07:00
AJ Heller
822311c0d9 [security] Refactor credentials types to remove special handling for insecure creds (#36176)
Forked from #35957

This PR refactors the credentials types to remove Secure and Insecure Channel and Call credentials types. We standardize on a `c_creds()` accessor method for all credentials types, which can now be treated uniformly. This notably removes special-case handling of insecure credentials.

The special code-paths for insecure creds are no longer necessary in the wake of #25586.

Closes #36176

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36176 from drfloob:fork/35957/creds-API fd64d59c23a78bd9cfd889d9aff3fbd135fc78b3
PiperOrigin-RevId: 621008166
2024-04-01 18:12:59 -07:00
Alexander Polcyn
1abd28eb3b Log c++ interop "soak" results at INFO instead of DEBUG
PiperOrigin-RevId: 620955008
2024-04-01 14:34:25 -07:00
Mark D. Roth
17d9e20ff1 [slice] use absl base64 APIs instead of slice base64 APIs (#35851)
Closes #35851

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35851 from markdroth:base64 6caf83d3dad4f6448b2b3cbb2ace36ab535ae602
PiperOrigin-RevId: 606759013
2024-02-13 15:05:50 -08:00
Yash Tibrewal
2999332d64 [CSM] De-experimentalize CsmObservability API (#35836)
Closes #35836

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35836 from yashykt:DeexperimentalizeCsmObs 1711e6d9b08199f92c45e0b5fdd69372051eb632
PiperOrigin-RevId: 605650394
2024-02-09 09:28:18 -08:00
Yash Tibrewal
387c894117 [CSM] Remove experimental CSM PluginOption API in favor of CsmObservability API (#35812)
Also update interop tests to use `CsmObservability` API

Closes #35812

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35812 from yashykt:UpdateCsmInterop dc99764aead307a0a2b93e6bfbf76b9ca79e8581
PiperOrigin-RevId: 604726881
2024-02-06 12:20:23 -08:00
Mark D. Roth
148f59c15a [reorg] move LB policy code to src/core/load_balancing (#35786)
This new directory combines code from the following locations:
- src/core/ext/filters/client_channel/lb_policy
- src/core/lib/load_balancing

Closes #35786

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35786 from markdroth:client_channel_resolver_reorg 98554efb983c50c385009cd6a7df4b999932ec68
PiperOrigin-RevId: 604351832
2024-02-05 10:05:35 -08:00
Stanley Cheung
48961e8a2c [PSM Interop] Add a payload to xds interop client when sending RPCs (#35545)
When testing CSM Observability, we discovered that the c++ xds interop client is not sending any payload with the `UnaryCall` RPCs so most of the metrics will have a value of 0.

Adding a payload to the xds interop client here.

We need this fix so that we can verify that the metrics are recording the right number of bytes being sent / received. So we need a non-trivial payload to be sent with the `UnaryCall` RPC between the xds interop client and server.

Closes #35545

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35545 from stanley-cheung:xds-client-payload 11be4e6f4fda8a7d6267ec43b861a82d7fa0c4b8
PiperOrigin-RevId: 601596246
2024-01-25 16:12:45 -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
984daf98d7 [CSM o11y] Re-experimentalize CSM OTel Plugin Option (#35660)
We are no longer sure about this API, so re-experimentalizing it.

This PR will be backported to 1.61 as well.

Closes #35660

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35660 from yashykt:ReexperimentalizeCsmPluginOption 4f114a54d9914c70d49358f7e84e7bfdab576590
PiperOrigin-RevId: 601378856
2024-01-25 01:57:24 -08:00
Yash Tibrewal
4cea5d0cba [xDS Interop] Use XdsServerBuilder when testing CSM Observability (#35634)
[prod:grpc/core/master/linux/grpc_xds_k8s_lb](https://fusion2.corp.google.com/ci/kokoro/prod:grpc%2Fcore%2Fmaster%2Flinux%2Fgrpc_xds_k8s_lb/activity/6c2577f0-965b-4f22-ac2a-5454a0f77444/log)

Closes #35634

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35634 from yashykt:CsmInteropTrial a8213cd10a266be72fb9594f9d1be62f7397f705
PiperOrigin-RevId: 601010836
2024-01-23 22:33:57 -08:00
Yash Tibrewal
acc1ad1b2b [CSM] De-experimentalize CSM OTel Plugin Option (#35526)
Closes #35526

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35526 from yashykt:DeexperimentalizeCsmPluginOption 441eccb8579e8687aad13aa7b21db3d40c201a65
PiperOrigin-RevId: 597675383
2024-01-11 15:55:26 -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
6741e2064d [xds interop] Use new CSM Observability APIs (#35508)
Closes #35508

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35508 from yashykt:XdsInteropNewCsm 09d408c082b4cb8e534ce5143fea2cbb72b560f1
PiperOrigin-RevId: 597588033
2024-01-11 10:15:04 -08:00
Eugene Ostroukhov
e73b76a7da [Test] Fix bug in waiting for the Orca OOB report (#35467)
Make sure there is no unnecessary delays when there are multiple reports in the queue.

This change also adds a test for the custom LB policy.

Closes #35467

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35467 from eugeneo:tasks/orca-test-timeout-316026521 4aab50a1187586ce1375bc85231b70091ef9d3e2
PiperOrigin-RevId: 597007131
2024-01-09 12:21:45 -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
Mark D. Roth
3e785d395d [RefCounted and friends] Fix type safety of ref-counted types.
Previously, `RefCountedPtr<>` and `WeakRefCountedPtr<>` incorrectly allowed
implicit casting of any type to any other type.  This hadn't caused a
problem until recently, but now that it has, we need to fix it.  I have
fixed this by changing these smart pointer types to allow type
conversions only when the type used is convertible to the type of the
smart pointer.  This means that if `Subclass` inherits from `Base`, then
we can set a `RefCountedPtr<BaseClass>` to a value of type
`RefCountedPtr<Subclass>`, but we cannot do the reverse.

We had been (ab)using this bug to make it more convenient to deal with
down-casting in subclasses of ref-counted types.  For example, because
`Resolver` inherits from `InternallyRefCounted<Resolver>`, calling
`Ref()` on a subclass of `Resolver` will return `RefCountedPtr<Resolver>`
rather than returning the subclass's type.  The ability to implicitly
convert to the subclass type made this a bit easier to deal with.  Now
that that ability is gone, we need a different way of dealing with that
problem.

I considered several ways of dealing with this, but none of them are
quite as ergonomic as I would ideally like.  For now, I've settled on
requiring callers to explicitly down-cast as needed, although I have
provided some utility functions to make this slightly easier:

- `RefCounted<>`, `InternallyRefCounted<>`, and `DualRefCounted<>` all
  provide a templated `RefAsSubclass<>()` method that will return a new
  ref as a subclass.  The type used with `RefAsSubclass()` must be a
  subclass of the type passed to `RefCounted<>`, `InternallyRefCounted<>`,
  or `DualRefCounted<>`.
- In addition, `DualRefCounted<>` provides a templated `WeakRefAsSubclass<T>()`
  method.  This is the same as `RefAsSubclass()`, except that it returns
  a weak ref instead of a strong ref.
- In `RefCountedPtr<>`, I have added a new `Ref()` method that takes
  debug tracing parameters.  This can be used instead of calling `Ref()`
  on the underlying object in cases where the caller already has a
  `RefCountedPtr<>` and is calling `Ref()` only to specify the debug
  tracing parameters.  Using this method on `RefCountedPtr<>` is more
  ergonomic, because the smart pointer is already using the right
  subclass, so no down-casting is needed.
- In `WeakRefCountedPtr<>`, I have added a new `WeakRef()` method that
  takes debug tracing parameters.  This is the same as the new `Ref()`
  method on `RefCountedPtr<>`.
- In both `RefCountedPtr<>` and `WeakRefCountedPtr<>`, I have added a
  templated `TakeAsSubclass<>()` method that takes the ref out of the
  smart pointer and returns a new smart pointer of the down-casted type.
  Just as with the `RefAsSubclass()` method above, the type used with
  `TakeAsSubclass()` must be a subclass of the type passed to
  `RefCountedPtr<>` or `WeakRefCountedPtr<>`.

Note that I have *not* provided an `AsSubclass<>()` variant of the
`RefIfNonZero()` methods.  Those methods are used relatively rarely, so
it's not as important for them to be quite so ergonomic.  Callers of
these methods that need to down-cast can use
`RefIfNonZero().TakeAsSubclass<>()`.

PiperOrigin-RevId: 592327447
2023-12-19 13:27:56 -08:00
gRPC Team Bot
667def7505 Internal change
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35043 from gtcooke94:deprecate_old_crl_apis 003057a93c2686411be4c02bec38fcad4fa7e85d
PiperOrigin-RevId: 585744149
2023-11-27 21:41:47 +00:00
Stanley Cheung
ff2c0313e3 [PSM Interop] Add flag to enable CSM Observability in c++ image (#34866)
Roll forward of #34832, 3rd attempt. Will run a grpc import cherry-pick
to make sure the next import is going to be clean.
2023-11-02 14:59:16 -07:00
Stanley Cheung
9303b86010 Revert "[PSM Interop] Add flag to enable CSM Observability in c++ image" (#34858)
Reverts grpc/grpc#34840
2023-11-02 10:42:07 -07:00
Stanley Cheung
a62c2607a6 [PSM Interop] Add flag to enable CSM Observability in c++ image (#34840)
Roll forward of #34832 (reverted in #34837).

Need #34836 to be  merged first.
2023-11-01 18:52:57 -07:00
Vignesh Babu
c4b9a9a8fc Revert "[PSM Interop] Add flag to enable CSM Observability in c++ image" (#34837)
Reverts grpc/grpc#34832. Broke import
2023-10-31 18:27:29 -07:00
Stanley Cheung
433cfa99a5 [PSM Interop] Add flag to enable CSM Observability in c++ image (#34832)
Add the flag `enable_csm_observability` to the c++ PSM interop testing
image, such that when enabled from the PSM interop testing framework,
the C++ client/server app will enable the CSM Observability plugin.
2023-10-31 14:42:51 -07:00
Yijie Ma
bae0c705aa [Deps] Update to Clang-16 (#34492)
<!--

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-10-11 16:26:32 -07:00