Compare commits

...

45 Commits

Author SHA1 Message Date
Tanvi Jagtap ccfc163607 [Gpr_To_Absl_Logging] Replace gpr_should_log with absl::MinLogLevel() (#36870)
[Gpr_To_Absl_Logging] Replace gpr_should_log with absl::MinLogLevel()

Closes #36870

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36870 from tanvi-jagtap:fix_tcp_windows_gpr_should_log_01 a04c0106b7
PiperOrigin-RevId: 642443074
2024-06-11 17:23:11 -07:00
Tanvi Jagtap 301bb28782 [Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36880)
[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 #36880

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36880 from tanvi-jagtap:src_cpp_folder_gpr_log e6e795f469
PiperOrigin-RevId: 642436269
2024-06-11 16:54:37 -07:00
Xuan Wang ce220f01a5 [Python Test] Remove googleapis-common-protos from build_python (#36874)
<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36874 from XuanWang-Amos:remove_common_proto_dep 51400c5aff
PiperOrigin-RevId: 642424550
2024-06-11 16:09:50 -07:00
Xuan Wang d167fe7467 [Release] Bump core version to 42.0.0 for upcoming release (#36887)
Change was created by the release automation script. See go/grpc-release.

Closes #36887

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36887 from XuanWang-Amos:bump_core_version_202406111526 5df15650dd
PiperOrigin-RevId: 642358496
2024-06-11 12:48:26 -07:00
Yousuk Seung f3c0a9e344 [experiments] don't require event_engine_client for work_serializer_dispatch (#36875)
<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36875 from yousukseung:reenable-work-serializer-dispatch da03e7d9df
PiperOrigin-RevId: 642347062
2024-06-11 12:09:11 -07:00
Craig Tiller cf90fc7f73 [fuzzing] Fix chaotic good framer fuzzing bug (#36821)
Refines the test in the fuzzer to only check input == output if the frame was re-encodable.
Also tweaks some hpack encoder stuff to not crash but simply report errors where appropriate.

Closes #36821

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36821 from ctiller:f-frame 1b08875c4e
PiperOrigin-RevId: 642311442
2024-06-11 10:24:52 -07:00
Esun Kim 65be93cae3 [Example] C++ Auth/SSL example (#36842)
Adding a new SSL example.

Closes #36842

PiperOrigin-RevId: 642310656
2024-06-11 10:21:03 -07:00
Tanvi Jagtap 905c2b25fc [grpc][Gpr_To_Absl_Logging] Deleting all instances of gpr_set_log_verbosity (#36859)
Deleting all instances of gpr_set_log_verbosity

Closes #36859

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36859 from tanvi-jagtap:remove_gpr_set_log_verbosity_01 d7a74d0624
PiperOrigin-RevId: 642297195
2024-06-11 09:36:55 -07:00
AJ Heller e3da1e7ab6 [EventEngine] Enable Windows EventEngine client (#36876)
Reattempt enabling the Windows EventEngine client experiment, after fixing a race condition in connection establishment vs timeout.

Closes #36876

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36876 from drfloob:wineec 125f3a20d8
PiperOrigin-RevId: 642294760
2024-06-11 09:29:30 -07:00
Marcel 73d016e399 Replace bind() targets with alias() ones (#35272)
Usage of `bind()` is [deprecated in WORKSPACE](https://bazel.build/reference/be/workspace#bind) and [not supported in Bzlmod](https://bazel.build/external/migration#bind-targets).

This is a required preparatory step for #35271.

An alternative would be to use the target names directly and completely get rid of `bind()` and `alias()`.

Fixes #13902, #20193.

Closes #35272

PiperOrigin-RevId: 642275803
2024-06-11 08:20:02 -07:00
Tanvi Jagtap e4b7d46f43 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36800)
[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 #36800

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36800 from tanvi-jagtap:src_core_lib cc0411e99d
PiperOrigin-RevId: 642109824
2024-06-10 20:09:31 -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 e6494bd06f
PiperOrigin-RevId: 642080756
2024-06-10 17:52:44 -07:00
Yousuk Seung 7ce0ccdb40 child post-fork gRPC shutdown to wait briefly (#36873)
gRPC shutdown may happen asynchronously with `work_serializer_dispatch`, so wait briefly until shutdown completes in the child's post-fork.

<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36873 from yousukseung:python-fork-shutdown-wait 7908a6912a
PiperOrigin-RevId: 642066286
2024-06-10 16:53:04 -07:00
Nana Pang c605b98467 [Telemetry] Add function `FindInstrumentByName` in telemetry/metrics.h to allow users query instruments list.
PiperOrigin-RevId: 642057981
2024-06-10 16:25:02 -07:00
Craig Tiller 3d1f460fcc [experiments] Update some expirations - still working on them (#36871)
Closes #36871

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36871 from ctiller:xup 6d8e47bdb8
PiperOrigin-RevId: 642052522
2024-06-10 16:06:45 -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 4786bed42f
PiperOrigin-RevId: 642030366
2024-06-10 14:52:57 -07:00
Tanvi Jagtap fabf135c7f [Gpr_To_Absl_Logging] Replace gpr_should_log with ABSL_VLOG_IS_ON (#36866)
[Gpr_To_Absl_Logging] Removing instances of gpr_should_log and replacing it with ABSL_VLOG_IS_ON.
gpr_should_log function will be deleted soon.

**VLOG(2)** is equivalent to gpr_log(**GPR_DEBUG**, ... )

We are replacing two instances of **gpr_log(GPR_INFO**, ... ) with **VLOG(2)** because this code appears to be slightly expensive.
I can also continue to use LOG(INFO) and check current settings using absl::MinLogLevel() . Would you want me to do that?

Closes #36866

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36866 from tanvi-jagtap:fix_secure_endpoint_gpr_should 556006c720
PiperOrigin-RevId: 641939641
2024-06-10 10:16:54 -07:00
Tanvi Jagtap 203f2b4d16 [Gpr_To_Absl_Logging] Replace gpr_should_log with ABSL_VLOG_IS_ON (#36861)
[Gpr_To_Absl_Logging] Removing instances of gpr_should_log.
Replacing it with ABSL_VLOG_IS_ON.
VLOG(2) is equivalent to gpr_log(GPR_DEBUG, ... )
This function will be deprecated and deleted soon.

Closes #36861

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36861 from tanvi-jagtap:gpr_should_log_DEBUG_replace 09cd39e05a
PiperOrigin-RevId: 641939617
2024-06-10 10:14:14 -07:00
Tanvi Jagtap 42648a6fdf [Gpr_To_Absl_Logging] Replace gpr_should_log with ABSL_VLOG_IS_ON (#36868)
[Gpr_To_Absl_Logging] Removing instances of gpr_should_log and replacing it with ABSL_VLOG_IS_ON.
gpr_should_log function will be deleted soon.

**VLOG(2)** is equivalent to gpr_log(**GPR_DEBUG**, ... )

We are replacing two instances of **gpr_log(GPR_INFO**, ... ) with **VLOG(2)** because this code appears to be slightly expensive.
I can also continue to use LOG(INFO) and check current settings using absl::MinLogLevel() . Would you want me to do that?

Closes #36868

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36868 from tanvi-jagtap:fix_tcp_windows_gpr_should_log c2b660d4e2
PiperOrigin-RevId: 641938430
2024-06-10 10:07:00 -07:00
Tanvi Jagtap cd595a8794 [Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_set_log_function (#36844)
[Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_set_log_function

Adding a warning for users of gpr_set_log_function.

This function will be deleted soon.
https://github.com/grpc/proposal/pull/425

Other options considered ( and discarded )
1. Using DFATAL instead of ERROR. Discarded this because we still have one critical unit test to clean up before we delete gpr_set_log_function. This test will fail if we use DFATAL. EXPECT_DFATAL macro is not available to be used.
2. Considered making a new absl log sink , and then that log sink should have a function pointer with the same signature as gpr_log_func. This function pointer can be set from gpr_set_log_function. However if this custom function uses absl from within it, that will cause infinite recursion. Made me drop the idea.

Closes #36844

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36844 from tanvi-jagtap:assert_gpr_set_log_function 805de358a9
PiperOrigin-RevId: 641473969
2024-06-08 01:50:52 -07:00
Craig Tiller e6e2f1e1cb [server_call_test] fix compilation (#36856)
Closes #36856

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36856 from ctiller:ct b62ab66318
PiperOrigin-RevId: 641447391
2024-06-07 22:44:07 -07:00
AJ Heller b1c3b5ddfe [CI] Add clang-cl build to CI (#36840)
This adds a clang-cl Windows build to the set of Github presubmit jobs. It builds the codebase with strict warnings enabled, including thread annotation checks, and the rest of diagnostics we've been missing on Windows.

Here's [a successful run](https://btx.cloud.google.com/invocations/448792b6-3cff-4987-975a-af5e19526fc0/targets/grpc%2Fcore%2Fpull_request%2Fwindows%2Fgrpc_basictests_c/log) of the script (hijacking the C basic tests kokoro job, ignore that bit)

Closes #36840

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36840 from drfloob:kokoro-grpc-win-clangcl f15c8c5626
PiperOrigin-RevId: 641330117
2024-06-07 12:51:18 -07:00
Xuan Wang 4f3fba65fb
[Python CSM] Add example for CSM O11Y (#36829)
Verified that when following User Guide, we're able to collect metrics
and export to GCP.
Images are available at:
*
`us-docker.pkg.dev/grpc-testing/examples/csm-o11y-example-python-client:latest`
*
`us-docker.pkg.dev/grpc-testing/examples/csm-o11y-example-python-server:latest`
<!--

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.

-->
2024-06-07 11:20:23 -07:00
Craig Tiller 347f2a8a4b [chaotic-good] Fix fuzzer found crash in server transport code (#36852)
Closes #36852

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36852 from ctiller:f-st 5ffc88a71f
PiperOrigin-RevId: 641300922
2024-06-07 11:07:05 -07:00
Craig Tiller a07d3d09b7 [yodel] Make fuzzing timeouts much more lenient (#36853)
Fixes a fuzzing found "bug" in chaotic-good transport stress tests.

Built on #36848

Closes #36853

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36853 from ctiller:f-cg2 96d663f838
PiperOrigin-RevId: 641299634
2024-06-07 11:02:56 -07:00
AJ Heller c9fdef1317 [logging] Centralize configuration for trace flags (#36576)
All TraceFlags are now configured in `src/core/lib/debug/trace_flags.yaml`. The format is:

```
my_flag:
  default: false                   # the default value; default=false
  description: Some Description
  debug_only: false                # debug_only flags only work in debug builds; default=false
  internal: false                  # internal flags will not show up in documentation; default=false
```

To regenerate the trace flag source code, run `tools/codegen/core/gen_trace_flags.py` (requires mako). This script is also run when sanity checking.

This PR also adds two new features:

### Glob-based flag configuration

Trace flag configuration now supports `?` (single wildcard character) and `*` (one or more wildcard characters).  For example, using `GRPC_TRACE='event_engine*'` will enable all flags that match that glob. It expands to:

* event_engine
* event_engine_client_channel_resolver
* event_engine_dns
* event_engine_endpoint
* event_engine_endpoint_data
* event_engine_poller

### A cleaner trace-logging macro in abseil logging format

If your goal is only to add log statements when the `fault_injection_filter` trace flag is enabled, you can use the macro:

```
GRPC_TRACE_LOG(fault_injection, INFO) << "Filtered:" << 42;
```

When the trace flag is enabled, the the log will show something like this:
```
I0000 00:00:1715733657.430042      16 file.cc:174] Filtered:42
```

----

Note: just like with the gpr_log to abseil logging conversion, the pre-existing trace logging usages can be replaced with the new tracing macro across multiple PRs.

Closes #36576

PiperOrigin-RevId: 641295215
2024-06-07 10:47:38 -07:00
Tanvi Jagtap d63dcc188b [Gpr_To_Absl_Logging] Adding comment (#36846)
[Gpr_To_Absl_Logging] Adding comment

Closes #36846

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36846 from tanvi-jagtap:add_comment_no_logging 4a584d0d1d
PiperOrigin-RevId: 641284644
2024-06-07 10:12:55 -07:00
Craig Tiller b3de112b15 [call] Fix fuzzer found bug in client_call_test (#36848)
FuzzingEventEngine can add some big arbitrary delays -- account for that.

Closes #36848

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36848 from ctiller:f-cc af18b7a0cd
PiperOrigin-RevId: 641281105
2024-06-07 10:06:10 -07:00
Craig Tiller 322ef09202 Fix leak in server_call_test
PiperOrigin-RevId: 641280869
2024-06-07 10:01:44 -07:00
Arjan Singh Bal d038e0ed19 [Interop] Test grpc-go 1.64 using go 1.22 runtime (#36755)
Use the latest golang base image for Go interop tests. Presently the latest image points to Go 1.22.
<!--

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.

-->

## Commands run
To render the Dockerfile from its template
```sh
$ tools/buildgen/generate_projects.sh
```
To build and upload the base docker image.
```sh
$ tools/dockerfile/push_testing_images.sh
```

To build and upload the interop docker image for grpc-go 1.64.0
```sh
$ tools/interop_matrix/create_matrix_images.py --git_checkout --release=v1.64.0  --upload_images --language go
```

To verify the image is uploaded
```sh
$ gcloud container images list-tags gcr.io/grpc-testing/grpc_interop_go1.x
DIGEST        TAGS                                         TIMESTAMP
b36be4961ec4  infrastructure-public-image-v1.64.0,v1.64.0  2024-06-03T22:26:48
```

Verify the backward compatability tests pass
```sh
$ export docker_image=gcr.io/grpc-testing/grpc_interop_go1.x:v1.64.0
$ tools/interop_matrix/testcases/go__master
Testing gcr.io/grpc-testing/grpc_interop_go1.x:v1.64.0
```

Fixes: https://github.com/grpc/grpc/issues/36060

Closes #36755

PiperOrigin-RevId: 641272572
2024-06-07 09:31:49 -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 17517efee4
PiperOrigin-RevId: 641268299
2024-06-07 09:14:44 -07:00
Tanvi Jagtap bc6a1c6922 [grpc][Gpr_To_Absl_Logging] Supporting verbosity flag (#36798)
[grpc][Gpr_To_Absl_Logging]
1. Supporting the legacy GRPC_VERBOSITY environment variable in the new absl logging implementation.
2. Adding a new way to disable VLOG logging.
3. Documenting the recommendations clearly.
4. Editing the init code.

Additional Context :
Check function gpr_default_log() for more context
https://github.com/search?q=repo%3Agrpc%2Fgrpc%20gpr_default_log&type=code

Closes #36798

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36798 from tanvi-jagtap:grpc_verbosity_flag_support ab0d600849
PiperOrigin-RevId: 641092851
2024-06-06 19:08:32 -07:00
Eugene Ostroukhov 6f913025f2 [xds] Do not crash when XdsLocalityName is null (#36841)
Closes #36841

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36841 from eugeneo:b/342178799/ref-counted-crash b889c958ed
PiperOrigin-RevId: 641062572
2024-06-06 16:48:06 -07:00
AJ Heller 90975282dc [CI] Use 32 cores for clang-tidy CI job (#36838)
This task was parallelized into 16 sub-tasks, but 32 cores are available. Let's see if this speeds up CI, the clang-tidy job usually takes about 30m to 40m.

Closes #36838

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36838 from drfloob:tidy-32 81edd68348
PiperOrigin-RevId: 641014003
2024-06-06 14:07:35 -07:00
AJ Heller da05edc802 [build] Support clang-cl for Windows builds (best effort) (#36831)
Usage: `bazel build --config=clang-cl --build_tag_filters=-no_windows :all`

The highlight, for me anyway: thread safety annotation checking can now be done on Windows-only code.

clang-cl's interpretation of `-Wall` differs from that of clang on linux. This PR uses the set of warnings enabled on linux, and whittles down the list until all builds pass. I left comments in `copts.bzl` describing the warnings, many of which can be removed with targeted code cleanups.

Closes #36831

PiperOrigin-RevId: 641009783
2024-06-06 13:54:12 -07:00
AJ Heller 5d586d3ae3 [EventEngine] Fix race between connection and its deadline timer on Windows (#36709)
Closes #36709

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36709 from drfloob:fix-win-ee-use-after-free dd4ae2683e
PiperOrigin-RevId: 641000031
2024-06-06 13:25:20 -07:00
Doug Fawley 2e35d4aab5 doc: add A53 (ignore resource deletion) to xds features (#36714)
Noticed this feature was missing from the list, so I added it.

@murgatroid99 - is this supported in Node?  Let me know what version and I'll include it.

Closes #36714

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36714 from dfawley:a53 a1bb3605d4
PiperOrigin-RevId: 640982395
2024-06-06 12:23:50 -07:00
John Cormie e409ca652f [build] rename android platforms to match CPU arch (#36715)
Work around for https://github.com/bazelbuild/bazel/issues/15837#issuecomment-2127758141

Fixes a problem where the example client and server APKs would build but could not be installed (`INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries`)

Closes #36715

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36715 from jdcormie:android-platforms f71e994b14
PiperOrigin-RevId: 640938680
2024-06-06 10:20:05 -07:00
Xuan Wang 14d76aac59 [Python CSM] Fix interop client and server flag (#36827)
We changed the way flag was passed in this PR: https://github.com/grpc/psm-interop/pull/94
<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36827 from XuanWang-Amos:csm_fix_interop a2c2c47f30
PiperOrigin-RevId: 640908453
2024-06-06 08:36:53 -07:00
Vishwanath Sastry 60301d40e0 Addition of flag to enable end2end fuzzers
PiperOrigin-RevId: 640866680
2024-06-06 05:47:45 -07:00
Tanvi Jagtap 8c6be41434 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36816)
[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.

Closes #36816

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36816 from tanvi-jagtap:gpr_assert_removal 9db548beb0
PiperOrigin-RevId: 640731171
2024-06-05 19:27:53 -07:00
Hannah Shi 687b31d7c7 [ObjC] default GRPC_IOS_EVENT_ENGINE_CLIENT to 1 (#36785)
It's still possible to define GRPC_IOS_EVENT_ENGINE_CLIENT=0 to disable event engine for iOS.

Closes #36785

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36785 from HannahShiSFB:default-to-event-engine-in-ios 441fe552a6
PiperOrigin-RevId: 640716651
2024-06-05 18:26:38 -07:00
Craig Tiller 51d1d7ca1b [thready-tsan] Make sure the DNS resolver can complete callbacks (#36825)
Closes #36825

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36825 from ctiller:csc 53928bdcb1
PiperOrigin-RevId: 640689749
2024-06-05 16:42:22 -07:00
Esun Kim 6814867e78 [CI] Updated clang docker images to use Debian 12 (#36810)
All clang docker images here are based on Debian 11 (Bullseye) but now we're moving to Debian 12 (Bookworm) primarily to use the recent versions of Cmake >= 3.20 to use CXX_STANDARD=23 for some tests ([doc](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html))

Closes #36810

PiperOrigin-RevId: 640688681
2024-06-05 16:38:08 -07:00
Craig Tiller 242a83b6d8 [gcc-7] Fix for dump-args (#36824)
Closes #36824

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36824 from ctiller:old-gcc 3b58efe98e
PiperOrigin-RevId: 640684291
2024-06-05 16:22:05 -07:00
456 changed files with 10500 additions and 6226 deletions

4
.gitattributes vendored
View File

@ -35,3 +35,7 @@ src/core/lib/experiments/experiments.h linguist-generated=true
src/core/lib/experiments/experiments.cc linguist-generated=true
bazel/experiments.bzl linguist-generated=true
test/cpp/microbenchmarks/huffman_geometries/** linguist-generated=true
doc/trace_flags.md linguist-generated=true
src/core/lib/debug/trace_flags.h linguist-generated=true
src/core/lib/debug/trace_flags.cc linguist-generated=true
src/python/grpcio_observability/observability_lib_deps.py linguist-generated=true

89
BUILD
View File

@ -19,6 +19,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load(
"//bazel:grpc_build_system.bzl",
"grpc_cc_library",
"grpc_clang_cl_settings",
"grpc_filegroup",
"grpc_generate_one_off_targets",
"grpc_upb_proto_library",
@ -66,29 +67,7 @@ bool_flag(
build_setting_default = False,
)
platform(
name = "android_x86_64",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_64",
],
)
platform(
name = "android_arm64",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:arm64",
],
)
platform(
name = "android_armv7",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:armv7",
],
)
grpc_clang_cl_settings()
config_setting(
name = "grpc_no_rls_flag",
@ -240,12 +219,17 @@ config_setting(
values = {"define": "use_strict_warning=true"},
)
config_setting(
name = "use_strict_warning_windows",
values = {"define": "use_strict_warning_windows=true"},
)
python_config_settings()
# This should be updated along with build_handwritten.yaml
g_stands_for = "gnarly" # @unused
core_version = "41.0.0" # @unused
core_version = "42.0.0" # @unused
version = "1.65.0-dev" # @unused
@ -1424,17 +1408,6 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "call_trace",
hdrs = [
"//src/core:lib/surface/call_trace.h",
],
language = "c++",
deps = [
"grpc_trace",
],
)
grpc_cc_library(
name = "dynamic_annotations",
hdrs = [
@ -1503,9 +1476,6 @@ grpc_cc_library(
grpc_cc_library(
name = "api_trace",
srcs = [
"//src/core:lib/surface/api_trace.cc",
],
hdrs = [
"//src/core:lib/surface/api_trace.h",
],
@ -1552,7 +1522,6 @@ grpc_cc_library(
"//src/core:lib/iomgr/ev_epoll1_linux.cc",
"//src/core:lib/iomgr/ev_poll_posix.cc",
"//src/core:lib/iomgr/ev_posix.cc",
"//src/core:lib/iomgr/ev_windows.cc",
"//src/core:lib/iomgr/fork_posix.cc",
"//src/core:lib/iomgr/fork_windows.cc",
"//src/core:lib/iomgr/gethostname_fallback.cc",
@ -1730,7 +1699,6 @@ grpc_cc_library(
"//src/core:posix_event_engine_endpoint",
"//src/core:resolved_address",
"//src/core:resource_quota",
"//src/core:resource_quota_trace",
"//src/core:slice",
"//src/core:slice_buffer",
"//src/core:slice_cast",
@ -2065,7 +2033,6 @@ grpc_cc_library(
deps = [
"api_trace",
"call_combiner",
"call_trace",
"call_tracer",
"channel",
"channel_arg_names",
@ -2102,7 +2069,6 @@ grpc_cc_library(
"//src/core:channel_args_preconditioning",
"//src/core:channel_fwd",
"//src/core:channel_init",
"//src/core:channel_stack_trace",
"//src/core:channel_stack_type",
"//src/core:closure",
"//src/core:compression",
@ -2132,7 +2098,6 @@ grpc_cc_library(
"//src/core:pipe",
"//src/core:poll",
"//src/core:promise_status",
"//src/core:promise_trace",
"//src/core:race",
"//src/core:ref_counted",
"//src/core:seq",
@ -2328,7 +2293,6 @@ grpc_cc_library(
visibility = ["@grpc:public"],
deps = [
"api_trace",
"call_trace",
"channel_arg_names",
"channelz",
"config",
@ -2364,7 +2328,6 @@ grpc_cc_library(
"//src/core:poll",
"//src/core:ref_counted",
"//src/core:resource_quota",
"//src/core:resource_quota_trace",
"//src/core:seq",
"//src/core:slice",
"//src/core:slice_refcount",
@ -2987,6 +2950,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
":grpc++",
"//src/cpp/ext/otel:otel_plugin",
],
)
@ -3022,11 +2986,19 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc_trace",
srcs = ["//src/core:lib/debug/trace.cc"],
hdrs = ["//src/core:lib/debug/trace.h"],
srcs = [
"//src/core:lib/debug/trace.cc",
"//src/core:lib/debug/trace_flags.cc",
],
hdrs = [
"//src/core:lib/debug/trace.h",
"//src/core:lib/debug/trace_flags.h",
"//src/core:lib/debug/trace_impl.h",
],
external_deps = [
"absl/log:log",
"absl/log",
"absl/strings",
"absl/container:flat_hash_map",
],
language = "c++",
visibility = ["@grpc:trace"],
@ -3034,6 +3006,8 @@ grpc_cc_library(
"config_vars",
"gpr",
"grpc_public_hdrs",
"//src/core:glob",
"//src/core:no_destruct",
],
)
@ -4330,7 +4304,6 @@ grpc_cc_library(
language = "c++",
visibility = ["@grpc:http"],
deps = [
"call_trace",
"call_tracer",
"channel_arg_names",
"config",
@ -4547,20 +4520,6 @@ grpc_cc_library(
deps = ["gpr"],
)
grpc_cc_library(
name = "http_trace",
srcs = [
"//src/core:ext/transport/chttp2/transport/http_trace.cc",
],
hdrs = [
"//src/core:ext/transport/chttp2/transport/http_trace.h",
],
deps = [
"gpr_platform",
"grpc_trace",
],
)
grpc_cc_library(
name = "hpack_parser_table",
srcs = [
@ -4581,7 +4540,6 @@ grpc_cc_library(
"gpr_platform",
"grpc_trace",
"hpack_parse_result",
"http_trace",
"//src/core:hpack_constants",
"//src/core:metadata_batch",
"//src/core:no_destruct",
@ -4684,7 +4642,6 @@ grpc_cc_library(
"grpc_base",
"grpc_public_hdrs",
"grpc_trace",
"http_trace",
"//src/core:hpack_constants",
"//src/core:hpack_encoder_table",
"//src/core:metadata_batch",
@ -4817,7 +4774,6 @@ grpc_cc_library(
"hpack_encoder",
"hpack_parser",
"hpack_parser_table",
"http_trace",
"httpcli",
"iomgr",
"iomgr_buffer_list",
@ -4854,7 +4810,6 @@ grpc_cc_library(
"//src/core:random_early_detection",
"//src/core:ref_counted",
"//src/core:resource_quota",
"//src/core:resource_quota_trace",
"//src/core:slice",
"//src/core:slice_buffer",
"//src/core:slice_refcount",

381
CMakeLists.txt generated

File diff suppressed because it is too large Load Diff

20
Makefile generated
View File

@ -367,7 +367,7 @@ E = @echo
Q = @
endif
CORE_VERSION = 41.0.0
CORE_VERSION = 42.0.0
CPP_VERSION = 1.65.0-dev
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
@ -404,7 +404,7 @@ SHARED_EXT_CORE = dll
SHARED_EXT_CPP = dll
SHARED_PREFIX =
SHARED_VERSION_CORE = -41
SHARED_VERSION_CORE = -42
SHARED_VERSION_CPP = -1
else ifeq ($(SYSTEM),Darwin)
EXECUTABLE_SUFFIX =
@ -724,7 +724,6 @@ LIBGRPC_SRC = \
src/core/ext/transport/chttp2/transport/hpack_parser.cc \
src/core/ext/transport/chttp2/transport/hpack_parser_table.cc \
src/core/ext/transport/chttp2/transport/http2_settings.cc \
src/core/ext/transport/chttp2/transport/http_trace.cc \
src/core/ext/transport/chttp2/transport/huffsyms.cc \
src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc \
src/core/ext/transport/chttp2/transport/parsing.cc \
@ -735,7 +734,6 @@ LIBGRPC_SRC = \
src/core/ext/transport/chttp2/transport/varint.cc \
src/core/ext/transport/chttp2/transport/write_size_policy.cc \
src/core/ext/transport/chttp2/transport/writing.cc \
src/core/ext/transport/inproc/inproc_plugin.cc \
src/core/ext/transport/inproc/inproc_transport.cc \
src/core/ext/transport/inproc/legacy_inproc_transport.cc \
src/core/ext/upb-gen/envoy/admin/v3/certs.upb_minitable.c \
@ -1073,7 +1071,6 @@ LIBGRPC_SRC = \
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
src/core/lib/channel/channel_stack_builder_impl.cc \
src/core/lib/channel/channel_stack_trace.cc \
src/core/lib/channel/connected_channel.cc \
src/core/lib/channel/promise_based_filter.cc \
src/core/lib/channel/status_util.cc \
@ -1086,6 +1083,7 @@ LIBGRPC_SRC = \
src/core/lib/config/load_config.cc \
src/core/lib/debug/event_log.cc \
src/core/lib/debug/trace.cc \
src/core/lib/debug/trace_flags.cc \
src/core/lib/event_engine/ares_resolver.cc \
src/core/lib/event_engine/cf_engine/cf_engine.cc \
src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc \
@ -1124,7 +1122,6 @@ LIBGRPC_SRC = \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/trace.cc \
src/core/lib/event_engine/utils.cc \
src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc \
src/core/lib/event_engine/windows/iocp.cc \
@ -1140,6 +1137,7 @@ LIBGRPC_SRC = \
src/core/lib/gprpp/dump_args.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
src/core/lib/gprpp/glob.cc \
src/core/lib/gprpp/host_port.cc \
src/core/lib/gprpp/linux/env.cc \
src/core/lib/gprpp/load_file.cc \
@ -1179,7 +1177,6 @@ LIBGRPC_SRC = \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
src/core/lib/iomgr/event_engine_shims/closure.cc \
src/core/lib/iomgr/event_engine_shims/endpoint.cc \
src/core/lib/iomgr/event_engine_shims/tcp_client.cc \
@ -1244,7 +1241,6 @@ LIBGRPC_SRC = \
src/core/lib/promise/activity.cc \
src/core/lib/promise/party.cc \
src/core/lib/promise/sleep.cc \
src/core/lib/promise/trace.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/connection_quota.cc \
@ -1252,7 +1248,6 @@ LIBGRPC_SRC = \
src/core/lib/resource_quota/periodic_update.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \
src/core/lib/resource_quota/trace.cc \
src/core/lib/security/authorization/audit_logging.cc \
src/core/lib/security/authorization/authorization_policy_provider_vtable.cc \
src/core/lib/security/authorization/evaluate_args.cc \
@ -1318,9 +1313,7 @@ LIBGRPC_SRC = \
src/core/lib/slice/percent_encoding.cc \
src/core/lib/slice/slice.cc \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/surface/api_trace.cc \
src/core/lib/surface/byte_buffer.cc \
src/core/lib/surface/byte_buffer_reader.cc \
src/core/lib/surface/call.cc \
@ -1411,7 +1404,6 @@ LIBGRPC_SRC = \
src/core/resolver/sockaddr/sockaddr_resolver.cc \
src/core/resolver/xds/xds_dependency_manager.cc \
src/core/resolver/xds/xds_resolver.cc \
src/core/resolver/xds/xds_resolver_trace.cc \
src/core/server/server.cc \
src/core/server/server_call_tracer_filter.cc \
src/core/server/server_config_selector_filter.cc \
@ -1841,8 +1833,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_
ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libcares.a $(OPENSSL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.41 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libcares.a $(OPENSSL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.41
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.42 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libcares.a $(OPENSSL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.42
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so
endif
endif

21
Package.swift generated
View File

@ -237,8 +237,6 @@ let package = Package(
"src/core/ext/transport/chttp2/transport/hpack_parser_table.h",
"src/core/ext/transport/chttp2/transport/http2_settings.cc",
"src/core/ext/transport/chttp2/transport/http2_settings.h",
"src/core/ext/transport/chttp2/transport/http_trace.cc",
"src/core/ext/transport/chttp2/transport/http_trace.h",
"src/core/ext/transport/chttp2/transport/huffsyms.cc",
"src/core/ext/transport/chttp2/transport/huffsyms.h",
"src/core/ext/transport/chttp2/transport/internal.h",
@ -258,7 +256,6 @@ let package = Package(
"src/core/ext/transport/chttp2/transport/write_size_policy.cc",
"src/core/ext/transport/chttp2/transport/write_size_policy.h",
"src/core/ext/transport/chttp2/transport/writing.cc",
"src/core/ext/transport/inproc/inproc_plugin.cc",
"src/core/ext/transport/inproc/inproc_transport.cc",
"src/core/ext/transport/inproc/inproc_transport.h",
"src/core/ext/transport/inproc/legacy_inproc_transport.cc",
@ -1103,8 +1100,6 @@ let package = Package(
"src/core/lib/channel/channel_stack_builder.h",
"src/core/lib/channel/channel_stack_builder_impl.cc",
"src/core/lib/channel/channel_stack_builder_impl.h",
"src/core/lib/channel/channel_stack_trace.cc",
"src/core/lib/channel/channel_stack_trace.h",
"src/core/lib/channel/connected_channel.cc",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/promise_based_filter.cc",
@ -1127,6 +1122,9 @@ let package = Package(
"src/core/lib/debug/event_log.h",
"src/core/lib/debug/trace.cc",
"src/core/lib/debug/trace.h",
"src/core/lib/debug/trace_flags.cc",
"src/core/lib/debug/trace_flags.h",
"src/core/lib/debug/trace_impl.h",
"src/core/lib/event_engine/ares_resolver.cc",
"src/core/lib/event_engine/ares_resolver.h",
"src/core/lib/event_engine/cf_engine/cf_engine.cc",
@ -1219,7 +1217,6 @@ let package = Package(
"src/core/lib/event_engine/thready_event_engine/thready_event_engine.h",
"src/core/lib/event_engine/time_util.cc",
"src/core/lib/event_engine/time_util.h",
"src/core/lib/event_engine/trace.cc",
"src/core/lib/event_engine/trace.h",
"src/core/lib/event_engine/utils.cc",
"src/core/lib/event_engine/utils.h",
@ -1262,6 +1259,8 @@ let package = Package(
"src/core/lib/gprpp/examine_stack.h",
"src/core/lib/gprpp/fork.cc",
"src/core/lib/gprpp/fork.h",
"src/core/lib/gprpp/glob.cc",
"src/core/lib/gprpp/glob.h",
"src/core/lib/gprpp/host_port.cc",
"src/core/lib/gprpp/host_port.h",
"src/core/lib/gprpp/if_list.h",
@ -1351,7 +1350,6 @@ let package = Package(
"src/core/lib/iomgr/ev_poll_posix.h",
"src/core/lib/iomgr/ev_posix.cc",
"src/core/lib/iomgr/ev_posix.h",
"src/core/lib/iomgr/ev_windows.cc",
"src/core/lib/iomgr/event_engine_shims/closure.cc",
"src/core/lib/iomgr/event_engine_shims/closure.h",
"src/core/lib/iomgr/event_engine_shims/endpoint.cc",
@ -1494,8 +1492,6 @@ let package = Package(
"src/core/lib/promise/sleep.cc",
"src/core/lib/promise/sleep.h",
"src/core/lib/promise/status_flag.h",
"src/core/lib/promise/trace.cc",
"src/core/lib/promise/trace.h",
"src/core/lib/promise/try_join.h",
"src/core/lib/promise/try_seq.h",
"src/core/lib/resource_quota/api.cc",
@ -1512,8 +1508,6 @@ let package = Package(
"src/core/lib/resource_quota/resource_quota.h",
"src/core/lib/resource_quota/thread_quota.cc",
"src/core/lib/resource_quota/thread_quota.h",
"src/core/lib/resource_quota/trace.cc",
"src/core/lib/resource_quota/trace.h",
"src/core/lib/security/authorization/audit_logging.cc",
"src/core/lib/security/authorization/audit_logging.h",
"src/core/lib/security/authorization/authorization_engine.h",
@ -1642,11 +1636,9 @@ let package = Package(
"src/core/lib/slice/slice_buffer.cc",
"src/core/lib/slice/slice_buffer.h",
"src/core/lib/slice/slice_internal.h",
"src/core/lib/slice/slice_refcount.cc",
"src/core/lib/slice/slice_refcount.h",
"src/core/lib/slice/slice_string_helpers.cc",
"src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.cc",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/byte_buffer.cc",
"src/core/lib/surface/byte_buffer_reader.cc",
@ -1655,7 +1647,6 @@ let package = Package(
"src/core/lib/surface/call_details.cc",
"src/core/lib/surface/call_log_batch.cc",
"src/core/lib/surface/call_test_only.h",
"src/core/lib/surface/call_trace.h",
"src/core/lib/surface/call_utils.cc",
"src/core/lib/surface/call_utils.h",
"src/core/lib/surface/channel.cc",
@ -1823,8 +1814,6 @@ let package = Package(
"src/core/resolver/xds/xds_dependency_manager.h",
"src/core/resolver/xds/xds_resolver.cc",
"src/core/resolver/xds/xds_resolver_attributes.h",
"src/core/resolver/xds/xds_resolver_trace.cc",
"src/core/resolver/xds/xds_resolver_trace.h",
"src/core/server/server.cc",
"src/core/server/server.h",
"src/core/server/server_call_tracer_filter.cc",

View File

@ -4,16 +4,27 @@ This guide is for troubleshooting gRPC implementations based on C core library (
## Enabling extra logging and tracing
Extra logging can be very useful for diagnosing problems. All gRPC implementations based on C core library support
the `GRPC_VERBOSITY` and `GRPC_TRACE` environment variables that can be used to increase the amount of information
Extra logging can be very useful for diagnosing problems. It can be used to increase the amount of information
that gets printed to stderr.
## GRPC_VERBOSITY
`GRPC_VERBOSITY` is used to set the minimum level of log messages printed by gRPC (supported values are `DEBUG`, `INFO` and `ERROR`). If this environment variable is unset, only `ERROR` logs will be printed.
<!-- BEGIN_GOOGLE_INTERNAL_DOCUMENTATION
GRPC_VERBOSITY has been disabled for internal usage and will not work anymore.
If anyone wants to debug, we need to set verbose logs using absl.
END_GOOGLE_INTERNAL_DOCUMENTATION -->
<!-- BEGIN_OPEN_SOURCE_DOCUMENTATION -->
`GRPC_VERBOSITY` is used to set the minimum level of log messages printed by gRPC (supported values are `DEBUG`, `INFO` and `ERROR`). If this environment variable is unset, only `ERROR` logs will be printed. `ERROR` is recomeded for production systems.
<!-- END_OPEN_SOURCE_DOCUMENTATION -->
## GRPC_TRACE
<!-- BEGIN_GOOGLE_INTERNAL_DOCUMENTATION
GRPC_VERBOSITY has been disabled for internal usage and will not work anymore.
If anyone wants to debug, we need to set verbose logs using absl.
END_GOOGLE_INTERNAL_DOCUMENTATION -->
`GRPC_TRACE` can be used to enable extra logging for some internal gRPC components. Enabling the right traces can be invaluable
for diagnosing for what is going wrong when things aren't working as intended. Possible values for `GRPC_TRACE` are listed in [Environment Variables Overview](doc/environment_variables.md).
Multiple traces can be enabled at once (use comma as separator).

View File

@ -128,6 +128,12 @@ load("@com_github_google_benchmark//:bazel/benchmark_deps.bzl", "benchmark_deps"
benchmark_deps()
# This is a transitive dependency from google_cloud_cpp
bind(
name = "cares",
actual = "@com_github_cares_cares//:ares",
)
load("@io_opentelemetry_cpp//bazel:repository.bzl", "opentelemetry_cpp_deps")
opentelemetry_cpp_deps()
@ -136,6 +142,12 @@ load("@io_opentelemetry_cpp//bazel:extra_deps.bzl", "opentelemetry_extra_deps")
opentelemetry_extra_deps()
# Transitive dependency of opentelemetry_extra_deps()
bind(
name = "madler_zlib",
actual = "@zlib//:zlib",
)
# TODO: Enable below once https://github.com/bazel-xcode/PodToBUILD/issues/232 is resolved
#
#http_archive(

View File

@ -57,7 +57,107 @@ GRPC_LLVM_WARNING_FLAGS = [
"-Wno-unused-function",
]
GRPC_LLVM_WINDOWS_WARNING_FLAGS = GRPC_LLVM_WARNING_FLAGS + [
### Some checks that are missing with clang-cl
"-Wthread-safety",
"-Wreorder-ctor",
### Avoid some checks that are default on clang-cl
"-Wno-c++98-compat-pedantic",
"-Wno-missing-prototypes",
"-Wno-thread-safety-precise", # too many aliases
# abseil offenses
"-Wno-comma",
"-Wno-deprecated-redundant-constexpr-static-def",
"-Wno-deprecated", # remove when the above works in all clang versions we test with
"-Wno-float-equal",
"-Wno-gcc-compat",
"-Wno-reserved-identifier",
"-Wno-thread-safety-negative",
"-Wno-sign-compare",
# re2 offenses
"-Wno-zero-as-null-pointer-constant",
# ares offenses
"-Wno-macro-redefined",
# protobuf offenses
"-Wno-cast-align",
"-Wno-inconsistent-missing-destructor-override",
# xxhash offenses
"-Wno-disabled-macro-expansion",
# benchmark offenses
"-Wno-shift-sign-overflow",
# Evidently nodiscard is inappropriately pinned as a C++17 feature
"-Wno-c++17-attribute-extensions",
# declarations are not used in many places
"-Wno-missing-variable-declarations",
# TODO: delete iomgr
"-Wno-old-style-cast",
"-Wno-cast-qual",
"-Wno-unused-member-function",
"-Wno-unused-template",
# TODO(hork): see if the TraceFlag offense can be removed
"-Wno-global-constructors",
# TODO(hork): clean up EE offenses
"-Wno-missing-field-initializers",
"-Wno-non-virtual-dtor",
"-Wno-thread-safety-reference-return",
# TODO(ctiller): offense: dump_args. signed to unsigned
"-Wno-sign-conversion",
"-Wno-shorten-64-to-32",
# TODO: general cleanup required. Maybe new developer or rainy day projects.
"-Wno-unreachable-code-break",
"-Wno-unreachable-code-return",
"-Wno-unreachable-code",
"-Wno-used-but-marked-unused",
"-Wno-newline-eof",
"-Wno-unused-const-variable",
"-Wno-extra-semi",
"-Wno-extra-semi-stmt",
"-Wno-suggest-destructor-override",
"-Wno-shadow",
"-Wno-missing-noreturn",
"-Wno-nested-anon-types",
"-Wno-gnu-anonymous-struct",
"-Wno-nonportable-system-include-path",
"-Wno-microsoft-cast",
"-Wno-exit-time-destructors",
"-Wno-undef", # #if <MACRO_NAME> to #ifdef <MACRO_NAME>
"-Wno-unused-macros",
"-Wno-redundant-parens",
"-Wno-undefined-func-template",
"-Wno-gnu-zero-variadic-macro-arguments",
"-Wno-double-promotion",
"-Wno-implicit-float-conversion",
"-Wno-implicit-int-conversion",
"-Wno-float-conversion",
"-Wno-unused-parameter",
"-Wno-suggest-override",
"-Wno-documentation",
"-Wno-documentation-unknown-command",
"-Wno-unsafe-buffer-usage",
### possibly bad warnings for this codebase
"-Wno-covered-switch-default",
"-Wno-switch-default",
"-Wno-switch-enum",
"-Wno-c99-extensions",
"-Wno-unused-private-field", # GRPC_UNUSED does not appear to work for private fields
]
GRPC_DEFAULT_COPTS = select({
"//:use_strict_warning": GRPC_LLVM_WARNING_FLAGS + ["-DUSE_STRICT_WARNING=1"],
"//:use_strict_warning_windows": GRPC_LLVM_WINDOWS_WARNING_FLAGS + ["-DUSE_STRICT_WARNING=1"],
"//conditions:default": [],
})

12
bazel/experiments.bzl generated
View File

@ -41,7 +41,7 @@ EXPERIMENT_ENABLES = {
"trace_record_callops": "trace_record_callops",
"unconstrained_max_quota_buffer_size": "unconstrained_max_quota_buffer_size",
"work_serializer_clears_time_cache": "work_serializer_clears_time_cache",
"work_serializer_dispatch": "event_engine_client,work_serializer_dispatch",
"work_serializer_dispatch": "work_serializer_dispatch",
}
EXPERIMENT_POLLERS = [
@ -55,16 +55,10 @@ EXPERIMENTS = {
"dbg": {
},
"off": {
"core_end2end_test": [
"event_engine_client",
],
"endpoint_test": [
"tcp_frame_size_tuning",
"tcp_rcv_lowat",
],
"event_engine_client_test": [
"event_engine_client",
],
"flow_control_test": [
"multiping",
"peer_state_based_framing",
@ -82,11 +76,15 @@ EXPERIMENTS = {
"event_engine_dns",
],
"core_end2end_test": [
"event_engine_client",
"event_engine_listener",
],
"cpp_lb_end2end_test": [
"pick_first_new",
],
"event_engine_client_test": [
"event_engine_client",
],
"event_engine_listener_test": [
"event_engine_listener",
],

View File

@ -45,6 +45,7 @@ def if_not_windows(a):
return select({
"//:windows": [],
"//:windows_msvc": [],
"//:windows_clang": [],
"//conditions:default": a,
})
@ -52,6 +53,7 @@ def if_windows(a):
return select({
"//:windows": a,
"//:windows_msvc": a,
"//:windows_clang": a,
"//conditions:default": [],
})
@ -67,7 +69,7 @@ def _get_external_deps(external_deps):
elif dep == "cares":
ret += select({
"//:grpc_no_ares": [],
"//conditions:default": ["//external:cares"],
"//conditions:default": ["//third_party:cares"],
})
elif dep == "cronet_c_for_grpc":
ret.append("//third_party/objective_c/Cronet:cronet_c_for_grpc")
@ -82,7 +84,7 @@ def _get_external_deps(external_deps):
elif dep == "libprotobuf_mutator":
ret.append("@com_google_libprotobuf_mutator//:libprotobuf_mutator")
else:
ret.append("//external:" + dep)
ret.append("//third_party:" + dep)
return ret
def _update_visibility(visibility):
@ -802,3 +804,22 @@ def python_config_settings():
name = "python3",
flag_values = {"@bazel_tools//tools/python:python_version": "PY3"},
)
# buildifier: disable=unnamed-macro
def grpc_clang_cl_settings():
native.platform(
name = "x64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)
native.config_setting(
name = "windows_clang",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)

View File

@ -14,167 +14,12 @@
"""Load dependencies needed to compile and test the grpc library as a 3rd-party consumer."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
load("//bazel:grpc_python_deps.bzl", "grpc_python_deps")
# buildifier: disable=unnamed-macro
def grpc_deps():
"""Loads dependencies need to compile and test the grpc library."""
native.bind(
name = "libssl",
actual = "@boringssl//:ssl",
)
native.bind(
name = "libcrypto",
actual = "@boringssl//:crypto",
)
native.bind(
name = "madler_zlib",
actual = "@zlib//:zlib",
)
native.bind(
name = "protobuf",
actual = "@com_google_protobuf//:protobuf",
)
native.bind(
name = "protobuf_clib",
actual = "@com_google_protobuf//:protoc_lib",
)
native.bind(
name = "protobuf_headers",
actual = "@com_google_protobuf//:protobuf_headers",
)
native.bind(
name = "protocol_compiler",
actual = "@com_google_protobuf//:protoc",
)
native.bind(
name = "cares",
actual = "@com_github_cares_cares//:ares",
)
native.bind(
name = "gtest",
actual = "@com_google_googletest//:gtest",
)
native.bind(
name = "fuzztest",
actual = "@com_google_fuzztest//fuzztest",
)
native.bind(
name = "fuzztest_main",
actual = "@com_google_fuzztest//fuzztest:fuzztest_gtest_main",
)
native.bind(
name = "benchmark",
actual = "@com_github_google_benchmark//:benchmark",
)
native.bind(
name = "re2",
actual = "@com_googlesource_code_re2//:re2",
)
native.bind(
name = "grpc_cpp_plugin",
actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
)
native.bind(
name = "grpc++_codegen_proto",
actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
)
native.bind(
name = "opencensus-context",
actual = "@io_opencensus_cpp//opencensus/context:context",
)
native.bind(
name = "opencensus-trace",
actual = "@io_opencensus_cpp//opencensus/trace:trace",
)
native.bind(
name = "opencensus-trace-context_util",
actual = "@io_opencensus_cpp//opencensus/trace:context_util",
)
native.bind(
name = "opencensus-trace-propagation",
actual = "@io_opencensus_cpp//opencensus/trace:grpc_trace_bin",
)
native.bind(
name = "opencensus-trace-span_context",
actual = "@io_opencensus_cpp//opencensus/trace:span_context",
)
native.bind(
name = "opencensus-stats",
actual = "@io_opencensus_cpp//opencensus/stats:stats",
)
native.bind(
name = "opencensus-stats-test",
actual = "@io_opencensus_cpp//opencensus/stats:test_utils",
)
native.bind(
name = "opencensus-with-tag-map",
actual = "@io_opencensus_cpp//opencensus/tags:with_tag_map",
)
native.bind(
name = "opencensus-tags",
actual = "@io_opencensus_cpp//opencensus/tags:tags",
)
native.bind(
name = "opencensus-tags-context_util",
actual = "@io_opencensus_cpp//opencensus/tags:context_util",
)
native.bind(
name = "opencensus-trace-stackdriver_exporter",
actual = "@io_opencensus_cpp//opencensus/exporters/trace/stackdriver:stackdriver_exporter",
)
native.bind(
name = "opencensus-stats-stackdriver_exporter",
actual = "@io_opencensus_cpp//opencensus/exporters/stats/stackdriver:stackdriver_exporter",
)
native.bind(
name = "googleapis_trace_grpc_service",
actual = "@com_google_googleapis//google/devtools/cloudtrace/v2:cloudtrace_cc_grpc",
)
native.bind(
name = "googleapis_monitoring_grpc_service",
actual = "@com_google_googleapis//google/monitoring/v3:monitoring_cc_grpc",
)
native.bind(
name = "googleapis_logging_grpc_service",
actual = "@com_google_googleapis//google/logging/v2:logging_cc_grpc",
)
native.bind(
name = "googleapis_logging_cc_proto",
actual = "@com_google_googleapis//google/logging/v2:logging_cc_proto",
)
if "platforms" not in native.existing_rules():
http_archive(
name = "platforms",
@ -222,6 +67,7 @@ def grpc_deps():
],
patches = [
"@com_github_grpc_grpc//third_party:protobuf.patch",
"@com_github_grpc_grpc//third_party:protobuf.10007.patch",
],
patch_args = ["-p1"],
)
@ -495,15 +341,6 @@ def grpc_test_only_deps():
Loads dependencies that are only needed to run grpc library's tests.
"""
native.bind(
name = "twisted",
actual = "@com_github_twisted_twisted//:twisted",
)
native.bind(
name = "yaml",
actual = "@com_github_yaml_pyyaml//:yaml",
)
if "com_github_twisted_twisted" not in native.existing_rules():
http_archive(

View File

@ -0,0 +1,37 @@
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
platform(
name = "x86_64",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:x86_64",
],
)
platform(
name = "arm64-v8a",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:arm64",
],
)
platform(
name = "armeabi-v7a",
constraint_values = [
"@platforms//os:android",
"@platforms//cpu:armv7",
],
)

412
build_autogenerated.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -13,5 +13,5 @@
# limitations under the License.
module GrpcBuildConfig
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-41.dll'
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-42.dll'
end

View File

@ -12,7 +12,7 @@ settings:
'#08': Use "-preN" suffixes to identify pre-release versions
'#09': Per-language overrides are possible with (eg) ruby_version tag here
'#10': See the expand_version.py for all the quirks here
core_version: 41.0.0
core_version: 42.0.0
csharp_major_version: 2
g_stands_for: gnarly
protobuf_version: 3.26.1

12
config.m4 generated
View File

@ -99,7 +99,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/transport/chttp2/transport/hpack_parser.cc \
src/core/ext/transport/chttp2/transport/hpack_parser_table.cc \
src/core/ext/transport/chttp2/transport/http2_settings.cc \
src/core/ext/transport/chttp2/transport/http_trace.cc \
src/core/ext/transport/chttp2/transport/huffsyms.cc \
src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc \
src/core/ext/transport/chttp2/transport/parsing.cc \
@ -110,7 +109,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/transport/chttp2/transport/varint.cc \
src/core/ext/transport/chttp2/transport/write_size_policy.cc \
src/core/ext/transport/chttp2/transport/writing.cc \
src/core/ext/transport/inproc/inproc_plugin.cc \
src/core/ext/transport/inproc/inproc_transport.cc \
src/core/ext/transport/inproc/legacy_inproc_transport.cc \
src/core/ext/upb-gen/envoy/admin/v3/certs.upb_minitable.c \
@ -448,7 +446,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/channel/channel_stack.cc \
src/core/lib/channel/channel_stack_builder.cc \
src/core/lib/channel/channel_stack_builder_impl.cc \
src/core/lib/channel/channel_stack_trace.cc \
src/core/lib/channel/connected_channel.cc \
src/core/lib/channel/promise_based_filter.cc \
src/core/lib/channel/status_util.cc \
@ -461,6 +458,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/config/load_config.cc \
src/core/lib/debug/event_log.cc \
src/core/lib/debug/trace.cc \
src/core/lib/debug/trace_flags.cc \
src/core/lib/event_engine/ares_resolver.cc \
src/core/lib/event_engine/cf_engine/cf_engine.cc \
src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc \
@ -499,7 +497,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/trace.cc \
src/core/lib/event_engine/utils.cc \
src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc \
src/core/lib/event_engine/windows/iocp.cc \
@ -515,6 +512,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gprpp/dump_args.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
src/core/lib/gprpp/glob.cc \
src/core/lib/gprpp/host_port.cc \
src/core/lib/gprpp/linux/env.cc \
src/core/lib/gprpp/load_file.cc \
@ -554,7 +552,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
src/core/lib/iomgr/event_engine_shims/closure.cc \
src/core/lib/iomgr/event_engine_shims/endpoint.cc \
src/core/lib/iomgr/event_engine_shims/tcp_client.cc \
@ -619,7 +616,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/promise/activity.cc \
src/core/lib/promise/party.cc \
src/core/lib/promise/sleep.cc \
src/core/lib/promise/trace.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/connection_quota.cc \
@ -627,7 +623,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/resource_quota/periodic_update.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \
src/core/lib/resource_quota/trace.cc \
src/core/lib/security/authorization/audit_logging.cc \
src/core/lib/security/authorization/authorization_policy_provider_vtable.cc \
src/core/lib/security/authorization/evaluate_args.cc \
@ -693,9 +688,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/slice/percent_encoding.cc \
src/core/lib/slice/slice.cc \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/surface/api_trace.cc \
src/core/lib/surface/byte_buffer.cc \
src/core/lib/surface/byte_buffer_reader.cc \
src/core/lib/surface/call.cc \
@ -786,7 +779,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/resolver/sockaddr/sockaddr_resolver.cc \
src/core/resolver/xds/xds_dependency_manager.cc \
src/core/resolver/xds/xds_resolver.cc \
src/core/resolver/xds/xds_resolver_trace.cc \
src/core/server/server.cc \
src/core/server/server_call_tracer_filter.cc \
src/core/server/server_config_selector_filter.cc \

12
config.w32 generated
View File

@ -64,7 +64,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\transport\\chttp2\\transport\\hpack_parser.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\hpack_parser_table.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\http2_settings.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\http_trace.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\huffsyms.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\max_concurrent_streams_policy.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\parsing.cc " +
@ -75,7 +74,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\transport\\chttp2\\transport\\varint.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\write_size_policy.cc " +
"src\\core\\ext\\transport\\chttp2\\transport\\writing.cc " +
"src\\core\\ext\\transport\\inproc\\inproc_plugin.cc " +
"src\\core\\ext\\transport\\inproc\\inproc_transport.cc " +
"src\\core\\ext\\transport\\inproc\\legacy_inproc_transport.cc " +
"src\\core\\ext\\upb-gen\\envoy\\admin\\v3\\certs.upb_minitable.c " +
@ -413,7 +411,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\channel\\channel_stack.cc " +
"src\\core\\lib\\channel\\channel_stack_builder.cc " +
"src\\core\\lib\\channel\\channel_stack_builder_impl.cc " +
"src\\core\\lib\\channel\\channel_stack_trace.cc " +
"src\\core\\lib\\channel\\connected_channel.cc " +
"src\\core\\lib\\channel\\promise_based_filter.cc " +
"src\\core\\lib\\channel\\status_util.cc " +
@ -426,6 +423,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\config\\load_config.cc " +
"src\\core\\lib\\debug\\event_log.cc " +
"src\\core\\lib\\debug\\trace.cc " +
"src\\core\\lib\\debug\\trace_flags.cc " +
"src\\core\\lib\\event_engine\\ares_resolver.cc " +
"src\\core\\lib\\event_engine\\cf_engine\\cf_engine.cc " +
"src\\core\\lib\\event_engine\\cf_engine\\cfstream_endpoint.cc " +
@ -464,7 +462,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\event_engine\\thread_pool\\work_stealing_thread_pool.cc " +
"src\\core\\lib\\event_engine\\thready_event_engine\\thready_event_engine.cc " +
"src\\core\\lib\\event_engine\\time_util.cc " +
"src\\core\\lib\\event_engine\\trace.cc " +
"src\\core\\lib\\event_engine\\utils.cc " +
"src\\core\\lib\\event_engine\\windows\\grpc_polled_fd_windows.cc " +
"src\\core\\lib\\event_engine\\windows\\iocp.cc " +
@ -480,6 +477,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gprpp\\dump_args.cc " +
"src\\core\\lib\\gprpp\\examine_stack.cc " +
"src\\core\\lib\\gprpp\\fork.cc " +
"src\\core\\lib\\gprpp\\glob.cc " +
"src\\core\\lib\\gprpp\\host_port.cc " +
"src\\core\\lib\\gprpp\\linux\\env.cc " +
"src\\core\\lib\\gprpp\\load_file.cc " +
@ -519,7 +517,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\iomgr\\ev_epoll1_linux.cc " +
"src\\core\\lib\\iomgr\\ev_poll_posix.cc " +
"src\\core\\lib\\iomgr\\ev_posix.cc " +
"src\\core\\lib\\iomgr\\ev_windows.cc " +
"src\\core\\lib\\iomgr\\event_engine_shims\\closure.cc " +
"src\\core\\lib\\iomgr\\event_engine_shims\\endpoint.cc " +
"src\\core\\lib\\iomgr\\event_engine_shims\\tcp_client.cc " +
@ -584,7 +581,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\promise\\activity.cc " +
"src\\core\\lib\\promise\\party.cc " +
"src\\core\\lib\\promise\\sleep.cc " +
"src\\core\\lib\\promise\\trace.cc " +
"src\\core\\lib\\resource_quota\\api.cc " +
"src\\core\\lib\\resource_quota\\arena.cc " +
"src\\core\\lib\\resource_quota\\connection_quota.cc " +
@ -592,7 +588,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\resource_quota\\periodic_update.cc " +
"src\\core\\lib\\resource_quota\\resource_quota.cc " +
"src\\core\\lib\\resource_quota\\thread_quota.cc " +
"src\\core\\lib\\resource_quota\\trace.cc " +
"src\\core\\lib\\security\\authorization\\audit_logging.cc " +
"src\\core\\lib\\security\\authorization\\authorization_policy_provider_vtable.cc " +
"src\\core\\lib\\security\\authorization\\evaluate_args.cc " +
@ -658,9 +653,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\slice\\percent_encoding.cc " +
"src\\core\\lib\\slice\\slice.cc " +
"src\\core\\lib\\slice\\slice_buffer.cc " +
"src\\core\\lib\\slice\\slice_refcount.cc " +
"src\\core\\lib\\slice\\slice_string_helpers.cc " +
"src\\core\\lib\\surface\\api_trace.cc " +
"src\\core\\lib\\surface\\byte_buffer.cc " +
"src\\core\\lib\\surface\\byte_buffer_reader.cc " +
"src\\core\\lib\\surface\\call.cc " +
@ -751,7 +744,6 @@ if (PHP_GRPC != "no") {
"src\\core\\resolver\\sockaddr\\sockaddr_resolver.cc " +
"src\\core\\resolver\\xds\\xds_dependency_manager.cc " +
"src\\core\\resolver\\xds\\xds_resolver.cc " +
"src\\core\\resolver\\xds\\xds_resolver_trace.cc " +
"src\\core\\server\\server.cc " +
"src\\core\\server\\server_call_tracer_filter.cc " +
"src\\core\\server\\server_config_selector_filter.cc " +

View File

@ -41,110 +41,29 @@ some configuration as environment variables that can be set.
- legacy - the (deprecated) original polling engine for gRPC
* GRPC_TRACE
A comma separated list of tracers that provide additional insight into how
gRPC C core is processing requests via debug logs. Available tracers include:
- api - traces api calls to the C core
- bdp_estimator - traces behavior of bdp estimation logic
- call_error - traces the possible errors contributing to final call status
- cares_resolver - traces operations of the c-ares based DNS resolver
- cares_address_sorting - traces operations of the c-ares based DNS
resolver's resolved address sorter
- cds_lb - traces cds LB policy
- channel - traces operations on the C core channel stack
- channel_stack - traces the set of filters in a channel stack upon
construction
- client_channel - traces client channel control plane activity, including
resolver and load balancing policy interaction
- client_channel_call - traces client channel call activity related to name
resolution
- client_channel_lb_call - traces client channel call activity related
to load balancing picking
- compression - traces compression operations
- connectivity_state - traces connectivity state changes to channels
- cronet - traces state in the cronet transport engine
- dns_resolver - traces state in the native DNS resolver
- executor - traces grpc's internal thread pool ('the executor')
- glb - traces the grpclb load balancer
- handshaker - traces handshaking state
- health_check_client - traces health checking client code
- http - traces state in the http2 transport engine
- http2_stream_state - traces all http2 stream state mutations.
- http2_ping - traces pings/ping acks/antagonist writes in http2 stack.
- http1 - traces HTTP/1.x operations performed by gRPC
- inproc - traces the in-process transport
- http_keepalive - traces gRPC keepalive pings
- flowctl - traces http2 flow control
- op_failure - traces error information when failure is pushed onto a
completion queue
- pick_first - traces the pick first load balancing policy
- plugin_credentials - traces plugin credentials
- pollable_refcount - traces reference counting of 'pollable' objects (only
in DEBUG)
- priority_lb - traces priority LB policy
- resource_quota - trace resource quota objects internals
- ring_hash_lb - traces the ring hash load balancing policy
- rls_lb - traces the RLS load balancing policy
- round_robin - traces the round_robin load balancing policy
- weighted_round_robin_lb - traces the weighted_round_robin load balancing
policy
- queue_pluck
- grpc_authz_api - traces gRPC authorization
- server_channel - lightweight trace of significant server channel events
- secure_endpoint - traces bytes flowing through encrypted channels
- subchannel - traces the connectivity state of subchannel
- subchannel_pool - traces subchannel pool
- timer - timers (alarms) in the grpc internals
- timer_check - more detailed trace of timer logic in grpc internals
- transport_security - traces metadata about secure channel establishment
- tcp - traces bytes in and out of a channel
- tsi - traces tsi transport security
- weighted_target_lb - traces weighted_target LB policy
- xds_client - traces xds client
- xds_cluster_manager_lb - traces cluster manager LB policy
- xds_cluster_impl_lb - traces cluster impl LB policy
- xds_resolver - traces xds resolver
The following tracers will only run in binaries built in DEBUG mode. This is
accomplished by invoking `CONFIG=dbg make <target>`
- metadata - tracks creation and mutation of metadata
- combiner - traces combiner lock state
- call_combiner - traces call combiner state
- closure - tracks closure creation, scheduling, and completion
- fd_trace - traces fd create(), shutdown() and close() calls for channel fds.
- pending_tags - traces still-in-progress tags on completion queues
- polling - traces the selected polling engine
- polling_api - traces the api calls to polling engine
- subchannel_refcount
- queue_refcount
- error_refcount
- stream_refcount
- slice_refcount
- workqueue_refcount
- fd_refcount
- cq_refcount
- auth_context_refcount
- security_connector_refcount
- resolver_refcount
- lb_policy_refcount
- chttp2_refcount
'all' can additionally be used to turn all traces on.
Individual traces can be disabled by prefixing them with '-'.
'refcount' will turn on all of the tracers for refcount debugging.
if 'list_tracers' is present, then all of the available tracers will be
printed when the program starts up.
Example:
export GRPC_TRACE=all,-pending_tags
A comma-separated list of tracer names or glob patterns that provide
additional insight into how gRPC C core is processing requests via debug logs.
Available tracers and their usage can be found in
[gRPC Trace Flags](trace_flags.md)
* GRPC_VERBOSITY
Default gRPC logging verbosity - one of:
- DEBUG - log all gRPC messages
- INFO - log INFO and ERROR message
- ERROR - log only errors (default)
- NONE - won't log any
<!-- BEGIN_GOOGLE_INTERNAL_DOCUMENTATION"
GRPC_VERBOSITY has been disabled for internal usage and will not work anymore.
If anyone wants to debug, we need to set verbose logs using absl.
END_GOOGLE_INTERNAL_DOCUMENTATION -->
<!-- BEGIN_OPEN_SOURCE_DOCUMENTATION -->
`GRPC_VERBOSITY` is used to set the minimum level of log messages printed by gRPC (supported values are `DEBUG`, `INFO` and `ERROR`). If this environment variable is unset, only `ERROR` logs will be printed.
gRPC logging verbosity - one of:
- DEBUG - log INFO, WARNING, ERROR and FATAL messages. Also sets absl VLOG(2) logs enabled. This is not recommended for production systems. This will be expensive for staging environments too, so it can be used when you want to debug a specific issue.
- INFO - log INFO, WARNING, ERROR and FATAL messages. This is not recommended for production systems. This may be slightly expensive for staging environments too. We recommend that you use your discretion for staging environments.
- ERROR - log ERROR and FATAL messages. This is recommended for production systems.
- NONE - won't log any.
GRPC_VERBOSITY will set verbosity of absl logging.
- If the external application sets some other verbosity, then whatever is set later will be honoured.
- If nothing is set as GRPC_VERBOSITY, then the setting of the exernal application will be honoured.
- If nothing is set by the external application also, the default set by absl will be honoured.
<!-- END_OPEN_SOURCE_DOCUMENTATION -->
* GRPC_STACKTRACE_MINLOGLEVEL
Minimum loglevel to print the stack-trace - one of DEBUG, INFO, ERROR, and NONE.

View File

@ -71,6 +71,7 @@ Aggregate Cluster Behavior Fixes | [A75](https://github.com/grpc/proposal/blob/m
[Authorization (RBAC)](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/rbac/v3/rbac.proto):<br><ul><li>`LOG` action has no effect<li>CEL unsupported and rejected</ul> | [A41](https://github.com/grpc/proposal/blob/master/A41-xds-rbac.md) | v1.51.0<br>(C++ and Python) | v1.42.0 | 1.42.0 | |
[Least Request LB Policy](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers.html#weighted-least-request) | [A48](https://github.com/grpc/proposal/blob/master/A48-xds-least-request-lb-policy.md) | | v1.48.0 | | |
[Outlier Detection](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/outlier):<br>Only the following detection types are supported:<ul><li>Success Rate</li><li>Failure Percentage</li></ul> | [A50](https://github.com/grpc/proposal/blob/master/A50-xds-outlier-detection.md) | v1.51.0 | v1.49.0 | v1.50.0 | v1.7.0 |
Ignore Resource Deletion | [A53](https://github.com/grpc/proposal/blob/master/A53-xds-ignore-resource-deletion.md) | v1.48.0 | v1.48.0 | v1.55.0 | v1.7.0 |
[Custom Load Balancer Configuration](https://github.com/envoyproxy/envoy/blob/57be3189ffa3372b34e9480d1f02b2d165e49077/api/envoy/config/cluster/v3/cluster.proto#L1208) | [A52](https://github.com/grpc/proposal/blob/master/A52-xds-custom-lb-policies.md) | v1.55.0 | v1.47.0 | v1.56.0 | v1.10.0 |
[xDS Federation](https://github.com/cncf/xds/blob/main/proposals/TP1-xds-transport-next.md) | [A47](https://github.com/grpc/proposal/blob/master/A47-xds-federation.md) | v1.55.0 | v1.55.0 | v1.55.0 | |
[Client-Side Weighted Round Robin LB Policy](https://github.com/envoyproxy/envoy/blob/a6d46b6ac4750720eec9a49abe701f0df9bf8e0a/api/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.proto#L36) | [A58](https://github.com/grpc/proposal/blob/master/A58-client-side-weighted-round-robin-lb-policy.md) | v1.55.0 | v1.54.0 | v1.56.0 | |

120
doc/trace_flags.md generated Normal file
View File

@ -0,0 +1,120 @@
<!---
Automatically generated by tools/codegen/core/gen_trace_flags.py
--->
gRPC Trace Flags
----------------
The `GRPC_TRACE` environment variable supports a comma-separated list of tracer
names or glob patterns that provide additional insight into how gRPC C core is
processing requests via debug logs. Available tracers include:
- api - API calls to the C core.
- backend_metric - C++ backend metric recorder APIs.
- backend_metric_filter - Filter that populates backend metric data in server trailing metadata.
- bdp_estimator - Behavior of bdp estimation logic.
- call - Traces operations on a call through the gRPC stack.
- call_error - Possible errors contributing to final call statuses.
- cares_address_sorting - Operations of the c-ares based DNS resolver's address sorter.
- cares_resolver - Operations of the c-ares based DNS resolver.
- cds_lb - CDS LB policy.
- channel - Operations on the C core channel stack.
- channel_stack - Construction of the set of filters in a channel stack.
- chaotic_good - Chaotic good transport.
- chttp2_hpack_parser - HTTP/2 HPACK parser.
- chttp2_new_stream - HTTP/2 incoming stream creation.
- client_channel - Client channel control plane activity, including resolver and load balancing policy interaction.
- client_channel_call - Client channel call activity related to name resolution.
- client_channel_lb_call - Client channel call activity related to load balancing picking.
- client_idle_filter - Client idleness filter.
- compression - Compression operations.
- connectivity_state - Connectivity state changes to channels.
- cronet - Cronet transport engine.
- dns_resolver - The active DNS resolver.
- environment_autodetect - GCP environment auto-detection.
- event_engine - High-level EventEngine operations.
- event_engine_client_channel_resolver - EventEngine-based client channel resolver state and events.
- event_engine_dns - EventEngine DNS resolver.
- event_engine_endpoint - EventEngine Endpoint operations.
- event_engine_endpoint_data - Detailed dump of EventEngine endpoint TCP data.
- event_engine_poller - EventEngine Poller events.
- executor - gRPC's legacy thread pool ('the executor').
- fault_injection_filter - Fault injection.
- flowctl - Http2 flow control.
- fork - Fork support.
- glb - gRPClb load balancer.
- grpc_authz_api - gRPC authorization.
- handshaker - Handshaking state.
- health_check_client - Health checking client code.
- http - Http2 transport engine.
- http1 - HTTP/1.x operations performed by gRPC.
- http2_ping - Pings/ping acks/antagonist writes in http2 stack.
- http2_stream_state - Http2 stream state mutations.
- http_keepalive - gRPC keepalive pings.
- inproc - In-process transport.
- metadata_query - GCP metadata queries.
- op_failure - Error information when failure is pushed onto a completion queue. The `api` tracer must be enabled for this flag to have any effect.
- orca_client - Out-of-band backend metric reporting client.
- outlier_detection_lb - Outlier detection.
- pick_first - Pick first load balancing policy.
- plugin_credentials - Plugin credentials.
- priority_lb - Priority LB policy.
- queue_pluck - Completion queue plucking. The `api` tracer must be enabled for this flag to have any effect.
- resource_quota - Resource quota objects internals.
- retry - Call retries.
- ring_hash_lb - Ring hash load balancing policy.
- rls_lb - RLS load balancing policy.
- round_robin - Round robin load balancing policy.
- secure_endpoint - Bytes flowing through encrypted channels.
- server_channel - Lightweight trace of significant server channel events.
- stateful_session_filter - Stateful session affinity.
- subchannel - Connectivity state of subchannels.
- subchannel_pool - Subchannel pool.
- tcp - Bytes in and out of a channel.
- timer - Timers (alarms) in the grpc internals.
- timer_check - more detailed trace of timer logic in grpc internals.
- tsi - TSI transport security.
- weighted_round_robin_lb - Weighted round robin load balancing policy.
- weighted_target_lb - Weighted target LB policy.
- xds_client - XDS client.
- xds_client_refcount - Refcount of XDS client.
- xds_cluster_impl_lb - XDS Cluster impl LB policy.
- xds_cluster_manager_lb - XDS Cluster manager LB policy.
- xds_override_host_lb - XDS Override host LB.
- xds_resolver - XDS Resolver.
- xds_server_config_fetcher - XDS Server config fetcher.
- xds_wrr_locality_lb - XDS WRR locality LB policy.
The following tracers will only run in binaries built in DEBUG mode. This is
accomplished by invoking `bazel build --config=dbg <target>`
- auth_context_refcount - Auth context refcounting.
- call_combiner - Call combiner state.
- call_refcount - Refcount on call.
- closure - Legacy closure creation, scheduling, and completion.
- combiner - Combiner lock state.
- cq_refcount - Completion queue refcounting.
- error_refcount - Error refcounting.
- fd_refcount - File descriptor refcounting.
- fd_trace - Legacy file descriptor create(), shutdown() and close() calls for channel fds.
- lb_policy_refcount - LB policy refcounting.
- party_state - Coordination of activities related to a call.
- pending_tags - Still-in-progress tags on completion queues. The `api` tracer must be enabled for this flag to have any effect.
- polling - The active polling engine.
- polling_api - API calls to polling engine.
- promise_primitives - Low-level primitives in the promise library.
- resolver_refcount - Resolver refcouting.
- security_connector_refcount - Refcounting for security connectors (part of channel credentials).
- slice_refcount - Slice refcounting.
- stream_refcount - Stream refcounting.
- subchannel_refcount - Subchannel refcounting.
- work_serializer - A synchronization mechanism used to ensure that only one thread is executing at a given time.
Glob patterns and special cases:
- `*` can be used to turn all traces on.
- Individual traces can be disabled by prefixing them with `-`.
- `*refcount*` will turn on all of the tracers for refcount debugging.
- if `list_tracers` is present, then all of the available tracers will be
printed when the program starts up.
Example:
export GRPC_TRACE=*,-pending_tags

View File

@ -13,7 +13,7 @@
```
bazel build \
--extra_toolchains=@androidndk//:all \
--android_platforms=//:android_x86_64,//:android_armv7,//:android_arm64 \
--android_platforms=//bazel/platforms/android:x86_64,//bazel/platforms/android:armeabi-v7a,//bazel/platforms/android:arm64-v8a \
--copt=-Wno-unknown-warning-option \
//examples/android/binder/java/io/grpc/binder/cpp/exampleserver:app \
//examples/android/binder/java/io/grpc/binder/cpp/exampleclient:app

54
examples/cpp/auth/BUILD Normal file
View File

@ -0,0 +1,54 @@
# Copyright 2024 the gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
cc_library(
name = "helper",
srcs = ["helper.cc"],
hdrs = ["helper.h"],
)
cc_binary(
name = "ssl_client",
srcs = ["ssl_client.cc"],
data = [
"credentials/root.crt",
],
defines = ["BAZEL_BUILD"],
deps = [
":helper",
"//:grpc++",
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
],
)
cc_binary(
name = "ssl_server",
srcs = ["ssl_server.cc"],
data = [
"credentials/localhost.crt",
"credentials/localhost.key",
],
defines = ["BAZEL_BUILD"],
deps = [
":helper",
"//:grpc++",
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
],
)

77
examples/cpp/auth/CMakeLists.txt generated Normal file
View File

@ -0,0 +1,77 @@
# Copyright 2024 the gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# cmake build file for C++ keyvaluestore example.
# Assumes protobuf and gRPC have been installed using cmake.
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build
# that automatically builds all the dependencies before building keyvaluestore.
cmake_minimum_required(VERSION 3.8)
project(Cancellation C CXX)
include(../cmake/common.cmake)
# Proto files
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE)
get_filename_component(hw_proto_path "${hw_proto}" PATH)
# Generated sources
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc")
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h")
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h")
add_custom_command(
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${hw_proto_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${hw_proto}"
DEPENDS "${hw_proto}")
# Include generated *.pb.h files
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
# hw_grpc_proto
add_library(hw_grpc_proto
${hw_grpc_srcs}
${hw_grpc_hdrs}
${hw_proto_srcs}
${hw_proto_hdrs})
target_link_libraries(hw_grpc_proto
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
# example helper
add_library(helper
"helper.h"
"helper.cc")
# Targets greeter_(client|server)
foreach(_target
ssl_client ssl_server)
add_executable(${_target} "${_target}.cc")
target_link_libraries(${_target}
helper
hw_grpc_proto
absl::flags
absl::flags_parse
absl::strings
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
endforeach()

View File

@ -0,0 +1,39 @@
# Authentication Example
## Overview
SSL is a commonly used cryptographic protocol to provide end-to-end
communication security. In the example, we show how to set up a server
authenticated SSL connection to transmit RPC.
We provide `grpc::SslServerCredentials` and `grpc::SslCredentials` types
to use SSL conections.
In our example, we use the public/private keys created ahead:
* "localhost.crt" contains the server certificate (public key).
* "localhost.key" contains the server private key.
* "root.crt" contains the certificate (certificate authority)
that can verify the server's certificate.
### Try it!
Once you have working gRPC, you can build this example using either bazel or cmake.
Make sure to run those at this directory so that they can read credential files properly.
Run the server, which will listen on port 50051:
```sh
$ ./ssl_server
```
Run the client (in a different terminal):
```sh
$ ./ssl_client
```
If things go smoothly, you will see the client output:
```
Greeter received: Hello world
```

View File

@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDFjCCAf4CCQCzrLIhrWa55zANBgkqhkiG9w0BAQsFADBCMQswCQYDVQQGEwJV
UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEPMA0GA1UECgwGR29vZ2xlMQ0wCwYDVQQL
DARnUlBDMCAXDTE5MDYyNDIyMjIzM1oYDzIxMTkwNTMxMjIyMjMzWjBWMQswCQYD
VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEPMA0GA1UECgwGR29vZ2xlMQ0w
CwYDVQQLDARnUlBDMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQCtCW0TjugnIUu8BEVIYvdMP+/2GENQDjZhZ8eKR5C6
toDGbgjsDtt/GxISAg4cg70fIvy0XolnGPZodvfHDM4lJ7yHBOdZD8TXQoE6okR7
HZuLUJ20M0pXgWqtRewKRUjuYsSDXBnzLiZw1dcv9nGpo+Bqa8NonpiGRRpEkshF
D6T9KU9Ts/x+wMQBIra2Gj0UMh79jPhUuxcYAQA0JQGivnOtdwuPiumpnUT8j8h6
tWg5l01EsCZWJecCF85KnGpJEVYPyPqBqGsy0nGS9plGotOWF87+jyUQt+KD63xA
aBmTro86mKDDKEK4JvzjVeMGz2UbVcLPiiZnErTFaiXJAgMBAAEwDQYJKoZIhvcN
AQELBQADggEBAKsDgOPCWp5WCy17vJbRlgfgk05sVNIHZtzrmdswjBmvSg8MUpep
XqcPNUpsljAXsf9UM5IFEMRdilUsFGWvHjBEtNAW8WUK9UV18WRuU//0w1Mp5HAN
xUEKb4BoyZr65vlCnTR+AR5c9FfPvLibhr5qHs2RA8Y3GyLOcGqBWed87jhdQLCc
P1bxB+96le5JeXq0tw215lxonI2/3ZYVK4/ok9gwXrQoWm8YieJqitk/ZQ4S17/4
pynHtDfdxLn23EXeGx+UTxJGfpRmhEZdJ+MN7QGYoomzx5qS5XoYKxRNrDlirJpr
OqXIn8E1it+6d5gOZfuHawcNGhRLplE/pfA=
-----END CERTIFICATE-----

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEArQltE47oJyFLvARFSGL3TD/v9hhDUA42YWfHikeQuraAxm4I
7A7bfxsSEgIOHIO9HyL8tF6JZxj2aHb3xwzOJSe8hwTnWQ/E10KBOqJEex2bi1Cd
tDNKV4FqrUXsCkVI7mLEg1wZ8y4mcNXXL/ZxqaPgamvDaJ6YhkUaRJLIRQ+k/SlP
U7P8fsDEASK2tho9FDIe/Yz4VLsXGAEANCUBor5zrXcLj4rpqZ1E/I/IerVoOZdN
RLAmViXnAhfOSpxqSRFWD8j6gahrMtJxkvaZRqLTlhfO/o8lELfig+t8QGgZk66P
OpigwyhCuCb841XjBs9lG1XCz4omZxK0xWolyQIDAQABAoIBADeq/Kh6JT3RfGf0
h8WN8TlaqHxnueAbcmtL0+oss+cdp7gu1jf7X6o4r0uT1a5ew40s2Fe+wj2kzkE1
ZOlouTlC22gkr7j7Vbxa7PBMG/Pvxoa/XL0IczZLsGImSJXVTG1E4SvRiZeulTdf
1GbdxhtpWV1jZe5Wd4Na3+SHxF5S7m3PrHiZlYdz1ND+8XZs1NlL9+ej72qSFul9
t/QjMWJ9pky/Wad5abnRLRyOsg+BsgnXbkUy2rD89ZxFMLda9pzXo3TPyAlBHonr
mkEsE4eRMWMpjBM79JbeyDdHn/cs/LjAZrzeDf7ugXr2CHQpKaM5O0PsNHezJII9
L5kCfzECgYEA4M/rz1UP1/BJoSqigUlSs0tPAg8a5UlkVsh6Osuq72IPNo8qg/Fw
oV/IiIS+q+obRcFj1Od3PGdTpCJwW5dzd2fXBQGmGdj0HucnCrs13RtBh91JiF5i
y/YYI9KfgOG2ZT9gG68T0gTs6jRrS3Qd83npqjrkJqMOd7s00MK9tUcCgYEAxQq7
T541oCYHSBRIIb0IrR25krZy9caxzCqPDwOcuuhaCqCiaq+ATvOWlSfgecm4eH0K
PCH0xlWxG0auPEwm4pA8+/WR/XJwscPZMuoht1EoKy1his4eKx/s7hHNeO6KOF0V
Y/zqIiuZnEwUoKbn7EqqNFSTT65PJKyGsICJFG8CgYAfaw9yl1myfQNdQb8aQGwN
YJ33FLNWje427qeeZe5KrDKiFloDvI9YDjHRWnPnRL1w/zj7fSm9yFb5HlMDieP6
MQnsyjEzdY2QcA+VwVoiv3dmDHgFVeOKy6bOAtaFxYWfGr9MvygO9t9BT/gawGyb
JVORlc9i0vDnrMMR1dV7awKBgBpTWLtGc/u1mPt0Wj7HtsUKV6TWY32a0l5owTxM
S0BdksogtBJ06DukJ9Y9wawD23WdnyRxlPZ6tHLkeprrwbY7dypioOKvy4a0l+xJ
g7+uRCOgqIuXBkjUtx8HmeAyXp0xMo5tWArAsIFFWOwt4IadYygitJvMuh44PraO
NcJZAoGADEiV0dheXUCVr8DrtSom8DQMj92/G/FIYjXL8OUhh0+F+YlYP0+F8PEU
yYIWEqL/S5tVKYshimUXQa537JcRKsTVJBG/ZKD2kuqgOc72zQy3oplimXeJDCXY
h2eAQ0u8GN6tN9C4t8Kp4a3y6FGsxgu+UTxdnL3YQ+yHAVhtCzo=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDWTCCAkGgAwIBAgIJAPOConZMwykwMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNV
BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMQ8wDQYDVQQKDAZHb29nbGUxDTAL
BgNVBAsMBGdSUEMwIBcNMTkwNjI0MjIyMDA3WhgPMjExOTA1MzEyMjIwMDdaMEIx
CzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMQ8wDQYDVQQKDAZHb29n
bGUxDTALBgNVBAsMBGdSUEMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
AQCwqei3TfyLidnQNDJ2lierMYo229K92DuORni7nSjJQ59Jc3dNMsmqGQJjCD8o
6mTlKM/oCbs27Wpx+OxcOLvT95j2kiDGca1fCvaMdguIod09SWiyMpv/hp0trLv7
NJIKHznath6rHYX2Ii3fZ1yCPzyQbEPSAA+GNpoNm1v1ZWmWKke9v7vLlS3inNlW
Mt9jepK7DrtbNZnVDjeItnppBSbVYRMxIyNHkepFbqXx5TpkCvl4M4XQZw9bfSxQ
i3WZ3q+T1Tw//OUdPNc+OfMhu0MA0QoMwikskP0NaIC3dbJZ5Ogx0RcnaB4E+9C6
O/znUEh3WuKVl5HXBF+UwWoFAgMBAAGjUDBOMB0GA1UdDgQWBBRm3JIgzgK4G97J
fbMGatWMZc7V3jAfBgNVHSMEGDAWgBRm3JIgzgK4G97JfbMGatWMZc7V3jAMBgNV
HRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCNiV8x41if094ry2srS0YucpiN
3rTPk08FOLsENTMYai524TGXJti1P6ofGr5KXCL0uxTByHE3fEiMMud2TIY5iHQo
Y4mzDTTcb+Q7yKHwYZMlcp6nO8W+NeY5t+S0JPHhb8deKWepcN2UpXBUYQLw7AiE
l96T9Gi+vC9h/XE5IVwHFQXTxf5UYzXtW1nfapvrOONg/ms41dgmrRKIi+knWfiJ
FdHpHX2sfDAoJtnpEISX+nxRGNVTLY64utXWm4yxaZJshvy2s8zWJgRg7rtwAhTT
Np9E9MnihXLEmDI4Co9XlLPJyZFmqImsbmVuKFeQOCiLAoPJaMI2lbi7fiTo
-----END CERTIFICATE-----

View File

@ -0,0 +1,34 @@
/*
*
* Copyright 2024 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "helper.h"
#include <fstream>
#include <iostream>
#include <sstream>
std::string LoadStringFromFile(std::string path) {
std::ifstream file(path);
if (!file.is_open()) {
std::cout << "Failed to open " << path << std::endl;
abort();
}
std::stringstream sstr;
sstr << file.rdbuf();
return sstr.str();
}

View File

@ -0,0 +1,26 @@
/*
*
* Copyright 2024 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_EXAMPLES_CPP_AUTH_HELPER_H_
#define GRPC_EXAMPLES_CPP_AUTH_HELPER_H_
#include <string>
std::string LoadStringFromFile(std::string path);
#endif // GRPC_EXAMPLES_CPP_AUTH_HELPER_H_

View File

@ -0,0 +1,121 @@
/*
*
* Copyright 2024 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <condition_variable>
#include <iostream>
#include <memory>
#include <mutex>
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "helper.h"
#include <grpcpp/grpcpp.h>
#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
#include "helloworld.grpc.pb.h"
#endif
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using helloworld::Greeter;
using helloworld::HelloReply;
using helloworld::HelloRequest;
class GreeterClient {
public:
GreeterClient(std::shared_ptr<Channel> channel)
: stub_(Greeter::NewStub(channel)) {}
// Assembles the client's payload, sends it and presents the response back
// from the server.
std::string SayHello(const std::string& user) {
// Data we are sending to the server.
HelloRequest request;
request.set_name(user);
// Container for the data we expect from the server.
HelloReply reply;
// Context for the client. It could be used to convey extra information to
// the server and/or tweak certain RPC behaviors.
ClientContext context;
// The actual RPC.
std::mutex mu;
std::condition_variable cv;
bool done = false;
Status status;
stub_->async()->SayHello(&context, &request, &reply,
[&mu, &cv, &done, &status](Status s) {
status = std::move(s);
std::lock_guard<std::mutex> lock(mu);
done = true;
cv.notify_one();
});
std::unique_lock<std::mutex> lock(mu);
while (!done) {
cv.wait(lock);
}
// Act upon its status.
if (status.ok()) {
return reply.message();
} else {
std::cout << status.error_code() << ": " << status.error_message()
<< std::endl;
return "RPC failed";
}
}
private:
std::unique_ptr<Greeter::Stub> stub_;
};
#ifdef BAZEL_BUILD
constexpr char kRootCertificate[] = "examples/cpp/auth/credentials/root.crt";
#else
constexpr char kRootCertificate[] = "credentials/root.crt";
#endif
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
// Instantiate the client. It requires a channel, out of which the actual RPCs
// are created. This channel models a connection to an endpoint specified by
// the argument "--target=" which is the only expected argument.
std::string target_str =
absl::StrFormat("localhost:%d", absl::GetFlag(FLAGS_port));
// Build a SSL options for the channel
grpc::SslCredentialsOptions ssl_options;
ssl_options.pem_root_certs = LoadStringFromFile(kRootCertificate);
// Create a channel with SSL credentials
GreeterClient greeter(
grpc::CreateChannel(target_str, grpc::SslCredentials(ssl_options)));
std::string user("world");
std::string reply = greeter.SayHello(user);
std::cout << "Greeter received: " << reply << std::endl;
return 0;
}

View File

@ -0,0 +1,94 @@
// Copyright 2024 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <iostream>
#include <memory>
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/strings/str_format.h"
#include "helper.h"
#include <grpcpp/grpcpp.h>
#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
#include "helloworld.grpc.pb.h"
#endif
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
using grpc::CallbackServerContext;
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerUnaryReactor;
using grpc::Status;
using helloworld::Greeter;
using helloworld::HelloReply;
using helloworld::HelloRequest;
// Logic and data behind the server's behavior.
class GreeterServiceImpl final : public Greeter::CallbackService {
ServerUnaryReactor* SayHello(CallbackServerContext* context,
const HelloRequest* request,
HelloReply* reply) override {
std::string prefix("Hello ");
reply->set_message(prefix + request->name());
ServerUnaryReactor* reactor = context->DefaultReactor();
reactor->Finish(Status::OK);
return reactor;
}
};
#ifdef BAZEL_BUILD
constexpr char kServerCertPath[] =
"examples/cpp/auth/credentials/localhost.crt";
constexpr char kServerKeyPath[] = "examples/cpp/auth/credentials/localhost.key";
#else
constexpr char kServerCertPath[] = "credentials/localhost.crt";
constexpr char kServerKeyPath[] = "credentials/localhost.key";
#endif
void RunServer(uint16_t port) {
std::string server_address = absl::StrFormat("0.0.0.0:%d", port);
GreeterServiceImpl service;
ServerBuilder builder;
// Load SSL credentials and build a SSL credential options
grpc::SslServerCredentialsOptions::PemKeyCertPair key_cert_pair = {
LoadStringFromFile(kServerKeyPath), LoadStringFromFile(kServerCertPath)};
grpc::SslServerCredentialsOptions ssl_options;
ssl_options.pem_key_cert_pairs.emplace_back(key_cert_pair);
// Listen on the given address with SSL credentials
builder.AddListeningPort(server_address,
grpc::SslServerCredentials(ssl_options));
// Register "service" as the instance through which we'll communicate with
// clients. In this case it corresponds to an *synchronous* service.
builder.RegisterService(&service);
// Finally assemble the server.
std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl;
// Wait for the server to shutdown. Note that some other thread must be
// responsible for shutting down the server for this call to ever return.
server->Wait();
}
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
RunServer(absl::GetFlag(FLAGS_port));
return 0;
}

View File

@ -27,10 +27,10 @@ objc_grpc_library(
deps = ["//examples/protos:helloworld_proto"],
)
# This one works with import "external/com_github_grpc_grpc/examples/protos/Keyvaluestore.pbrpc.h"
# This one works with import "third_party/com_github_grpc_grpc/examples/protos/Keyvaluestore.pbrpc.h"
objc_grpc_library(
name = "Keyvaluestore_grpc_proto_external",
srcs = ["//external/com_github_grpc_grpc/examples/protos:keyvaluestore.proto"],
srcs = ["//third_party/com_github_grpc_grpc/examples/protos:keyvaluestore.proto"],
tags = ["manual"],
deps = ["@com_github_grpc_grpc//examples/protos:keyvaluestore_proto"],
)

View File

@ -0,0 +1,46 @@
# Copyright 2024 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
# TODO(xuanwn): Instaed of using Bazel build, we should pip install all dependencies
# once we have a released version of grpcio-csm-observability.
py_binary(
name = "csm_greeter_client",
srcs = ["csm_greeter_client.py"],
python_version = "PY3",
deps = [
"//src/proto/grpc/testing:py_messages_proto",
"//src/proto/grpc/testing:py_test_proto",
"//src/proto/grpc/testing:test_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_csm_observability/grpc_csm_observability:csm_observability",
requirement("opentelemetry-exporter-prometheus"),
],
)
py_binary(
name = "csm_greeter_server",
srcs = ["csm_greeter_server.py"],
python_version = "PY3",
deps = [
"//src/proto/grpc/testing:py_messages_proto",
"//src/proto/grpc/testing:py_test_proto",
"//src/proto/grpc/testing:test_py_pb2_grpc",
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_csm_observability/grpc_csm_observability:csm_observability",
requirement("opentelemetry-exporter-prometheus"),
],
)

View File

@ -0,0 +1,26 @@
FROM python:3.9-slim-bookworm
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y build-essential clang curl
WORKDIR /workdir
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN mkdir /artifacts
COPY . .
RUN tools/bazel build -c dbg //examples/python/observability/csm:csm_greeter_client
RUN cp -rL /workdir/bazel-bin/examples/python/observability/csm/csm_greeter_client* /artifacts/
FROM python:3.9-slim-bookworm
RUN apt-get update -y \
&& apt-get install -y python3 \
&& apt-get -y autoremove \
&& apt-get install -y curl \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/bin/python
COPY --from=0 /artifacts ./
ENTRYPOINT ["/csm_greeter_client"]

View File

@ -0,0 +1,26 @@
FROM python:3.9-slim-bookworm
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y build-essential clang curl
WORKDIR /workdir
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN mkdir /artifacts
COPY . .
RUN tools/bazel build -c dbg //examples/python/observability/csm:csm_greeter_server
RUN cp -rL /workdir/bazel-bin/examples/python/observability/csm/csm_greeter_server* /artifacts/
FROM python:3.9-slim-bookworm
RUN apt-get update -y \
&& apt-get install -y python3 \
&& apt-get -y autoremove \
&& apt-get install -y curl \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/bin/python
COPY --from=0 /artifacts ./
ENTRYPOINT ["/csm_greeter_server"]

View File

@ -0,0 +1,33 @@
# gRPC Python CSM Hello World Example
This CSM example builds on the [Python xDS Example](https://github.com/grpc/grpc/tree/master/examples/python/xds) and changes the gRPC client and server to accept configuration from an xDS control plane and test CSM observability.
## Configuration
The client takes the following command-line arguments -
* `--target` - By default, the client tries to connect to the target "xds:///helloworld:50051" and gRPC would use xDS to resolve this target and connect to the server backend. This can be overriden to change the target.
* `--secure_mode` - Whether to use xDS to retrieve server credentials. Default value is False.
* `--prometheus_endpoint` - Endpoint used for prometheus. Default value is localhost:9464.
The server takes the following command-line arguments -
* `--port` - Port on which the Hello World service is run. Defaults to 50051.
* `--secure_mode` - Whether to use xDS to retrieve server credentials. Default value is False.
* `--server_id` - The server ID to return in responses.
* `--prometheus_endpoint` - Endpoint used for prometheus. Default value is `localhost:9464`.
## Building
From the gRPC workspace folder:
Client:
```
docker build -f examples/python/observability/csm/Dockerfile.client -t "us-docker.pkg.dev/grpc-testing/examples/csm-o11y-example-python-client" .
```
Server:
```
docker build -f examples/python/observability/csm/Dockerfile.server -t "us-docker.pkg.dev/grpc-testing/examples/csm-o11y-example-python-server" .
```
And then push the tagged image using `docker push`.

View File

@ -0,0 +1,101 @@
# Copyright 2024 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import logging
import time
import grpc
from grpc_csm_observability import CsmOpenTelemetryPlugin
from opentelemetry.exporter.prometheus import PrometheusMetricReader
from opentelemetry.sdk.metrics import MeterProvider
from prometheus_client import start_http_server
from src.proto.grpc.testing import messages_pb2
from src.proto.grpc.testing import test_pb2_grpc
logger = logging.getLogger()
console_handler = logging.StreamHandler()
formatter = logging.Formatter(fmt="%(asctime)s: %(levelname)-8s %(message)s")
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
def _run(target: int, secure_mode: bool, prometheus_endpoint: int):
csm_plugin = _prepare_csm_observability_plugin(prometheus_endpoint)
csm_plugin.register_global()
if secure_mode:
fallback_creds = grpc.experimental.insecure_channel_credentials()
channel_creds = grpc.xds_channel_credentials(fallback_creds)
channel = grpc.secure_channel(target, channel_creds)
else:
channel = grpc.insecure_channel(target)
with channel:
stub = test_pb2_grpc.TestServiceStub(channel)
# Continuously send RPCs every second.
while True:
request = messages_pb2.SimpleRequest()
logger.info("Sending request to server")
stub.UnaryCall(request)
time.sleep(1)
csm_plugin.deregister_global()
def _prepare_csm_observability_plugin(
prometheus_endpoint: int,
) -> CsmOpenTelemetryPlugin:
# Start Prometheus client
start_http_server(port=prometheus_endpoint, addr="0.0.0.0")
reader = PrometheusMetricReader()
meter_provider = MeterProvider(metric_readers=[reader])
csm_plugin = CsmOpenTelemetryPlugin(
meter_provider=meter_provider,
)
return csm_plugin
def bool_arg(arg: str) -> bool:
if arg.lower() in ("true", "yes", "y"):
return True
elif arg.lower() in ("false", "no", "n"):
return False
else:
raise argparse.ArgumentTypeError(f"Could not parse '{arg}' as a bool.")
if __name__ == "__main__":
logging.basicConfig()
logger.setLevel(logging.INFO)
parser = argparse.ArgumentParser(
description="Run Python CSM Observability Test client."
)
parser.add_argument(
"--target",
default="xds:///helloworld:50051",
help="The address of the server.",
)
parser.add_argument(
"--secure_mode",
default="False",
type=bool_arg,
help="If specified, uses xDS credentials to connect to the server.",
)
parser.add_argument(
"--prometheus_endpoint",
type=int,
default=9464,
help="Port for servers besides test server.",
)
args = parser.parse_args()
_run(args.target, args.secure_mode, args.prometheus_endpoint)

View File

@ -0,0 +1,149 @@
# Copyright 2024 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
from concurrent import futures
import logging
import socket
import grpc
from grpc_csm_observability import CsmOpenTelemetryPlugin
from opentelemetry.exporter.prometheus import PrometheusMetricReader
from opentelemetry.sdk.metrics import MeterProvider
from prometheus_client import start_http_server
from src.proto.grpc.testing import messages_pb2
from src.proto.grpc.testing import test_pb2_grpc
_LISTEN_HOST = "0.0.0.0"
_THREAD_POOL_SIZE = 256
logger = logging.getLogger()
console_handler = logging.StreamHandler()
formatter = logging.Formatter(fmt="%(asctime)s: %(levelname)-8s %(message)s")
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
class TestService(test_pb2_grpc.TestServiceServicer):
def __init__(self, server_id, hostname):
self._server_id = server_id
self._hostname = hostname
def UnaryCall(
self, request: messages_pb2.SimpleRequest, context: grpc.ServicerContext
) -> messages_pb2.SimpleResponse:
context.send_initial_metadata((("hostname", self._hostname),))
if request.response_size > 0:
response = messages_pb2.SimpleResponse(
payload=messages_pb2.Payload(body=b"0" * request.response_size)
)
else:
response = messages_pb2.SimpleResponse()
response.server_id = self._server_id
response.hostname = self._hostname
logger.info("Sending response to client")
return response
def _run(
port: int,
secure_mode: bool,
server_id: str,
prometheus_endpoint: int,
) -> None:
csm_plugin = _prepare_csm_observability_plugin(prometheus_endpoint)
csm_plugin.register_global()
server = grpc.server(
futures.ThreadPoolExecutor(max_workers=_THREAD_POOL_SIZE)
)
_configure_test_server(server, port, secure_mode, server_id)
server.start()
logger.info("Test server listening on port %d", port)
server.wait_for_termination()
csm_plugin.deregister_global()
def _prepare_csm_observability_plugin(
prometheus_endpoint: int,
) -> CsmOpenTelemetryPlugin:
# Start Prometheus client
start_http_server(port=prometheus_endpoint, addr="0.0.0.0")
reader = PrometheusMetricReader()
meter_provider = MeterProvider(metric_readers=[reader])
csm_plugin = CsmOpenTelemetryPlugin(
meter_provider=meter_provider,
)
return csm_plugin
def _configure_test_server(
server: grpc.Server, port: int, secure_mode: bool, server_id: str
) -> None:
test_pb2_grpc.add_TestServiceServicer_to_server(
TestService(server_id, socket.gethostname()), server
)
listen_address = f"{_LISTEN_HOST}:{port}"
if not secure_mode:
server.add_insecure_port(listen_address)
else:
logger.info("Running with xDS Server credentials")
server_fallback_creds = grpc.insecure_server_credentials()
server_creds = grpc.xds_server_credentials(server_fallback_creds)
server.add_secure_port(listen_address, server_creds)
def bool_arg(arg: str) -> bool:
if arg.lower() in ("true", "yes", "y"):
return True
elif arg.lower() in ("false", "no", "n"):
return False
else:
raise argparse.ArgumentTypeError(f"Could not parse '{arg}' as a bool.")
if __name__ == "__main__":
logging.basicConfig()
logger.setLevel(logging.INFO)
parser = argparse.ArgumentParser(
description="Run Python CSM Observability Test server."
)
parser.add_argument(
"--port", type=int, default=50051, help="Port for test server."
)
parser.add_argument(
"--secure_mode",
type=bool_arg,
default="False",
help="If specified, uses xDS to retrieve server credentials.",
)
parser.add_argument(
"--server_id",
type=str,
default="python_server",
help="The server ID to return in responses.",
)
parser.add_argument(
"--prometheus_endpoint",
type=int,
default=9464,
help="Port for servers besides test server.",
)
args = parser.parse_args()
_run(
args.port,
args.secure_mode,
args.server_id,
args.prometheus_endpoint,
)

18
gRPC-C++.podspec generated
View File

@ -365,7 +365,6 @@ Pod::Spec.new do |s|
'src/core/ext/transport/chttp2/transport/hpack_parser.h',
'src/core/ext/transport/chttp2/transport/hpack_parser_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/http_trace.h',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/internal.h',
'src/core/ext/transport/chttp2/transport/legacy_frame.h',
@ -882,7 +881,6 @@ Pod::Spec.new do |s|
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_stack_builder_impl.h',
'src/core/lib/channel/channel_stack_trace.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/promise_based_filter.h',
'src/core/lib/channel/status_util.h',
@ -893,6 +891,8 @@ Pod::Spec.new do |s|
'src/core/lib/config/load_config.h',
'src/core/lib/debug/event_log.h',
'src/core/lib/debug/trace.h',
'src/core/lib/debug/trace_flags.h',
'src/core/lib/debug/trace_impl.h',
'src/core/lib/event_engine/ares_resolver.h',
'src/core/lib/event_engine/cf_engine/cf_engine.h',
'src/core/lib/event_engine/cf_engine/cfstream_endpoint.h',
@ -974,6 +974,7 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/env.h',
'src/core/lib/gprpp/examine_stack.h',
'src/core/lib/gprpp/fork.h',
'src/core/lib/gprpp/glob.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/if_list.h',
'src/core/lib/gprpp/load_file.h',
@ -1102,7 +1103,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/seq.h',
'src/core/lib/promise/sleep.h',
'src/core/lib/promise/status_flag.h',
'src/core/lib/promise/trace.h',
'src/core/lib/promise/try_join.h',
'src/core/lib/promise/try_seq.h',
'src/core/lib/resource_quota/api.h',
@ -1112,7 +1112,6 @@ Pod::Spec.new do |s|
'src/core/lib/resource_quota/periodic_update.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',
'src/core/lib/resource_quota/trace.h',
'src/core/lib/security/authorization/audit_logging.h',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/authorization_policy_provider.h',
@ -1177,7 +1176,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/call_trace.h',
'src/core/lib/surface/call_utils.h',
'src/core/lib/surface/channel.h',
'src/core/lib/surface/channel_create.h',
@ -1260,7 +1258,6 @@ Pod::Spec.new do |s|
'src/core/resolver/server_address.h',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/resolver/xds/xds_resolver_trace.h',
'src/core/server/server.h',
'src/core/server/server_call_tracer_filter.h',
'src/core/server/server_config_selector.h',
@ -1641,7 +1638,6 @@ Pod::Spec.new do |s|
'src/core/ext/transport/chttp2/transport/hpack_parser.h',
'src/core/ext/transport/chttp2/transport/hpack_parser_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/http_trace.h',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/internal.h',
'src/core/ext/transport/chttp2/transport/legacy_frame.h',
@ -2158,7 +2154,6 @@ Pod::Spec.new do |s|
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_stack_builder_impl.h',
'src/core/lib/channel/channel_stack_trace.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/promise_based_filter.h',
'src/core/lib/channel/status_util.h',
@ -2169,6 +2164,8 @@ Pod::Spec.new do |s|
'src/core/lib/config/load_config.h',
'src/core/lib/debug/event_log.h',
'src/core/lib/debug/trace.h',
'src/core/lib/debug/trace_flags.h',
'src/core/lib/debug/trace_impl.h',
'src/core/lib/event_engine/ares_resolver.h',
'src/core/lib/event_engine/cf_engine/cf_engine.h',
'src/core/lib/event_engine/cf_engine/cfstream_endpoint.h',
@ -2250,6 +2247,7 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/env.h',
'src/core/lib/gprpp/examine_stack.h',
'src/core/lib/gprpp/fork.h',
'src/core/lib/gprpp/glob.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/if_list.h',
'src/core/lib/gprpp/load_file.h',
@ -2378,7 +2376,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/seq.h',
'src/core/lib/promise/sleep.h',
'src/core/lib/promise/status_flag.h',
'src/core/lib/promise/trace.h',
'src/core/lib/promise/try_join.h',
'src/core/lib/promise/try_seq.h',
'src/core/lib/resource_quota/api.h',
@ -2388,7 +2385,6 @@ Pod::Spec.new do |s|
'src/core/lib/resource_quota/periodic_update.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',
'src/core/lib/resource_quota/trace.h',
'src/core/lib/security/authorization/audit_logging.h',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/authorization_policy_provider.h',
@ -2453,7 +2449,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/call_trace.h',
'src/core/lib/surface/call_utils.h',
'src/core/lib/surface/channel.h',
'src/core/lib/surface/channel_create.h',
@ -2536,7 +2531,6 @@ Pod::Spec.new do |s|
'src/core/resolver/server_address.h',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/resolver/xds/xds_resolver_trace.h',
'src/core/server/server.h',
'src/core/server/server_call_tracer_filter.h',
'src/core/server/server_config_selector.h',

30
gRPC-Core.podspec generated
View File

@ -356,8 +356,6 @@ Pod::Spec.new do |s|
'src/core/ext/transport/chttp2/transport/hpack_parser_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.cc',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/http_trace.cc',
'src/core/ext/transport/chttp2/transport/http_trace.h',
'src/core/ext/transport/chttp2/transport/huffsyms.cc',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/internal.h',
@ -377,7 +375,6 @@ Pod::Spec.new do |s|
'src/core/ext/transport/chttp2/transport/write_size_policy.cc',
'src/core/ext/transport/chttp2/transport/write_size_policy.h',
'src/core/ext/transport/chttp2/transport/writing.cc',
'src/core/ext/transport/inproc/inproc_plugin.cc',
'src/core/ext/transport/inproc/inproc_transport.cc',
'src/core/ext/transport/inproc/inproc_transport.h',
'src/core/ext/transport/inproc/legacy_inproc_transport.cc',
@ -1222,8 +1219,6 @@ Pod::Spec.new do |s|
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_stack_builder_impl.cc',
'src/core/lib/channel/channel_stack_builder_impl.h',
'src/core/lib/channel/channel_stack_trace.cc',
'src/core/lib/channel/channel_stack_trace.h',
'src/core/lib/channel/connected_channel.cc',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/promise_based_filter.cc',
@ -1246,6 +1241,9 @@ Pod::Spec.new do |s|
'src/core/lib/debug/event_log.h',
'src/core/lib/debug/trace.cc',
'src/core/lib/debug/trace.h',
'src/core/lib/debug/trace_flags.cc',
'src/core/lib/debug/trace_flags.h',
'src/core/lib/debug/trace_impl.h',
'src/core/lib/event_engine/ares_resolver.cc',
'src/core/lib/event_engine/ares_resolver.h',
'src/core/lib/event_engine/cf_engine/cf_engine.cc',
@ -1338,7 +1336,6 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.h',
'src/core/lib/event_engine/time_util.cc',
'src/core/lib/event_engine/time_util.h',
'src/core/lib/event_engine/trace.cc',
'src/core/lib/event_engine/trace.h',
'src/core/lib/event_engine/utils.cc',
'src/core/lib/event_engine/utils.h',
@ -1381,6 +1378,8 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/examine_stack.h',
'src/core/lib/gprpp/fork.cc',
'src/core/lib/gprpp/fork.h',
'src/core/lib/gprpp/glob.cc',
'src/core/lib/gprpp/glob.h',
'src/core/lib/gprpp/host_port.cc',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/if_list.h',
@ -1470,7 +1469,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/ev_windows.cc',
'src/core/lib/iomgr/event_engine_shims/closure.cc',
'src/core/lib/iomgr/event_engine_shims/closure.h',
'src/core/lib/iomgr/event_engine_shims/endpoint.cc',
@ -1613,8 +1611,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/sleep.cc',
'src/core/lib/promise/sleep.h',
'src/core/lib/promise/status_flag.h',
'src/core/lib/promise/trace.cc',
'src/core/lib/promise/trace.h',
'src/core/lib/promise/try_join.h',
'src/core/lib/promise/try_seq.h',
'src/core/lib/resource_quota/api.cc',
@ -1631,8 +1627,6 @@ Pod::Spec.new do |s|
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.cc',
'src/core/lib/resource_quota/thread_quota.h',
'src/core/lib/resource_quota/trace.cc',
'src/core/lib/resource_quota/trace.h',
'src/core/lib/security/authorization/audit_logging.cc',
'src/core/lib/security/authorization/audit_logging.h',
'src/core/lib/security/authorization/authorization_engine.h',
@ -1757,11 +1751,9 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_buffer.cc',
'src/core/lib/slice/slice_buffer.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_refcount.cc',
'src/core/lib/slice/slice_refcount.h',
'src/core/lib/slice/slice_string_helpers.cc',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.cc',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/byte_buffer.cc',
'src/core/lib/surface/byte_buffer_reader.cc',
@ -1770,7 +1762,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/call_details.cc',
'src/core/lib/surface/call_log_batch.cc',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/call_trace.h',
'src/core/lib/surface/call_utils.cc',
'src/core/lib/surface/call_utils.h',
'src/core/lib/surface/channel.cc',
@ -1938,8 +1929,6 @@ Pod::Spec.new do |s|
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver.cc',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/resolver/xds/xds_resolver_trace.cc',
'src/core/resolver/xds/xds_resolver_trace.h',
'src/core/server/server.cc',
'src/core/server/server.h',
'src/core/server/server_call_tracer_filter.cc',
@ -2423,7 +2412,6 @@ Pod::Spec.new do |s|
'src/core/ext/transport/chttp2/transport/hpack_parser.h',
'src/core/ext/transport/chttp2/transport/hpack_parser_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/http_trace.h',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/internal.h',
'src/core/ext/transport/chttp2/transport/legacy_frame.h',
@ -2940,7 +2928,6 @@ Pod::Spec.new do |s|
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_stack_builder_impl.h',
'src/core/lib/channel/channel_stack_trace.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/promise_based_filter.h',
'src/core/lib/channel/status_util.h',
@ -2951,6 +2938,8 @@ Pod::Spec.new do |s|
'src/core/lib/config/load_config.h',
'src/core/lib/debug/event_log.h',
'src/core/lib/debug/trace.h',
'src/core/lib/debug/trace_flags.h',
'src/core/lib/debug/trace_impl.h',
'src/core/lib/event_engine/ares_resolver.h',
'src/core/lib/event_engine/cf_engine/cf_engine.h',
'src/core/lib/event_engine/cf_engine/cfstream_endpoint.h',
@ -3032,6 +3021,7 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/env.h',
'src/core/lib/gprpp/examine_stack.h',
'src/core/lib/gprpp/fork.h',
'src/core/lib/gprpp/glob.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/if_list.h',
'src/core/lib/gprpp/load_file.h',
@ -3160,7 +3150,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/seq.h',
'src/core/lib/promise/sleep.h',
'src/core/lib/promise/status_flag.h',
'src/core/lib/promise/trace.h',
'src/core/lib/promise/try_join.h',
'src/core/lib/promise/try_seq.h',
'src/core/lib/resource_quota/api.h',
@ -3170,7 +3159,6 @@ Pod::Spec.new do |s|
'src/core/lib/resource_quota/periodic_update.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',
'src/core/lib/resource_quota/trace.h',
'src/core/lib/security/authorization/audit_logging.h',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/authorization_policy_provider.h',
@ -3235,7 +3223,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/call_trace.h',
'src/core/lib/surface/call_utils.h',
'src/core/lib/surface/channel.h',
'src/core/lib/surface/channel_create.h',
@ -3318,7 +3305,6 @@ Pod::Spec.new do |s|
'src/core/resolver/server_address.h',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/resolver/xds/xds_resolver_trace.h',
'src/core/server/server.h',
'src/core/server/server_call_tracer_filter.h',
'src/core/server/server_config_selector.h',

21
grpc.gemspec generated
View File

@ -243,8 +243,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/transport/chttp2/transport/hpack_parser_table.h )
s.files += %w( src/core/ext/transport/chttp2/transport/http2_settings.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/http2_settings.h )
s.files += %w( src/core/ext/transport/chttp2/transport/http_trace.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/http_trace.h )
s.files += %w( src/core/ext/transport/chttp2/transport/huffsyms.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/huffsyms.h )
s.files += %w( src/core/ext/transport/chttp2/transport/internal.h )
@ -264,7 +262,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/transport/chttp2/transport/write_size_policy.cc )
s.files += %w( src/core/ext/transport/chttp2/transport/write_size_policy.h )
s.files += %w( src/core/ext/transport/chttp2/transport/writing.cc )
s.files += %w( src/core/ext/transport/inproc/inproc_plugin.cc )
s.files += %w( src/core/ext/transport/inproc/inproc_transport.cc )
s.files += %w( src/core/ext/transport/inproc/inproc_transport.h )
s.files += %w( src/core/ext/transport/inproc/legacy_inproc_transport.cc )
@ -1109,8 +1106,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/channel_stack_builder.h )
s.files += %w( src/core/lib/channel/channel_stack_builder_impl.cc )
s.files += %w( src/core/lib/channel/channel_stack_builder_impl.h )
s.files += %w( src/core/lib/channel/channel_stack_trace.cc )
s.files += %w( src/core/lib/channel/channel_stack_trace.h )
s.files += %w( src/core/lib/channel/connected_channel.cc )
s.files += %w( src/core/lib/channel/connected_channel.h )
s.files += %w( src/core/lib/channel/promise_based_filter.cc )
@ -1133,6 +1128,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/debug/event_log.h )
s.files += %w( src/core/lib/debug/trace.cc )
s.files += %w( src/core/lib/debug/trace.h )
s.files += %w( src/core/lib/debug/trace_flags.cc )
s.files += %w( src/core/lib/debug/trace_flags.h )
s.files += %w( src/core/lib/debug/trace_impl.h )
s.files += %w( src/core/lib/event_engine/ares_resolver.cc )
s.files += %w( src/core/lib/event_engine/ares_resolver.h )
s.files += %w( src/core/lib/event_engine/cf_engine/cf_engine.cc )
@ -1225,7 +1223,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/event_engine/thready_event_engine/thready_event_engine.h )
s.files += %w( src/core/lib/event_engine/time_util.cc )
s.files += %w( src/core/lib/event_engine/time_util.h )
s.files += %w( src/core/lib/event_engine/trace.cc )
s.files += %w( src/core/lib/event_engine/trace.h )
s.files += %w( src/core/lib/event_engine/utils.cc )
s.files += %w( src/core/lib/event_engine/utils.h )
@ -1268,6 +1265,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gprpp/examine_stack.h )
s.files += %w( src/core/lib/gprpp/fork.cc )
s.files += %w( src/core/lib/gprpp/fork.h )
s.files += %w( src/core/lib/gprpp/glob.cc )
s.files += %w( src/core/lib/gprpp/glob.h )
s.files += %w( src/core/lib/gprpp/host_port.cc )
s.files += %w( src/core/lib/gprpp/host_port.h )
s.files += %w( src/core/lib/gprpp/if_list.h )
@ -1357,7 +1356,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/ev_poll_posix.h )
s.files += %w( src/core/lib/iomgr/ev_posix.cc )
s.files += %w( src/core/lib/iomgr/ev_posix.h )
s.files += %w( src/core/lib/iomgr/ev_windows.cc )
s.files += %w( src/core/lib/iomgr/event_engine_shims/closure.cc )
s.files += %w( src/core/lib/iomgr/event_engine_shims/closure.h )
s.files += %w( src/core/lib/iomgr/event_engine_shims/endpoint.cc )
@ -1500,8 +1498,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/promise/sleep.cc )
s.files += %w( src/core/lib/promise/sleep.h )
s.files += %w( src/core/lib/promise/status_flag.h )
s.files += %w( src/core/lib/promise/trace.cc )
s.files += %w( src/core/lib/promise/trace.h )
s.files += %w( src/core/lib/promise/try_join.h )
s.files += %w( src/core/lib/promise/try_seq.h )
s.files += %w( src/core/lib/resource_quota/api.cc )
@ -1518,8 +1514,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/resource_quota/resource_quota.h )
s.files += %w( src/core/lib/resource_quota/thread_quota.cc )
s.files += %w( src/core/lib/resource_quota/thread_quota.h )
s.files += %w( src/core/lib/resource_quota/trace.cc )
s.files += %w( src/core/lib/resource_quota/trace.h )
s.files += %w( src/core/lib/security/authorization/audit_logging.cc )
s.files += %w( src/core/lib/security/authorization/audit_logging.h )
s.files += %w( src/core/lib/security/authorization/authorization_engine.h )
@ -1644,11 +1638,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/slice/slice_buffer.cc )
s.files += %w( src/core/lib/slice/slice_buffer.h )
s.files += %w( src/core/lib/slice/slice_internal.h )
s.files += %w( src/core/lib/slice/slice_refcount.cc )
s.files += %w( src/core/lib/slice/slice_refcount.h )
s.files += %w( src/core/lib/slice/slice_string_helpers.cc )
s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/surface/api_trace.cc )
s.files += %w( src/core/lib/surface/api_trace.h )
s.files += %w( src/core/lib/surface/byte_buffer.cc )
s.files += %w( src/core/lib/surface/byte_buffer_reader.cc )
@ -1657,7 +1649,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/call_details.cc )
s.files += %w( src/core/lib/surface/call_log_batch.cc )
s.files += %w( src/core/lib/surface/call_test_only.h )
s.files += %w( src/core/lib/surface/call_trace.h )
s.files += %w( src/core/lib/surface/call_utils.cc )
s.files += %w( src/core/lib/surface/call_utils.h )
s.files += %w( src/core/lib/surface/channel.cc )
@ -1825,8 +1816,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/resolver/xds/xds_dependency_manager.h )
s.files += %w( src/core/resolver/xds/xds_resolver.cc )
s.files += %w( src/core/resolver/xds/xds_resolver_attributes.h )
s.files += %w( src/core/resolver/xds/xds_resolver_trace.cc )
s.files += %w( src/core/resolver/xds/xds_resolver_trace.h )
s.files += %w( src/core/server/server.cc )
s.files += %w( src/core/server/server.h )
s.files += %w( src/core/server/server_call_tracer_filter.cc )

View File

@ -132,8 +132,6 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
struct TaskHandle {
intptr_t keys[2];
static const GRPC_DLL TaskHandle kInvalid;
friend bool operator==(const TaskHandle& lhs, const TaskHandle& rhs);
friend bool operator!=(const TaskHandle& lhs, const TaskHandle& rhs);
};
/// A handle to a cancellable connection attempt.
///
@ -141,10 +139,6 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
struct ConnectionHandle {
intptr_t keys[2];
static const GRPC_DLL ConnectionHandle kInvalid;
friend bool operator==(const ConnectionHandle& lhs,
const ConnectionHandle& rhs);
friend bool operator!=(const ConnectionHandle& lhs,
const ConnectionHandle& rhs);
};
/// Thin wrapper around a platform-specific sockaddr type. A sockaddr struct
/// exists on all platforms that gRPC supports.
@ -496,6 +490,19 @@ void EventEngineFactoryReset();
/// Create an EventEngine using the default factory.
std::unique_ptr<EventEngine> CreateEventEngine();
bool operator==(const EventEngine::TaskHandle& lhs,
const EventEngine::TaskHandle& rhs);
bool operator!=(const EventEngine::TaskHandle& lhs,
const EventEngine::TaskHandle& rhs);
std::ostream& operator<<(std::ostream& out,
const EventEngine::TaskHandle& handle);
bool operator==(const EventEngine::ConnectionHandle& lhs,
const EventEngine::ConnectionHandle& rhs);
bool operator!=(const EventEngine::ConnectionHandle& lhs,
const EventEngine::ConnectionHandle& rhs);
std::ostream& operator<<(std::ostream& out,
const EventEngine::ConnectionHandle& handle);
} // namespace experimental
} // namespace grpc_event_engine

View File

@ -398,6 +398,8 @@
* If unspecified, it is unlimited */
#define GRPC_ARG_MAX_ALLOWED_INCOMING_CONNECTIONS \
"grpc.max_allowed_incoming_connections"
/** Configure per-channel or per-server stats plugins. */
#define GRPC_ARG_EXPERIMENTAL_STATS_PLUGINS "grpc.experimental.stats_plugins"
/** \} */
#endif /* GRPC_IMPL_CHANNEL_ARG_NAMES_H */

View File

@ -82,6 +82,7 @@ struct gpr_log_func_args {
typedef struct gpr_log_func_args gpr_log_func_args;
typedef void (*gpr_log_func)(gpr_log_func_args* args);
GPRAPI void gpr_set_log_function(gpr_log_func func);
GPRAPI void gpr_assertion_failed(const char* filename, int line,

View File

@ -272,6 +272,9 @@
#define GPR_PLATFORM_STRING "ios"
#define GPR_CPU_IPHONE 1
#define GRPC_CFSTREAM 1
#ifndef GRPC_IOS_EVENT_ENGINE_CLIENT
#define GRPC_IOS_EVENT_ENGINE_CLIENT 1
#endif /* GRPC_IOS_EVENT_ENGINE_CLIENT */
/* the c-ares resolver isn't safe to enable on iOS */
#define GRPC_ARES 0
#else /* TARGET_OS_IPHONE */

View File

@ -26,17 +26,18 @@
#include "absl/functional/any_invocable.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "opentelemetry/metrics/meter_provider.h"
#include <grpc/support/metrics.h>
#include <grpc/support/port_platform.h>
#include <grpcpp/server_builder.h>
#include <grpcpp/support/channel_arguments.h>
namespace grpc {
namespace internal {
class OpenTelemetryPluginBuilderImpl;
class OpenTelemetryPlugin;
} // namespace internal
class OpenTelemetryPluginOption {
@ -44,6 +45,21 @@ class OpenTelemetryPluginOption {
virtual ~OpenTelemetryPluginOption() = default;
};
namespace experimental {
/// EXPERIMENTAL API
class OpenTelemetryPlugin {
public:
virtual ~OpenTelemetryPlugin() = default;
/// EXPERIMENTAL API
/// Adds this OpenTelemetryPlugin to the channel args \a args.
virtual void AddToChannelArguments(grpc::ChannelArguments* args) = 0;
/// EXPERIMENTAL API
/// Adds this OpenTelemetryPlugin to the channel arguments that will be used
/// to create the server through \a builder.
virtual void AddToServerBuilder(grpc::ServerBuilder* builder) = 0;
};
} // namespace experimental
/// The most common way to use this API is -
///
/// OpenTelemetryPluginBuilder().SetMeterProvider(provider).BuildAndRegister();
@ -113,8 +129,8 @@ class OpenTelemetryPluginBuilder {
/// If set, \a generic_method_attribute_filter is called per call with a
/// generic method type to decide whether to record the method name or to
/// replace it with "other". Non-generic or pre-registered methods remain
/// unaffected. If not set, by default, generic method names are replaced with
/// "other" when recording metrics.
/// unaffected. If not set, by default, generic method names are replaced
/// with "other" when recording metrics.
OpenTelemetryPluginBuilder& SetGenericMethodAttributeFilter(
absl::AnyInvocable<bool(absl::string_view /*generic_method*/) const>
generic_method_attribute_filter);
@ -139,9 +155,16 @@ class OpenTelemetryPluginBuilder {
OpenTelemetryPluginBuilder& SetChannelScopeFilter(
absl::AnyInvocable<bool(const ChannelScope& /*scope*/) const>
channel_scope_filter);
/// Registers a global plugin that acts on all channels and servers running on
/// the process.
/// Builds and registers a global plugin that acts on all channels and servers
/// running on the process. Must be called no more than once and must not be
/// called if Build() is called.
absl::Status BuildAndRegisterGlobal();
/// EXPERIMENTAL API
/// Builds an open telemetry plugin, returns the plugin object when succeeded
/// or an error status when failed. Must be called no more than once and must
/// not be called if BuildAndRegisterGlobal() is called.
GRPC_MUST_USE_RESULT
absl::StatusOr<std::shared_ptr<experimental::OpenTelemetryPlugin>> Build();
private:
std::unique_ptr<internal::OpenTelemetryPluginBuilderImpl> impl_;

21
package.xml generated
View File

@ -225,8 +225,6 @@
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/hpack_parser_table.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/http2_settings.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/http2_settings.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/http_trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/http_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/huffsyms.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/huffsyms.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/internal.h" role="src" />
@ -246,7 +244,6 @@
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/write_size_policy.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/write_size_policy.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/writing.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/inproc/inproc_plugin.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/inproc/inproc_transport.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/inproc/inproc_transport.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/inproc/legacy_inproc_transport.cc" role="src" />
@ -1091,8 +1088,6 @@
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder_impl.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder_impl.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/promise_based_filter.cc" role="src" />
@ -1115,6 +1110,9 @@
<file baseinstalldir="/" name="src/core/lib/debug/event_log.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace_flags.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace_flags.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace_impl.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/ares_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/ares_resolver.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/cf_engine/cf_engine.cc" role="src" />
@ -1207,7 +1205,6 @@
<file baseinstalldir="/" name="src/core/lib/event_engine/thready_event_engine/thready_event_engine.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/time_util.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/time_util.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/utils.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/utils.h" role="src" />
@ -1250,6 +1247,8 @@
<file baseinstalldir="/" name="src/core/lib/gprpp/examine_stack.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/fork.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/fork.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/glob.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/glob.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/host_port.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/host_port.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/if_list.h" role="src" />
@ -1339,7 +1338,6 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/event_engine_shims/closure.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/event_engine_shims/closure.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/event_engine_shims/endpoint.cc" role="src" />
@ -1482,8 +1480,6 @@
<file baseinstalldir="/" name="src/core/lib/promise/sleep.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/promise/sleep.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/promise/status_flag.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/promise/trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/promise/trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/promise/try_join.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/promise/try_seq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/api.cc" role="src" />
@ -1500,8 +1496,6 @@
<file baseinstalldir="/" name="src/core/lib/resource_quota/resource_quota.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/thread_quota.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/thread_quota.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/audit_logging.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/audit_logging.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/authorization_engine.h" role="src" />
@ -1626,11 +1620,9 @@
<file baseinstalldir="/" name="src/core/lib/slice/slice_buffer.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_buffer.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_refcount.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_refcount.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/byte_buffer.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/byte_buffer_reader.cc" role="src" />
@ -1639,7 +1631,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/call_details.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_log_batch.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_test_only.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_utils.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/channel.cc" role="src" />
@ -1807,8 +1798,6 @@
<file baseinstalldir="/" name="src/core/resolver/xds/xds_dependency_manager.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_resolver_attributes.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_resolver_trace.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_resolver_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/server/server.cc" role="src" />
<file baseinstalldir="/" name="src/core/server/server.h" role="src" />
<file baseinstalldir="/" name="src/core/server/server_call_tracer_filter.cc" role="src" />

View File

@ -547,7 +547,6 @@ grpc_cc_library(
"pipe",
"poll",
"promise_factory",
"promise_trace",
"try_seq",
"//:gpr",
"//:gpr_platform",
@ -577,11 +576,11 @@ grpc_cc_library(
"context",
"poll",
"promise_factory",
"promise_trace",
"ref_counted",
"//:event_engine_base_hdrs",
"//:exec_ctx",
"//:gpr",
"//:grpc_trace",
"//:ref_counted_ptr",
],
)
@ -796,9 +795,8 @@ grpc_cc_library(
"construct_destruct",
"poll",
"promise_like",
"promise_trace",
"//:gpr",
"//:gpr_platform",
"//:grpc_trace",
],
)
@ -887,9 +885,9 @@ grpc_cc_library(
"poll",
"promise_factory",
"promise_like",
"promise_trace",
"//:debug_location",
"//:gpr",
"//:grpc_trace",
],
)
@ -1025,8 +1023,8 @@ grpc_cc_library(
deps = [
"activity",
"poll",
"promise_trace",
"//:gpr",
"//:grpc_trace",
],
)
@ -1044,9 +1042,9 @@ grpc_cc_library(
deps = [
"activity",
"poll",
"promise_trace",
"wait_set",
"//:gpr",
"//:grpc_trace",
],
)
@ -1068,7 +1066,6 @@ grpc_cc_library(
"context",
"poll",
"promise_factory",
"promise_trace",
"//:debug_location",
"//:gpr",
],
@ -1095,7 +1092,6 @@ grpc_cc_library(
"interceptor_list",
"map",
"poll",
"promise_trace",
"seq",
"//:debug_location",
"//:gpr",
@ -1136,21 +1132,6 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "promise_trace",
srcs = [
"lib/promise/trace.cc",
],
hdrs = [
"lib/promise/trace.h",
],
language = "c++",
deps = [
"//:gpr_platform",
"//:grpc_trace",
],
)
grpc_cc_library(
name = "mpsc",
hdrs = [
@ -1205,10 +1186,10 @@ grpc_cc_library(
"poll",
"promise_factory",
"promise_status",
"promise_trace",
"status_flag",
"//:gpr",
"//:gpr_platform",
"//:grpc_trace",
],
)
@ -1445,7 +1426,6 @@ grpc_cc_library(
"periodic_update",
"poll",
"race",
"resource_quota_trace",
"seq",
"slice_refcount",
"time",
@ -1536,20 +1516,6 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "resource_quota_trace",
srcs = [
"lib/resource_quota/trace.cc",
],
hdrs = [
"lib/resource_quota/trace.h",
],
deps = [
"//:gpr_platform",
"//:grpc_trace",
],
)
grpc_cc_library(
name = "resource_quota",
srcs = [
@ -1578,9 +1544,6 @@ grpc_cc_library(
grpc_cc_library(
name = "slice_refcount",
srcs = [
"lib/slice/slice_refcount.cc",
],
hdrs = [
"lib/slice/slice_refcount.h",
],
@ -2493,6 +2456,7 @@ grpc_cc_library(
"ares_resolver",
"channel_args_endpoint_config",
"common_event_engine_closures",
"dump_args",
"error",
"event_engine_common",
"event_engine_tcp_socket_utils",
@ -2687,11 +2651,9 @@ grpc_cc_library(
],
)
# TODO(hork): delete this target when refactoring to GRPC_TRACE_LOG(flag, level)
grpc_cc_library(
name = "event_engine_trace",
srcs = [
"lib/event_engine/trace.cc",
],
hdrs = [
"lib/event_engine/trace.h",
],
@ -2732,6 +2694,7 @@ grpc_cc_library(
{
"//:windows": ["windows_event_engine"],
"//:windows_msvc": ["windows_event_engine"],
"//:windows_clang": ["windows_event_engine"],
"//:windows_other": ["windows_event_engine"],
"//:mac": [
"posix_event_engine",
@ -3105,21 +3068,6 @@ grpc_cc_library(
deps = ["//:gpr_platform"],
)
grpc_cc_library(
name = "channel_stack_trace",
srcs = [
"lib/channel/channel_stack_trace.cc",
],
hdrs = [
"lib/channel/channel_stack_trace.h",
],
language = "c++",
deps = [
"//:gpr_platform",
"//:grpc_trace",
],
)
grpc_cc_library(
name = "channel_init",
srcs = [
@ -3140,7 +3088,6 @@ grpc_cc_library(
"call_filters",
"channel_args",
"channel_fwd",
"channel_stack_trace",
"channel_stack_type",
"interception_chain",
"//:channel_stack_builder",
@ -4765,7 +4712,6 @@ grpc_cc_library(
"slice",
"slice_buffer",
"validation_errors",
"//:call_trace",
"//:channel_arg_names",
"//:config",
"//:gpr",
@ -4924,6 +4870,7 @@ grpc_cc_library(
"absl/container:inlined_vector",
"absl/functional:function_ref",
"absl/log:check",
"absl/log:globals",
"absl/log:log",
"absl/status",
"absl/status:statusor",
@ -5803,6 +5750,13 @@ grpc_cc_library(
deps = ["//:gpr"],
)
grpc_cc_library(
name = "glob",
srcs = ["lib/gprpp/glob.cc"],
hdrs = ["lib/gprpp/glob.h"],
external_deps = ["absl/strings"],
)
grpc_cc_library(
name = "status_conversion",
srcs = ["lib/transport/status_conversion.cc"],
@ -6579,21 +6533,6 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc_resolver_xds_trace",
srcs = [
"resolver/xds/xds_resolver_trace.cc",
],
hdrs = [
"resolver/xds/xds_resolver_trace.h",
],
language = "c++",
deps = [
"//:gpr_platform",
"//:grpc_trace",
],
)
grpc_cc_library(
name = "xds_dependency_manager",
srcs = [
@ -6612,7 +6551,6 @@ grpc_cc_library(
language = "c++",
deps = [
"grpc_lb_xds_channel_args",
"grpc_resolver_xds_trace",
"grpc_xds_client",
"match",
"ref_counted",
@ -6654,7 +6592,6 @@ grpc_cc_library(
"experiments",
"grpc_lb_policy_ring_hash",
"grpc_resolver_xds_attributes",
"grpc_resolver_xds_trace",
"grpc_service_config",
"grpc_xds_client",
"iomgr_fwd",
@ -7064,7 +7001,6 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc_transport_inproc",
srcs = [
"ext/transport/inproc/inproc_plugin.cc",
"ext/transport/inproc/inproc_transport.cc",
"ext/transport/inproc/legacy_inproc_transport.cc",
],
@ -7327,9 +7263,6 @@ grpc_cc_library(
grpc_cc_library(
name = "chaotic_good_transport",
srcs = [
"ext/transport/chaotic_good/chaotic_good_transport.cc",
],
hdrs = [
"ext/transport/chaotic_good/chaotic_good_transport.h",
],
@ -7893,6 +7826,7 @@ grpc_cc_library(
"absl/functional:function_ref",
"absl/log:check",
"absl/strings",
"absl/types:optional",
"absl/types:span",
],
language = "c++",

View File

@ -100,12 +100,6 @@ using grpc_event_engine::experimental::EventEngine;
using internal::ClientChannelMethodParsedConfig;
// Defined in legacy client channel filter.
// TODO(roth): Move these here when we remove the legacy filter.
extern TraceFlag grpc_client_channel_trace;
extern TraceFlag grpc_client_channel_call_trace;
extern TraceFlag grpc_client_channel_lb_call_trace;
//
// ClientChannel::ResolverResultHandler
//
@ -117,10 +111,9 @@ class ClientChannel::ResolverResultHandler : public Resolver::ResultHandler {
: client_channel_(std::move(client_channel)) {}
~ResolverResultHandler() override {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: resolver shutdown complete",
client_channel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << client_channel_.get()
<< ": resolver shutdown complete";
}
void ReportResult(Resolver::Result result) override
@ -236,14 +229,12 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
void OnConnectivityStateChange(
RefCountedPtr<ConnectivityStateWatcherInterface> self,
grpc_connectivity_state state, const absl::Status& status) override {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: connectivity change for subchannel "
"wrapper %p subchannel %p; hopping into work_serializer",
subchannel_wrapper_->client_channel_.get(),
subchannel_wrapper_.get(),
subchannel_wrapper_->subchannel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << subchannel_wrapper_->client_channel_.get()
<< ": connectivity change for subchannel wrapper "
<< subchannel_wrapper_.get() << " subchannel "
<< subchannel_wrapper_->subchannel_.get()
<< "; hopping into work_serializer";
self.release(); // Held by callback.
subchannel_wrapper_->client_channel_->work_serializer_->Run(
[this, state, status]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(
@ -261,16 +252,14 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
const absl::Status& status)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(
*subchannel_wrapper_->client_channel_->work_serializer_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: processing connectivity change in work "
"serializer for subchannel wrapper %p subchannel %p watcher=%p "
"state=%s status=%s",
subchannel_wrapper_->client_channel_.get(),
subchannel_wrapper_.get(), subchannel_wrapper_->subchannel_.get(),
watcher_.get(), ConnectivityStateName(state),
status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << subchannel_wrapper_->client_channel_.get()
<< ": processing connectivity change in work serializer for subchannel "
"wrapper "
<< subchannel_wrapper_.get() << " subchannel "
<< subchannel_wrapper_->subchannel_.get()
<< " watcher=" << watcher_.get()
<< "state=" << ConnectivityStateName(state) << " status=" << status;
absl::optional<absl::Cord> keepalive_throttling =
status.GetPayload(kKeepaliveThrottlingKey);
if (keepalive_throttling.has_value()) {
@ -281,12 +270,10 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
subchannel_wrapper_->client_channel_->keepalive_time_) {
subchannel_wrapper_->client_channel_->keepalive_time_ =
new_keepalive_time;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: throttling keepalive time to %d",
subchannel_wrapper_->client_channel_.get(),
subchannel_wrapper_->client_channel_->keepalive_time_);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << subchannel_wrapper_->client_channel_.get()
<< ": throttling keepalive time to "
<< subchannel_wrapper_->client_channel_->keepalive_time_;
// Propagate the new keepalive time to all subchannels. This is so
// that new transports created by any subchannel (and not just the
// subchannel that received the GOAWAY), use the new keepalive time.
@ -320,17 +307,14 @@ ClientChannel::SubchannelWrapper::SubchannelWrapper(
WeakRefCountedPtr<ClientChannel> client_channel,
RefCountedPtr<Subchannel> subchannel)
: SubchannelInterfaceWithCallDestination(
GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)
? "SubchannelWrapper"
: nullptr),
GRPC_TRACE_FLAG_ENABLED(client_channel) ? "SubchannelWrapper"
: nullptr),
client_channel_(std::move(client_channel)),
subchannel_(std::move(subchannel)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(
GPR_INFO,
"client_channel=%p: creating subchannel wrapper %p for subchannel %p",
client_channel_.get(), this, subchannel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << client_channel_.get()
<< ": creating subchannel wrapper " << this << " for subchannel "
<< subchannel_.get();
#ifndef NDEBUG
DCHECK(client_channel_->work_serializer_->RunningInWorkSerializer());
#endif
@ -353,12 +337,10 @@ ClientChannel::SubchannelWrapper::SubchannelWrapper(
}
ClientChannel::SubchannelWrapper::~SubchannelWrapper() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: destroying subchannel wrapper %p "
"for subchannel %p",
client_channel_.get(), this, subchannel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << client_channel_.get()
<< ": destroying subchannel wrapper " << this << " for subchannel "
<< subchannel_.get();
}
void ClientChannel::SubchannelWrapper::Orphaned() {
@ -467,7 +449,7 @@ class ClientChannel::ClientChannelControlHelper
RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker) override
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*client_channel_->work_serializer_) {
if (client_channel_->resolver_ == nullptr) return; // Shutting down.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel)) {
const char* extra = client_channel_->disconnect_error_.ok()
? ""
: " (ignoring -- channel shutting down)";
@ -486,10 +468,9 @@ class ClientChannel::ClientChannelControlHelper
void RequestReresolution() override
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*client_channel_->work_serializer_) {
if (client_channel_->resolver_ == nullptr) return; // Shutting down.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: started name re-resolving",
client_channel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << client_channel_.get()
<< ": started name re-resolving";
client_channel_->resolver_->RequestReresolutionLocked();
}
@ -644,9 +625,8 @@ ClientChannel::ClientChannel(
work_serializer_(std::make_shared<WorkSerializer>(event_engine_)),
state_tracker_("client_channel", GRPC_CHANNEL_IDLE),
subchannel_pool_(GetSubchannelPool(channel_args_)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: creating client_channel", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": creating client_channel";
// Set initial keepalive time.
auto keepalive_arg = channel_args_.GetInt(GRPC_ARG_KEEPALIVE_TIME_MS);
if (keepalive_arg.has_value()) {
@ -662,15 +642,13 @@ ClientChannel::ClientChannel(
}
ClientChannel::~ClientChannel() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: destroying", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": destroying";
}
void ClientChannel::Orphaned() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: shutting down", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": shutting down";
// Weird capture then copy needed to satisfy thread safety analysis,
// otherwise it seems to fail to recognize the correct lock is taken in the
// lambda.
@ -858,10 +836,9 @@ void ClientChannel::StartCall(UnstartedCallHandler unstarted_handler) {
}
void ClientChannel::CreateResolverLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: starting name resolution for %s",
this, uri_to_resolve_.c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": starting name resolution for "
<< uri_to_resolve_;
resolver_ = CoreConfiguration::Get().resolver_registry().CreateResolver(
uri_to_resolve_, channel_args_, nullptr, work_serializer_,
std::make_unique<ResolverResultHandler>(
@ -872,28 +849,24 @@ void ClientChannel::CreateResolverLocked() {
UpdateStateLocked(GRPC_CHANNEL_CONNECTING, absl::Status(),
"started resolving");
resolver_->StartLocked();
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: created resolver=%p", this,
resolver_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": created resolver=" << resolver_.get();
}
void ClientChannel::DestroyResolverAndLbPolicyLocked() {
if (resolver_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: shutting down resolver=%p", this,
resolver_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this
<< ": shutting down resolver=" << resolver_.get();
resolver_.reset();
saved_service_config_.reset();
saved_config_selector_.reset();
resolver_data_for_calls_.Set(ResolverDataForCalls{nullptr, nullptr});
// Clear LB policy if set.
if (lb_policy_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: shutting down lb_policy=%p", this,
lb_policy_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this
<< ": shutting down lb_policy=" << lb_policy_.get();
lb_policy_.reset();
picker_.Set(MakeRefCounted<LoadBalancingPolicy::DropPicker>(
absl::UnavailableError("Channel shutdown")));
@ -975,9 +948,8 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
// Handle race conditions.
if (resolver_ == nullptr) return;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: got resolver result", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": got resolver result";
// Grab resolver result health callback.
auto resolver_callback = std::move(result.result_health_callback);
absl::Status resolver_result_status;
@ -1011,20 +983,17 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
RefCountedPtr<ServiceConfig> service_config;
RefCountedPtr<ConfigSelector> config_selector;
if (!result.service_config.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: resolver returned service config error: %s",
this, result.service_config.status().ToString().c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this
<< ": resolver returned service config error: "
<< result.service_config.status();
// If the service config was invalid, then fallback to the
// previously returned service config, if any.
if (saved_service_config_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: resolver returned invalid service config; "
"continuing to use previous service config",
this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this
<< ": resolver returned invalid service config; "
"continuing to use previous service config";
service_config = saved_service_config_;
config_selector = saved_config_selector_;
} else {
@ -1038,12 +1007,10 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
}
} else if (*result.service_config == nullptr) {
// Resolver did not return any service config.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"client_channel=%p: resolver returned no service config; "
"using default service config for channel",
this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this
<< ": resolver returned no service config; using default service "
"config for channel";
service_config = default_service_config_;
} else {
// Use ServiceConfig and ConfigSelector returned by resolver.
@ -1078,8 +1045,9 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
// TODO(ncteisen): might be worth somehow including a snippet of the
// config in the trace, at the risk of bloating the trace logs.
trace_strings.push_back("Service config changed");
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: service config not changed", this);
} else {
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": service config not changed";
}
// Create or update LB policy, as needed.
resolver_result_status = CreateOrUpdateLbPolicyLocked(
@ -1110,10 +1078,9 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
void ClientChannel::OnResolverErrorLocked(absl::Status status) {
if (resolver_ == nullptr) return;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: resolver transient failure: %s", this,
status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this
<< ": resolver transient failure: " << status;
// If we already have an LB policy from a previous resolution
// result, then we continue to let it set the connectivity state.
// Otherwise, we go into TRANSIENT_FAILURE.
@ -1155,10 +1122,9 @@ absl::Status ClientChannel::CreateOrUpdateLbPolicyLocked(
lb_policy_ = CreateLbPolicyLocked(update_args.args);
}
// Update the policy.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: Updating child policy %p", this,
lb_policy_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": Updating child policy "
<< lb_policy_.get();
return lb_policy_->UpdateLocked(std::move(update_args));
}
@ -1181,11 +1147,10 @@ OrphanablePtr<LoadBalancingPolicy> ClientChannel::CreateLbPolicyLocked(
lb_policy_args.args = args;
OrphanablePtr<LoadBalancingPolicy> lb_policy =
MakeOrphanable<ChildPolicyHandler>(std::move(lb_policy_args),
&grpc_client_channel_trace);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: created new LB policy %p", this,
lb_policy.get());
}
&client_channel_trace);
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": created new LB policy "
<< lb_policy.get();
return lb_policy;
}
@ -1194,16 +1159,14 @@ void ClientChannel::UpdateServiceConfigInControlPlaneLocked(
RefCountedPtr<ConfigSelector> config_selector, std::string lb_policy_name) {
std::string service_config_json(service_config->json_string());
// Update service config.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: using service config: \"%s\"", this,
service_config_json.c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": using service config: \""
<< service_config_json << "\"";
saved_service_config_ = std::move(service_config);
// Update config selector.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: using ConfigSelector %p", this,
config_selector.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": using ConfigSelector "
<< config_selector.get();
saved_config_selector_ = std::move(config_selector);
// Update the data used by GetChannelInfo().
{
@ -1214,10 +1177,9 @@ void ClientChannel::UpdateServiceConfigInControlPlaneLocked(
}
void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: switching to ConfigSelector %p", this,
saved_config_selector_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": switching to ConfigSelector "
<< saved_config_selector_.get();
// Use default config selector if resolver didn't supply one.
RefCountedPtr<ConfigSelector> config_selector = saved_config_selector_;
if (config_selector == nullptr) {
@ -1279,9 +1241,8 @@ void ClientChannel::UpdateStateAndPickerLocked(
}
void ClientChannel::StartIdleTimer() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: idle timer started", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "client_channel=" << this << ": idle timer started";
auto self = WeakRefAsSubclass<ClientChannel>();
auto promise = Loop([self]() {
return TrySeq(Sleep(Timestamp::Now() + self->idle_timeout_),
@ -1316,10 +1277,9 @@ void ClientChannel::StartIdleTimer() {
absl::Status ClientChannel::ApplyServiceConfigToCall(
ConfigSelector& config_selector,
ClientMetadata& client_initial_metadata) const {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "client_channel=%p: %sapplying service config to call",
this, GetContext<Activity>()->DebugTag().c_str());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "client_channel=" << this << ": " << GetContext<Activity>()->DebugTag()
<< " service config to call";
// Create a ClientChannelServiceConfigCallData for the call. This stores
// a ref to the ServiceConfig and caches the right set of parsed configs
// to use for the call. The ClientChannelServiceConfigCallData will store

View File

@ -113,10 +113,6 @@ namespace grpc_core {
using internal::ClientChannelMethodParsedConfig;
TraceFlag grpc_client_channel_trace(false, "client_channel");
TraceFlag grpc_client_channel_call_trace(false, "client_channel_call");
TraceFlag grpc_client_channel_lb_call_trace(false, "client_channel_lb_call");
//
// ClientChannelFilter::CallData definition
//
@ -411,11 +407,9 @@ class DynamicTerminationFilter::CallData final {
args, pollent, nullptr,
[service_config_call_data]() { service_config_call_data->Commit(); },
/*is_transparent_retry=*/false);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p dynamic_termination_calld=%p: create lb_call=%p", chand,
client_channel, calld->lb_call_.get());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " dynamic_termination_calld=" << client_channel
<< ": create lb_call=" << calld->lb_call_.get();
}
private:
@ -466,9 +460,8 @@ class ClientChannelFilter::ResolverResultHandler final
}
~ResolverResultHandler() override {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: resolver shutdown complete", chand_);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << chand_ << ": resolver shutdown complete";
GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "ResolverResultHandler");
}
@ -498,16 +491,14 @@ class ClientChannelFilter::SubchannelWrapper final
public:
SubchannelWrapper(ClientChannelFilter* chand,
RefCountedPtr<Subchannel> subchannel)
: SubchannelInterface(GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)
: SubchannelInterface(GRPC_TRACE_FLAG_ENABLED(client_channel)
? "SubchannelWrapper"
: nullptr),
chand_(chand),
subchannel_(std::move(subchannel)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"chand=%p: creating subchannel wrapper %p for subchannel %p",
chand, this, subchannel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << chand << ": creating subchannel wrapper " << this
<< " for subchannel " << subchannel_.get();
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper");
#ifndef NDEBUG
DCHECK(chand_->work_serializer_->RunningInWorkSerializer());
@ -528,11 +519,9 @@ class ClientChannelFilter::SubchannelWrapper final
}
~SubchannelWrapper() override {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"chand=%p: destroying subchannel wrapper %p for subchannel %p",
chand_, this, subchannel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << chand_ << ": destroying subchannel wrapper " << this
<< "for subchannel " << subchannel_.get();
if (!IsWorkSerializerDispatchEnabled()) {
chand_->subchannel_wrappers_.erase(this);
if (chand_->channelz_node_ != nullptr) {
@ -665,12 +654,11 @@ class ClientChannelFilter::SubchannelWrapper final
void OnConnectivityStateChange(
RefCountedPtr<ConnectivityStateWatcherInterface> self,
grpc_connectivity_state state, const absl::Status& status) override {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"chand=%p: connectivity change for subchannel wrapper %p "
"subchannel %p; hopping into work_serializer",
parent_->chand_, parent_.get(), parent_->subchannel_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << parent_->chand_
<< ": connectivity change for subchannel wrapper " << parent_.get()
<< " subchannel " << parent_->subchannel_.get()
<< "hopping into work_serializer";
self.release(); // Held by callback.
parent_->chand_->work_serializer_->Run(
[this, state, status]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(
@ -689,15 +677,13 @@ class ClientChannelFilter::SubchannelWrapper final
void ApplyUpdateInControlPlaneWorkSerializer(grpc_connectivity_state state,
const absl::Status& status)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*parent_->chand_->work_serializer_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"chand=%p: processing connectivity change in work serializer "
"for subchannel wrapper %p subchannel %p watcher=%p "
"state=%s status=%s",
parent_->chand_, parent_.get(), parent_->subchannel_.get(),
watcher_.get(), ConnectivityStateName(state),
status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << parent_->chand_
<< ": processing connectivity change in work serializer for "
"subchannel wrapper "
<< parent_.get() << " subchannel " << parent_->subchannel_.get()
<< " watcher=" << watcher_.get()
<< " state=" << ConnectivityStateName(state) << " status=" << status;
absl::optional<absl::Cord> keepalive_throttling =
status.GetPayload(kKeepaliveThrottlingKey);
if (keepalive_throttling.has_value()) {
@ -706,10 +692,10 @@ class ClientChannelFilter::SubchannelWrapper final
&new_keepalive_time)) {
if (new_keepalive_time > parent_->chand_->keepalive_time_) {
parent_->chand_->keepalive_time_ = new_keepalive_time;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: throttling keepalive time to %d",
parent_->chand_, parent_->chand_->keepalive_time_);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << parent_->chand_
<< ": throttling keepalive time to "
<< parent_->chand_->keepalive_time_;
// Propagate the new keepalive time to all subchannels. This is so
// that new transports created by any subchannel (and not just the
// subchannel that received the GOAWAY), use the new keepalive time.
@ -992,14 +978,13 @@ class ClientChannelFilter::ClientChannelControlHelper final
RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker)
override ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
if (chand_->resolver_ == nullptr) return; // Shutting down.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
const char* extra = chand_->disconnect_error_.ok()
? ""
: " (ignoring -- channel shutting down)";
gpr_log(GPR_INFO, "chand=%p: update: state=%s status=(%s) picker=%p%s",
chand_, ConnectivityStateName(state), status.ToString().c_str(),
picker.get(), extra);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << chand_
<< ": update: state=" << ConnectivityStateName(state) << " status=("
<< status << ") picker=" << picker.get()
<< (chand_->disconnect_error_.ok()
? ""
: " (ignoring -- channel shutting down)");
// Do update only if not shutting down.
if (chand_->disconnect_error_.ok()) {
chand_->UpdateStateAndPickerLocked(state, status, "helper",
@ -1010,9 +995,8 @@ class ClientChannelFilter::ClientChannelControlHelper final
void RequestReresolution() override
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
if (chand_->resolver_ == nullptr) return; // Shutting down.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: started name re-resolving", chand_);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << chand_ << ": started name re-resolving";
chand_->resolver_->RequestReresolutionLocked();
}
@ -1104,10 +1088,9 @@ ClientChannelFilter::ClientChannelFilter(grpc_channel_element_args* args,
std::make_shared<WorkSerializer>(*args->channel_stack->event_engine)),
state_tracker_("client_channel", GRPC_CHANNEL_IDLE),
subchannel_pool_(GetSubchannelPool(channel_args_)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: creating client_channel for channel stack %p",
this, owning_stack_);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": creating client_channel for channel stack "
<< owning_stack_;
// Start backup polling.
grpc_client_channel_start_backup_polling(interested_parties_);
// Check client channel factory.
@ -1176,9 +1159,8 @@ ClientChannelFilter::ClientChannelFilter(grpc_channel_element_args* args,
}
ClientChannelFilter::~ClientChannelFilter() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: destroying channel", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": destroying channel";
DestroyResolverAndLbPolicyLocked();
// Stop backup polling.
grpc_client_channel_stop_backup_polling(interested_parties_);
@ -1270,9 +1252,8 @@ void ClientChannelFilter::OnResolverResultChangedLocked(
Resolver::Result result) {
// Handle race conditions.
if (resolver_ == nullptr) return;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: got resolver result", this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": got resolver result";
// Grab resolver result health callback.
auto resolver_callback = std::move(result.result_health_callback);
absl::Status resolver_result_status;
@ -1306,19 +1287,16 @@ void ClientChannelFilter::OnResolverResultChangedLocked(
RefCountedPtr<ServiceConfig> service_config;
RefCountedPtr<ConfigSelector> config_selector;
if (!result.service_config.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: resolver returned service config error: %s",
this, result.service_config.status().ToString().c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": resolver returned service config error: "
<< result.service_config.status();
// If the service config was invalid, then fallback to the
// previously returned service config.
if (saved_service_config_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"chand=%p: resolver returned invalid service config. "
"Continuing to use previous service config.",
this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this
<< ": resolver returned invalid service config. "
"Continuing to use previous service config.";
service_config = saved_service_config_;
config_selector = saved_config_selector_;
} else {
@ -1332,12 +1310,10 @@ void ClientChannelFilter::OnResolverResultChangedLocked(
}
} else if (*result.service_config == nullptr) {
// Resolver did not return any service config.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO,
"chand=%p: resolver returned no service config. Using default "
"service config for channel.",
this);
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this
<< ": resolver returned no service config. Using default service "
"config for channel.";
service_config = default_service_config_;
} else {
// Use ServiceConfig and ConfigSelector returned by resolver.
@ -1369,8 +1345,9 @@ void ClientChannelFilter::OnResolverResultChangedLocked(
UpdateServiceConfigInControlPlaneLocked(
std::move(service_config), std::move(config_selector),
std::string(lb_policy_config->name()));
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: service config not changed", this);
} else {
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": service config not changed";
}
// Create or update LB policy, as needed.
resolver_result_status = CreateOrUpdateLbPolicyLocked(
@ -1404,10 +1381,8 @@ void ClientChannelFilter::OnResolverResultChangedLocked(
void ClientChannelFilter::OnResolverErrorLocked(absl::Status status) {
if (resolver_ == nullptr) return;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: resolver transient failure: %s", this,
status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": resolver transient failure: " << status;
// If we already have an LB policy from a previous resolution
// result, then we continue to let it set the connectivity state.
// Otherwise, we go into TRANSIENT_FAILURE.
@ -1453,10 +1428,8 @@ absl::Status ClientChannelFilter::CreateOrUpdateLbPolicyLocked(
lb_policy_ = CreateLbPolicyLocked(update_args.args);
}
// Update the policy.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: Updating child policy %p", this,
lb_policy_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": Updating child policy " << lb_policy_.get();
return lb_policy_->UpdateLocked(std::move(update_args));
}
@ -1478,11 +1451,9 @@ OrphanablePtr<LoadBalancingPolicy> ClientChannelFilter::CreateLbPolicyLocked(
lb_policy_args.args = args;
OrphanablePtr<LoadBalancingPolicy> lb_policy =
MakeOrphanable<ChildPolicyHandler>(std::move(lb_policy_args),
&grpc_client_channel_trace);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: created new LB policy %p", this,
lb_policy.get());
}
&client_channel_trace);
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": created new LB policy " << lb_policy.get();
grpc_pollset_set_add_pollset_set(lb_policy->interested_parties(),
interested_parties_);
return lb_policy;
@ -1492,10 +1463,9 @@ void ClientChannelFilter::UpdateServiceConfigInControlPlaneLocked(
RefCountedPtr<ServiceConfig> service_config,
RefCountedPtr<ConfigSelector> config_selector, std::string lb_policy_name) {
std::string service_config_json(service_config->json_string());
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: using service config: \"%s\"", this,
service_config_json.c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": using service config: \"" << service_config_json
<< "\"";
// Save service config.
saved_service_config_ = std::move(service_config);
// Swap out the data used by GetChannelInfo().
@ -1506,10 +1476,9 @@ void ClientChannelFilter::UpdateServiceConfigInControlPlaneLocked(
}
// Save config selector.
saved_config_selector_ = std::move(config_selector);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: using ConfigSelector %p", this,
saved_config_selector_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": using ConfigSelector "
<< saved_config_selector_.get();
}
void ClientChannelFilter::UpdateServiceConfigInDataPlaneLocked() {
@ -1517,10 +1486,9 @@ void ClientChannelFilter::UpdateServiceConfigInDataPlaneLocked() {
RefCountedPtr<ServiceConfig> service_config = saved_service_config_;
// Grab ref to config selector. Use default if resolver didn't supply one.
RefCountedPtr<ConfigSelector> config_selector = saved_config_selector_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: switching to ConfigSelector %p", this,
saved_config_selector_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": switching to ConfigSelector "
<< saved_config_selector_.get();
if (config_selector == nullptr) {
config_selector =
MakeRefCounted<DefaultConfigSelector>(saved_service_config_);
@ -1562,10 +1530,9 @@ void ClientChannelFilter::UpdateServiceConfigInDataPlaneLocked() {
}
void ClientChannelFilter::CreateResolverLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: starting name resolution for %s", this,
uri_to_resolve_.c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": starting name resolution for "
<< uri_to_resolve_;
resolver_ = CoreConfiguration::Get().resolver_registry().CreateResolver(
uri_to_resolve_, channel_args_, interested_parties_, work_serializer_,
std::make_unique<ResolverResultHandler>(this));
@ -1575,17 +1542,14 @@ void ClientChannelFilter::CreateResolverLocked() {
UpdateStateLocked(GRPC_CHANNEL_CONNECTING, absl::Status(),
"started resolving");
resolver_->StartLocked();
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: created resolver=%p", this, resolver_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": created resolver=" << resolver_.get();
}
void ClientChannelFilter::DestroyResolverAndLbPolicyLocked() {
if (resolver_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: shutting down resolver=%p", this,
resolver_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": shutting down resolver=" << resolver_.get();
resolver_.reset();
// Clear resolution state.
saved_service_config_.reset();
@ -1605,10 +1569,9 @@ void ClientChannelFilter::DestroyResolverAndLbPolicyLocked() {
}
// Clear LB policy if set.
if (lb_policy_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: shutting down lb_policy=%p", this,
lb_policy_.get());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this
<< ": shutting down lb_policy=" << lb_policy_.get();
grpc_pollset_set_del_pollset_set(lb_policy_->interested_parties(),
interested_parties_);
lb_policy_.reset();
@ -1754,10 +1717,9 @@ void ClientChannelFilter::StartTransportOpLocked(grpc_transport_op* op) {
}
// Disconnect or enter IDLE.
if (!op->disconnect_with_error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
StatusToString(op->disconnect_with_error).c_str());
}
GRPC_TRACE_LOG(client_channel, INFO)
<< "chand=" << this << ": disconnect_with_error: "
<< StatusToString(op->disconnect_with_error);
DestroyResolverAndLbPolicyLocked();
intptr_t value;
if (grpc_error_get_int(op->disconnect_with_error,
@ -1862,11 +1824,9 @@ void ClientChannelFilter::RemoveConnectivityWatcher(
//
void ClientChannelFilter::CallData::RemoveCallFromResolverQueuedCallsLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: removing from resolver queued picks list",
chand(), this);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": removing from resolver queued picks list";
// Remove call's pollent from channel's interested_parties.
grpc_polling_entity_del_from_pollset_set(pollent(),
chand()->interested_parties_);
@ -1877,12 +1837,10 @@ void ClientChannelFilter::CallData::RemoveCallFromResolverQueuedCallsLocked() {
}
void ClientChannelFilter::CallData::AddCallToResolverQueuedCallsLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(
GPR_INFO,
"chand=%p calld=%p: adding to resolver queued picks list; pollent=%s",
chand(), this, grpc_polling_entity_string(pollent()).c_str());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": adding to resolver queued picks list; pollent="
<< grpc_polling_entity_string(pollent());
// Add call's pollent to channel's interested_parties, so that I/O
// can be done under the call's CQ.
grpc_polling_entity_add_to_pollset_set(pollent(),
@ -1894,10 +1852,9 @@ void ClientChannelFilter::CallData::AddCallToResolverQueuedCallsLocked() {
grpc_error_handle ClientChannelFilter::CallData::ApplyServiceConfigToCallLocked(
const absl::StatusOr<RefCountedPtr<ConfigSelector>>& config_selector) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: applying service config to call",
chand(), this);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": applying service config to call";
if (!config_selector.ok()) return config_selector.status();
// Create a ClientChannelServiceConfigCallData for the call. This stores
// a ref to the ServiceConfig and caches the right set of parsed configs
@ -1962,11 +1919,9 @@ absl::optional<absl::Status> ClientChannelFilter::CallData::CheckResolution(
}
// Handle errors.
if (!error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: error applying config to call: error=%s",
chand(), this, StatusToString(error).c_str());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": error applying config to call: error=" << StatusToString(error);
return error;
}
// If the call was queued, add trace annotation.
@ -1989,20 +1944,18 @@ bool ClientChannelFilter::CallData::CheckResolutionLocked(
absl::Status resolver_error = chand()->resolver_transient_failure_error_;
if (!resolver_error.ok() &&
!send_initial_metadata()->GetOrCreatePointer(WaitForReady())->value) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: resolution failed, failing call",
chand(), this);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": resolution failed, failing call";
*config_selector = absl_status_to_grpc_error(resolver_error);
return true;
}
// Either the resolver has not yet returned a result, or it has
// returned transient failure but the call is wait_for_ready. In
// either case, queue the call.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: no resolver result yet", chand(),
this);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": no resolver result yet";
return false;
}
// Result found.
@ -2024,9 +1977,8 @@ ClientChannelFilter::FilterBasedCallData::FilterBasedCallData(
elem_(elem),
owning_call_(args.call_stack),
call_combiner_(args.call_combiner) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: created call", chand(), this);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this << ": created call";
}
ClientChannelFilter::FilterBasedCallData::~FilterBasedCallData() {
@ -2062,8 +2014,8 @@ void ClientChannelFilter::FilterBasedCallData::StartTransportStreamOpBatch(
grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
auto* calld = static_cast<FilterBasedCallData*>(elem->call_data);
auto* chand = static_cast<ClientChannelFilter*>(elem->channel_data);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace) &&
!GRPC_TRACE_FLAG_ENABLED(grpc_trace_channel)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel_call) &&
!GRPC_TRACE_FLAG_ENABLED(channel)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: batch started from above: %s", chand,
calld, grpc_transport_stream_op_batch_string(batch, false).c_str());
}
@ -2082,10 +2034,9 @@ void ClientChannelFilter::FilterBasedCallData::StartTransportStreamOpBatch(
// Note that once we have done so, we do not need to acquire the channel's
// resolution mutex, which is more efficient (especially for streaming calls).
if (calld->dynamic_call_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: starting batch on dynamic_call=%p",
chand, calld, calld->dynamic_call_.get());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": starting batch on dynamic_call=" << calld->dynamic_call_.get();
calld->dynamic_call_->StartTransportStreamOpBatch(batch);
return;
}
@ -2093,10 +2044,10 @@ void ClientChannelFilter::FilterBasedCallData::StartTransportStreamOpBatch(
//
// If we've previously been cancelled, immediately fail any new batches.
if (GPR_UNLIKELY(!calld->cancel_error_.ok())) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: failing batch with error: %s",
chand, calld, StatusToString(calld->cancel_error_).c_str());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": failing batch with error: "
<< StatusToString(calld->cancel_error_);
// Note: This will release the call combiner.
grpc_transport_stream_op_batch_finish_with_failure(
batch, calld->cancel_error_, calld->call_combiner());
@ -2110,10 +2061,9 @@ void ClientChannelFilter::FilterBasedCallData::StartTransportStreamOpBatch(
// is in the past when the call starts), we can return the right
// error to the caller when the first batch does get passed down.
calld->cancel_error_ = batch->payload->cancel_stream.cancel_error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: recording cancel_error=%s", chand,
calld, StatusToString(calld->cancel_error_).c_str());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": recording cancel_error=" << StatusToString(calld->cancel_error_);
// Fail all pending batches.
calld->PendingBatchesFail(calld->cancel_error_, NoYieldCallCombiner);
// Note: This will release the call combiner.
@ -2127,19 +2077,15 @@ void ClientChannelFilter::FilterBasedCallData::StartTransportStreamOpBatch(
// channel's resolution mutex to apply the service config to the call,
// after which we will create a dynamic call.
if (GPR_LIKELY(batch->send_initial_metadata)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: grabbing resolution mutex to apply service "
"config",
chand, calld);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": grabbing resolution mutex to apply service ";
// If we're still in IDLE, we need to start resolving.
if (GPR_UNLIKELY(chand->CheckConnectivityState(false) ==
GRPC_CHANNEL_IDLE)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: triggering exit idle", chand,
calld);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": triggering exit idle";
// Bounce into the control plane work serializer to start resolving.
GRPC_CHANNEL_STACK_REF(chand->owning_stack_, "ExitIdle");
chand->work_serializer_->Run(
@ -2152,11 +2098,9 @@ void ClientChannelFilter::FilterBasedCallData::StartTransportStreamOpBatch(
calld->TryCheckResolution(/*was_queued=*/false);
} else {
// For all other batches, release the call combiner.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: saved batch, yielding call combiner", chand,
calld);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": saved batch, yielding call combiner";
GRPC_CALL_COMBINER_STOP(calld->call_combiner(),
"batch does not include send_initial_metadata");
}
@ -2185,11 +2129,9 @@ size_t ClientChannelFilter::FilterBasedCallData::GetBatchIndex(
void ClientChannelFilter::FilterBasedCallData::PendingBatchesAdd(
grpc_transport_stream_op_batch* batch) {
const size_t idx = GetBatchIndex(batch);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: adding pending batch at index %" PRIuPTR,
chand(), this, idx);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": adding pending batch at index " << idx;
grpc_transport_stream_op_batch*& pending = pending_batches_[idx];
CHECK_EQ(pending, nullptr);
pending = batch;
@ -2212,7 +2154,7 @@ void ClientChannelFilter::FilterBasedCallData::PendingBatchesFail(
grpc_error_handle error,
YieldCallCombinerPredicate yield_call_combiner_predicate) {
CHECK(!error.ok());
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel_call)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
if (pending_batches_[i] != nullptr) ++num_batches;
@ -2255,7 +2197,7 @@ void ClientChannelFilter::FilterBasedCallData::ResumePendingBatchInCallCombiner(
// This is called via the call combiner, so access to calld is synchronized.
void ClientChannelFilter::FilterBasedCallData::PendingBatchesResume() {
// Retries not enabled; send down batches as-is.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel_call)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
if (pending_batches_[i] != nullptr) ++num_batches;
@ -2301,13 +2243,13 @@ class ClientChannelFilter::FilterBasedCallData::ResolverQueuedCallCanceller
auto* chand = calld->chand();
{
MutexLock lock(&chand->resolution_mu_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: cancelling resolver queued pick: "
"error=%s self=%p calld->resolver_pick_canceller=%p",
chand, calld, StatusToString(error).c_str(), self,
calld->resolver_call_canceller_);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": cancelling resolver queued pick: "
"error="
<< StatusToString(error) << " self=" << self
<< " calld->resolver_pick_canceller="
<< calld->resolver_call_canceller_;
if (calld->resolver_call_canceller_ == self && !error.ok()) {
// Remove pick from list of queued picks.
calld->RemoveCallFromResolverQueuedCallsLocked();
@ -2360,19 +2302,14 @@ void ClientChannelFilter::FilterBasedCallData::CreateDynamicCall() {
call_combiner()};
grpc_error_handle error;
DynamicFilters* channel_stack = args.channel_stack.get();
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(
GPR_INFO,
"chand=%p calld=%p: creating dynamic call stack on channel_stack=%p",
chand(), this, channel_stack);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": creating dynamic call stack on channel_stack=" << channel_stack;
dynamic_call_ = channel_stack->CreateCall(std::move(args), &error);
if (!error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: failed to create dynamic call: error=%s",
chand(), this, StatusToString(error).c_str());
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand() << " calld=" << this
<< ": failed to create dynamic call: error=" << StatusToString(error);
PendingBatchesFail(error, YieldCallCombiner);
return;
}
@ -2385,13 +2322,10 @@ void ClientChannelFilter::FilterBasedCallData::
auto* calld = static_cast<FilterBasedCallData*>(arg);
auto* chand = calld->chand();
auto* service_config_call_data = GetServiceConfigCallData(calld->arena());
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: got recv_trailing_metadata_ready: error=%s "
"service_config_call_data=%p",
chand, calld, StatusToString(error).c_str(),
service_config_call_data);
}
GRPC_TRACE_LOG(client_channel_call, INFO)
<< "chand=" << chand << " calld=" << calld
<< ": got recv_trailing_metadata_ready: error=" << StatusToString(error)
<< " service_config_call_data=" << service_config_call_data;
if (service_config_call_data != nullptr) {
service_config_call_data->Commit();
}
@ -2578,17 +2512,15 @@ void CreateCallAttemptTracer(Arena* arena, bool is_transparent_retry) {
ClientChannelFilter::LoadBalancedCall::LoadBalancedCall(
ClientChannelFilter* chand, Arena* arena,
absl::AnyInvocable<void()> on_commit, bool is_transparent_retry)
: InternallyRefCounted(
GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)
? "LoadBalancedCall"
: nullptr),
: InternallyRefCounted(GRPC_TRACE_FLAG_ENABLED(client_channel_lb_call)
? "LoadBalancedCall"
: nullptr),
chand_(chand),
on_commit_(std::move(on_commit)),
arena_(arena) {
CreateCallAttemptTracer(arena, is_transparent_retry);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: created", chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this << ": created";
}
ClientChannelFilter::LoadBalancedCall::~LoadBalancedCall() {
@ -2629,10 +2561,9 @@ void ClientChannelFilter::LoadBalancedCall::RecordLatency() {
void ClientChannelFilter::LoadBalancedCall::
RemoveCallFromLbQueuedCallsLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: removing from queued picks list",
chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": removing from queued picks list";
// Remove pollset_set linkage.
grpc_polling_entity_del_from_pollset_set(pollent(),
chand_->interested_parties_);
@ -2643,10 +2574,9 @@ void ClientChannelFilter::LoadBalancedCall::
}
void ClientChannelFilter::LoadBalancedCall::AddCallToLbQueuedCallsLocked() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: adding to queued picks list",
chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": adding to queued picks list";
// Add call's pollent to channel's interested_parties, so that I/O
// can be done under the call's CQ.
grpc_polling_entity_add_to_pollset_set(pollent(),
@ -2688,10 +2618,9 @@ ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool was_queued) {
};
}
// Grab mutex and take a ref to the picker.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: grabbing LB mutex to get picker",
chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": grabbing LB mutex to get picker";
RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker;
{
MutexLock lock(&chand_->lb_mu_);
@ -2701,17 +2630,15 @@ ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool was_queued) {
// TODO(roth): Fix race condition in channel_idle filter and any
// other possible causes of this.
if (pickers.back() == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_ERROR, "chand=%p lb_call=%p: picker is null, failing call",
chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": picker is null, failing call";
return absl::InternalError("picker is null -- shouldn't happen");
}
// Do pick.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: performing pick with picker=%p",
chand_, this, pickers.back().get());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": performing pick with picker=" << pickers.back().get();
grpc_error_handle error;
bool pick_complete = PickSubchannelImpl(pickers.back().get(), &error);
if (!pick_complete) {
@ -2719,11 +2646,9 @@ ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool was_queued) {
MutexLock lock(&chand_->lb_mu_);
// If picker has been swapped out since we grabbed it, try again.
if (pickers.back() != chand_->picker_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: pick not complete, but picker changed",
chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": pick not complete, but picker changed";
if (IsWorkSerializerDispatchEnabled()) {
// Don't unref until after we release the mutex.
old_picker = std::move(pickers.back());
@ -2742,11 +2667,9 @@ ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool was_queued) {
}
// If the pick failed, fail the call.
if (!error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: failed to pick subchannel: error=%s",
chand_, this, StatusToString(error).c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": failed to pick subchannel: error=" << StatusToString(error);
return error;
}
// Pick succeeded.
@ -2772,11 +2695,10 @@ bool ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(
&result,
// CompletePick
[this](LoadBalancingPolicy::PickResult::Complete* complete_pick) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: LB pick succeeded: subchannel=%p",
chand_, this, complete_pick->subchannel.get());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": LB pick succeeded: subchannel="
<< complete_pick->subchannel.get();
CHECK(complete_pick->subchannel != nullptr);
// Grab a ref to the connected subchannel while we're still
// holding the data plane mutex.
@ -2788,12 +2710,10 @@ bool ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(
// yet seen that change and given us a new picker), then just
// queue the pick. We'll try again as soon as we get a new picker.
if (connected_subchannel_ == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: subchannel returned by LB picker "
"has no connected subchannel; queueing pick",
chand_, this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": subchannel returned by LB picker "
"has no connected subchannel; queueing pick";
return false;
}
lb_subchannel_call_tracker_ =
@ -2805,18 +2725,15 @@ bool ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(
},
// QueuePick
[this](LoadBalancingPolicy::PickResult::Queue* /*queue_pick*/) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: LB pick queued", chand_,
this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this << ": LB pick queued";
return false;
},
// FailPick
[this, &error](LoadBalancingPolicy::PickResult::Fail* fail_pick) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: LB pick failed: %s", chand_,
this, fail_pick->status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": LB pick failed: " << fail_pick->status;
// If wait_for_ready is false, then the error indicates the RPC
// attempt's final status.
if (!send_initial_metadata()
@ -2832,10 +2749,9 @@ bool ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(
},
// DropPick
[this, &error](LoadBalancingPolicy::PickResult::Drop* drop_pick) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: LB pick dropped: %s", chand_,
this, drop_pick->status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand_ << " lb_call=" << this
<< ": LB pick dropped: " << drop_pick->status;
*error = grpc_error_set_int(
absl_status_to_grpc_error(MaybeRewriteIllegalStatusCode(
std::move(drop_pick->status), "LB drop")),
@ -2901,11 +2817,9 @@ size_t ClientChannelFilter::FilterBasedLoadBalancedCall::GetBatchIndex(
void ClientChannelFilter::FilterBasedLoadBalancedCall::PendingBatchesAdd(
grpc_transport_stream_op_batch* batch) {
const size_t idx = GetBatchIndex(batch);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: adding pending batch at index %" PRIuPTR,
chand(), this, idx);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand() << " lb_call=" << this
<< ": adding pending batch at index " << idx;
CHECK_EQ(pending_batches_[idx], nullptr);
pending_batches_[idx] = batch;
}
@ -2928,7 +2842,7 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::PendingBatchesFail(
YieldCallCombinerPredicate yield_call_combiner_predicate) {
CHECK(!error.ok());
failure_error_ = error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel_lb_call)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
if (pending_batches_[i] != nullptr) ++num_batches;
@ -2970,7 +2884,7 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
// This is called via the call combiner, so access to calld is synchronized.
void ClientChannelFilter::FilterBasedLoadBalancedCall::PendingBatchesResume() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel_lb_call)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
if (pending_batches_[i] != nullptr) ++num_batches;
@ -2999,8 +2913,8 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::PendingBatchesResume() {
void ClientChannelFilter::FilterBasedLoadBalancedCall::
StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_trace_channel)) {
if (GRPC_TRACE_FLAG_ENABLED(client_channel_lb_call) ||
GRPC_TRACE_FLAG_ENABLED(channel)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: batch started from above: %s, "
"call_attempt_tracer()=%p",
@ -3054,11 +2968,9 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
// the channel's data plane mutex, which is more efficient (especially for
// streaming calls).
if (subchannel_call_ != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: starting batch on subchannel_call=%p",
chand(), this, subchannel_call_.get());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand() << " lb_call=" << this
<< ": starting batch on subchannel_call=" << subchannel_call_.get();
subchannel_call_->StartTransportStreamOpBatch(batch);
return;
}
@ -3066,10 +2978,9 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
//
// If we've previously been cancelled, immediately fail any new batches.
if (GPR_UNLIKELY(!cancel_error_.ok())) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: failing batch with error: %s",
chand(), this, StatusToString(cancel_error_).c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand() << " lb_call=" << this
<< ": failing batch with error: " << StatusToString(cancel_error_);
// Note: This will release the call combiner.
grpc_transport_stream_op_batch_finish_with_failure(batch, cancel_error_,
call_combiner_);
@ -3083,10 +2994,9 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
// is in the past when the call starts), we can return the right
// error to the caller when the first batch does get passed down.
cancel_error_ = batch->payload->cancel_stream.cancel_error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "chand=%p lb_call=%p: recording cancel_error=%s",
chand(), this, StatusToString(cancel_error_).c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand() << " lb_call=" << this
<< ": recording cancel_error=" << StatusToString(cancel_error_).c_str();
// Fail all pending batches.
PendingBatchesFail(cancel_error_, NoYieldCallCombiner);
// Note: This will release the call combiner.
@ -3102,11 +3012,9 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
TryPick(/*was_queued=*/false);
} else {
// For all other batches, release the call combiner.
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: saved batch, yielding call combiner",
chand(), this);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand() << " lb_call=" << this
<< ": saved batch, yielding call combiner";
GRPC_CALL_COMBINER_STOP(call_combiner_,
"batch does not include send_initial_metadata");
}
@ -3115,11 +3023,9 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
void ClientChannelFilter::FilterBasedLoadBalancedCall::RecvInitialMetadataReady(
void* arg, grpc_error_handle error) {
auto* self = static_cast<FilterBasedLoadBalancedCall*>(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: got recv_initial_metadata_ready: error=%s",
self->chand(), self, StatusToString(error).c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << self->chand() << " lb_call=" << self
<< ": got recv_initial_metadata_ready: error=" << StatusToString(error);
if (error.ok()) {
// recv_initial_metadata_flags is not populated for clients
self->call_attempt_tracer()->RecordReceivedInitialMetadata(
@ -3134,15 +3040,12 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::RecvInitialMetadataReady(
void ClientChannelFilter::FilterBasedLoadBalancedCall::
RecvTrailingMetadataReady(void* arg, grpc_error_handle error) {
auto* self = static_cast<FilterBasedLoadBalancedCall*>(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: got recv_trailing_metadata_ready: error=%s "
"call_attempt_tracer()=%p lb_subchannel_call_tracker_=%p "
"failure_error_=%s",
self->chand(), self, StatusToString(error).c_str(),
self->call_attempt_tracer(), self->lb_subchannel_call_tracker(),
StatusToString(self->failure_error_).c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << self->chand() << " lb_call=" << self
<< ": got recv_trailing_metadata_ready: error=" << StatusToString(error)
<< " call_attempt_tracer()=" << self->call_attempt_tracer()
<< " lb_subchannel_call_tracker_=" << self->lb_subchannel_call_tracker()
<< " failure_error_=" << StatusToString(self->failure_error_);
// Check if we have a tracer or an LB callback to invoke.
if (self->call_attempt_tracer() != nullptr ||
self->lb_subchannel_call_tracker() != nullptr) {
@ -3210,13 +3113,11 @@ class ClientChannelFilter::FilterBasedLoadBalancedCall::LbQueuedCallCanceller
auto* chand = lb_call->chand();
{
MutexLock lock(&chand->lb_mu_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: cancelling queued pick: "
"error=%s self=%p calld->pick_canceller=%p",
chand, lb_call, StatusToString(error).c_str(), self,
lb_call->lb_call_canceller_);
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand << " lb_call=" << lb_call
<< ": cancelling queued pick: error=" << StatusToString(error)
<< " self=" << self
<< " calld->pick_canceller=" << lb_call->lb_call_canceller_;
if (lb_call->lb_call_canceller_ == self && !error.ok()) {
lb_call->Commit();
// Remove pick from list of queued picks.
@ -3298,11 +3199,10 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::CreateSubchannelCall() {
arena(), call_combiner_};
grpc_error_handle error;
subchannel_call_ = SubchannelCall::Create(std::move(call_args), &error);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: create subchannel_call=%p: error=%s", chand(),
this, subchannel_call_.get(), StatusToString(error).c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "chand=" << chand() << " lb_call=" << this
<< ": create subchannel_call=" << subchannel_call_.get()
<< ": error=" << StatusToString(error);
if (on_call_destruction_complete_ != nullptr) {
subchannel_call_->SetAfterCallStackDestroy(on_call_destruction_complete_);
on_call_destruction_complete_ = nullptr;

View File

@ -24,12 +24,6 @@
namespace grpc_core {
// Defined in legacy client channel filter.
// TODO(roth): Move these here when we remove the legacy filter.
extern TraceFlag grpc_client_channel_trace;
extern TraceFlag grpc_client_channel_call_trace;
extern TraceFlag grpc_client_channel_lb_call_trace;
namespace {
class LbMetadata : public LoadBalancingPolicy::MetadataInterface {
@ -185,12 +179,10 @@ LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> PickSubchannel(
// CompletePick
[&](LoadBalancingPolicy::PickResult::Complete* complete_pick)
-> LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"client_channel: %sLB pick succeeded: subchannel=%p",
GetContext<Activity>()->DebugTag().c_str(),
complete_pick->subchannel.get());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "client_channel: " << GetContext<Activity>()->DebugTag()
<< " pick succeeded: subchannel="
<< complete_pick->subchannel.get();
CHECK(complete_pick->subchannel != nullptr);
// Grab a ref to the call destination while we're still
// holding the data plane mutex.
@ -203,12 +195,10 @@ LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> PickSubchannel(
// yet seen that change and given us a new picker), then just
// queue the pick. We'll try again as soon as we get a new picker.
if (call_destination == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"client_channel: %ssubchannel returned by LB picker "
"has no connected subchannel; queueing pick",
GetContext<Activity>()->DebugTag().c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "client_channel: " << GetContext<Activity>()->DebugTag()
<< " returned by LB picker has no connected subchannel; queueing "
"pick";
return Continue{};
}
// If the LB policy returned a call tracker, inform it that the
@ -223,20 +213,17 @@ LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> PickSubchannel(
},
// QueuePick
[&](LoadBalancingPolicy::PickResult::Queue* /*queue_pick*/) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "client_channel: %sLB pick queued",
GetContext<Activity>()->DebugTag().c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "client_channel: " << GetContext<Activity>()->DebugTag()
<< " pick queued";
return Continue{};
},
// FailPick
[&](LoadBalancingPolicy::PickResult::Fail* fail_pick)
-> LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "client_channel: %sLB pick failed: %s",
GetContext<Activity>()->DebugTag().c_str(),
fail_pick->status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "client_channel: " << GetContext<Activity>()->DebugTag()
<< " pick failed: " << fail_pick->status;
// If wait_for_ready is false, then the error indicates the RPC
// attempt's final status.
if (!unstarted_handler.UnprocessedClientInitialMetadata()
@ -252,11 +239,9 @@ LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> PickSubchannel(
// DropPick
[&](LoadBalancingPolicy::PickResult::Drop* drop_pick)
-> LoopCtl<absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>> {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO, "client_channel: %sLB pick dropped: %s",
GetContext<Activity>()->DebugTag().c_str(),
drop_pick->status.ToString().c_str());
}
GRPC_TRACE_LOG(client_channel_lb_call, INFO)
<< "client_channel: " << GetContext<Activity>()->DebugTag()
<< " pick dropped: " << drop_pick->status;
return grpc_error_set_int(MaybeRewriteIllegalStatusCode(
std::move(drop_pick->status), "LB drop"),
StatusIntProperty::kLbPolicyDrop, 1);

View File

@ -89,8 +89,6 @@ using grpc_core::internal::RetryMethodConfig;
using grpc_core::internal::RetryServiceConfigParser;
using grpc_event_engine::experimental::EventEngine;
grpc_core::TraceFlag grpc_retry_trace(false, "retry");
namespace grpc_core {
//

View File

@ -38,14 +38,11 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/useful.h"
extern grpc_core::TraceFlag grpc_retry_trace;
namespace grpc_core {
class RetryFilter final {

View File

@ -116,8 +116,7 @@ class RetryFilter::LegacyCallData::CallStackDestructionBarrier final
RetryFilter::LegacyCallData::CallAttempt::CallAttempt(
RetryFilter::LegacyCallData* calld, bool is_transparent_retry)
: RefCounted(GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace) ? "CallAttempt"
: nullptr),
: RefCounted(GRPC_TRACE_FLAG_ENABLED(retry) ? "CallAttempt" : nullptr),
calld_(calld),
started_send_initial_metadata_(false),
completed_send_initial_metadata_(false),
@ -141,7 +140,7 @@ RetryFilter::LegacyCallData::CallAttempt::CallAttempt(
}
},
is_transparent_retry);
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: created attempt, lb_call=%p",
calld->chand_, calld, this, lb_call_.get());
@ -151,7 +150,7 @@ RetryFilter::LegacyCallData::CallAttempt::CallAttempt(
calld->retry_policy_->per_attempt_recv_timeout().has_value()) {
const Duration per_attempt_recv_timeout =
*calld->retry_policy_->per_attempt_recv_timeout();
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: per-attempt timeout in %" PRId64
" ms",
@ -170,7 +169,7 @@ RetryFilter::LegacyCallData::CallAttempt::CallAttempt(
}
RetryFilter::LegacyCallData::CallAttempt::~CallAttempt() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: destroying call attempt",
calld_->chand_, calld_, this);
}
@ -237,7 +236,7 @@ void RetryFilter::LegacyCallData::CallAttempt::MaybeSwitchToFastPath() {
// yet seen that op from the surface, we can't switch yet.
if (recv_trailing_metadata_internal_batch_ != nullptr) return;
// Switch to fast path.
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: retry state no longer needed; "
"moving LB call to parent and unreffing the call attempt",
@ -256,7 +255,7 @@ RetryFilter::LegacyCallData::CallAttempt::MaybeCreateBatchForReplay() {
// send_initial_metadata.
if (calld_->seen_send_initial_metadata_ && !started_send_initial_metadata_ &&
!calld_->pending_send_initial_metadata_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: replaying previously completed "
"send_initial_metadata op",
@ -270,7 +269,7 @@ RetryFilter::LegacyCallData::CallAttempt::MaybeCreateBatchForReplay() {
if (started_send_message_count_ < calld_->send_messages_.size() &&
started_send_message_count_ == completed_send_message_count_ &&
!calld_->pending_send_message_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: replaying previously completed "
"send_message op",
@ -289,7 +288,7 @@ RetryFilter::LegacyCallData::CallAttempt::MaybeCreateBatchForReplay() {
started_send_message_count_ == calld_->send_messages_.size() &&
!started_send_trailing_metadata_ &&
!calld_->pending_send_trailing_metadata_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: replaying previously completed "
"send_trailing_metadata op",
@ -320,7 +319,7 @@ void StartBatchInCallCombiner(void* arg, grpc_error_handle /*ignored*/) {
void RetryFilter::LegacyCallData::CallAttempt::AddClosureForBatch(
grpc_transport_stream_op_batch* batch, const char* reason,
CallCombinerClosureList* closures) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: adding batch (%s): %s",
calld_->chand_, calld_, this, reason,
grpc_transport_stream_op_batch_string(batch, false).c_str());
@ -333,7 +332,7 @@ void RetryFilter::LegacyCallData::CallAttempt::AddClosureForBatch(
void RetryFilter::LegacyCallData::CallAttempt::
AddBatchForInternalRecvTrailingMetadata(CallCombinerClosureList* closures) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: call failed but "
"recv_trailing_metadata not started; starting it internally",
@ -523,7 +522,7 @@ void RetryFilter::LegacyCallData::CallAttempt::AddRetriableBatches(
}
void RetryFilter::LegacyCallData::CallAttempt::StartRetriableBatches() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: constructing retriable batches",
calld_->chand_, calld_, this);
@ -533,7 +532,7 @@ void RetryFilter::LegacyCallData::CallAttempt::StartRetriableBatches() {
AddRetriableBatches(&closures);
// Note: This will yield the call combiner.
// Start batches on LB call.
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: starting %" PRIuPTR
" retriable batches on lb_call=%p",
@ -561,7 +560,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
if (calld_->retry_throttle_data_ != nullptr) {
calld_->retry_throttle_data_->RecordSuccess();
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: call succeeded",
calld_->chand_, calld_, this);
}
@ -569,7 +568,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
}
// Status is not OK. Check whether the status is retryable.
if (!calld_->retry_policy_->retryable_status_codes().Contains(*status)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: status %s not configured as "
"retryable",
@ -588,7 +587,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
// checks, so that we don't fail to record failures due to other factors.
if (calld_->retry_throttle_data_ != nullptr &&
!calld_->retry_throttle_data_->RecordFailure()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: retries throttled",
calld_->chand_, calld_, this);
}
@ -596,7 +595,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
}
// Check whether the call is committed.
if (calld_->retry_committed_) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: retries already committed",
calld_->chand_, calld_, this);
@ -607,7 +606,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
++calld_->num_attempts_completed_;
if (calld_->num_attempts_completed_ >=
calld_->retry_policy_->max_attempts()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(
GPR_INFO, "chand=%p calld=%p attempt=%p: exceeded %d retry attempts",
calld_->chand_, calld_, this, calld_->retry_policy_->max_attempts());
@ -617,7 +616,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
// Check server push-back.
if (server_pushback.has_value()) {
if (*server_pushback < Duration::Zero()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: not retrying due to server "
"push-back",
@ -625,7 +624,7 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry(
}
return false;
} else {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(
GPR_INFO,
"chand=%p calld=%p attempt=%p: server push-back: retry in %" PRIu64
@ -675,7 +674,7 @@ void RetryFilter::LegacyCallData::CallAttempt::OnPerAttemptRecvTimerLocked(
void* arg, grpc_error_handle error) {
auto* call_attempt = static_cast<CallAttempt*>(arg);
auto* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: perAttemptRecvTimeout timer fired: "
"error=%s, per_attempt_recv_timer_handle_.has_value()=%d",
@ -714,7 +713,7 @@ void RetryFilter::LegacyCallData::CallAttempt::OnPerAttemptRecvTimerLocked(
void RetryFilter::LegacyCallData::CallAttempt::
MaybeCancelPerAttemptRecvTimer() {
if (per_attempt_recv_timer_handle_.has_value()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: cancelling "
"perAttemptRecvTimeout timer",
@ -735,11 +734,10 @@ void RetryFilter::LegacyCallData::CallAttempt::
RetryFilter::LegacyCallData::CallAttempt::BatchData::BatchData(
RefCountedPtr<CallAttempt> attempt, int refcount, bool set_on_complete)
: RefCounted(
GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace) ? "BatchData" : nullptr,
refcount),
: RefCounted(GRPC_TRACE_FLAG_ENABLED(retry) ? "BatchData" : nullptr,
refcount),
call_attempt_(attempt.release()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: creating batch %p",
call_attempt_->calld_->chand_, call_attempt_->calld_, call_attempt_,
this);
@ -760,7 +758,7 @@ RetryFilter::LegacyCallData::CallAttempt::BatchData::BatchData(
}
RetryFilter::LegacyCallData::CallAttempt::BatchData::~BatchData() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: destroying batch %p",
call_attempt_->calld_->chand_, call_attempt_->calld_, call_attempt_,
this);
@ -833,7 +831,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::
RefCountedPtr<BatchData> batch_data(static_cast<BatchData*>(arg));
CallAttempt* call_attempt = batch_data->call_attempt_;
RetryFilter::LegacyCallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got recv_initial_metadata_ready, error=%s",
@ -860,7 +858,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::
if (GPR_UNLIKELY(
(call_attempt->trailing_metadata_available_ || !error.ok()) &&
!call_attempt->completed_recv_trailing_metadata_)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: deferring "
"recv_initial_metadata_ready (Trailers-Only)",
@ -932,7 +930,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::RecvMessageReady(
RefCountedPtr<BatchData> batch_data(static_cast<BatchData*>(arg));
CallAttempt* call_attempt = batch_data->call_attempt_;
RetryFilter::LegacyCallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got recv_message_ready, error=%s",
@ -962,7 +960,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::RecvMessageReady(
if (GPR_UNLIKELY(
(!call_attempt->recv_message_.has_value() || !error.ok()) &&
!call_attempt->completed_recv_trailing_metadata_)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: deferring recv_message_ready "
"(nullptr message and recv_trailing_metadata pending)",
@ -1126,7 +1124,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::
RefCountedPtr<BatchData> batch_data(static_cast<BatchData*>(arg));
CallAttempt* call_attempt = batch_data->call_attempt_;
RetryFilter::LegacyCallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got recv_trailing_metadata_ready, error=%s",
@ -1153,7 +1151,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::
batch_data->batch_.payload->recv_trailing_metadata.recv_trailing_metadata;
GetCallStatus(calld->deadline_, md_batch, error, &status, &server_pushback,
&is_lb_drop, &stream_network_state);
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: call finished, status=%s "
"server_pushback=%s is_lb_drop=%d stream_network_state=%s",
@ -1274,7 +1272,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::
}
}
if (have_pending_send_ops) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p: starting next batch for pending "
"send op(s)",
@ -1289,7 +1287,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::OnComplete(
RefCountedPtr<BatchData> batch_data(static_cast<BatchData*>(arg));
CallAttempt* call_attempt = batch_data->call_attempt_;
RetryFilter::LegacyCallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got on_complete, error=%s, batch=%s",
@ -1311,7 +1309,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::OnComplete(
// recv_trailing_metadata comes back.
if (GPR_UNLIKELY(!calld->retry_committed_ && !error.ok() &&
!call_attempt->completed_recv_trailing_metadata_)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p attempt=%p: deferring on_complete",
calld->chand_, calld, call_attempt);
}
@ -1365,7 +1363,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::OnCompleteForCancelOp(
RefCountedPtr<BatchData> batch_data(static_cast<BatchData*>(arg));
CallAttempt* call_attempt = batch_data->call_attempt_;
RetryFilter::LegacyCallData* calld = call_attempt->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p attempt=%p batch_data=%p: "
"got on_complete for cancel_stream batch, error=%s, batch=%s",
@ -1409,7 +1407,7 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::
void RetryFilter::LegacyCallData::CallAttempt::BatchData::
AddRetriableSendMessageOp() {
auto* calld = call_attempt_->calld_;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(
GPR_INFO,
"chand=%p calld=%p attempt=%p: starting calld->send_messages[%" PRIuPTR
@ -1498,7 +1496,7 @@ grpc_error_handle RetryFilter::LegacyCallData::Init(
grpc_call_element* elem, const grpc_call_element_args* args) {
auto* chand = static_cast<RetryFilter*>(elem->channel_data);
new (elem->call_data) RetryFilter::LegacyCallData(chand, *args);
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: created call", chand,
elem->call_data);
}
@ -1580,8 +1578,7 @@ RetryFilter::LegacyCallData::~LegacyCallData() {
void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
grpc_transport_stream_op_batch* batch) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace) &&
!GRPC_TRACE_FLAG_ENABLED(grpc_trace_channel)) {
if (GRPC_TRACE_FLAG_ENABLED(retry) && !GRPC_TRACE_FLAG_ENABLED(channel)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: batch started from surface: %s",
chand_, this,
grpc_transport_stream_op_batch_string(batch, false).c_str());
@ -1604,7 +1601,7 @@ void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
if (GPR_UNLIKELY(batch->cancel_stream)) {
// Save cancel_error in case subsequent batches are started.
cancelled_from_surface_ = batch->payload->cancel_stream.cancel_error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: cancelled from surface: %s", chand_,
this, StatusToString(cancelled_from_surface_).c_str());
}
@ -1627,7 +1624,7 @@ void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
}
// Cancel retry timer if needed.
if (retry_timer_handle_.has_value()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: cancelling retry timer", chand_,
this);
}
@ -1673,7 +1670,7 @@ void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
if (!retry_codepath_started_ && retry_committed_ &&
(retry_policy_ == nullptr ||
!retry_policy_->per_attempt_recv_timeout().has_value())) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: retry committed before first attempt; "
"creating LB call",
@ -1692,7 +1689,7 @@ void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
// Otherwise, create a call attempt.
// The attempt will automatically start any necessary replays or
// pending batches.
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: creating call attempt", chand_,
this);
}
@ -1701,7 +1698,7 @@ void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
return;
}
// Send batches to call attempt.
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: starting batch on attempt=%p", chand_,
this, call_attempt_.get());
}
@ -1759,7 +1756,7 @@ void RetryFilter::LegacyCallData::MaybeCacheSendOpsForBatch(
}
void RetryFilter::LegacyCallData::FreeCachedSendInitialMetadata() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: destroying send_initial_metadata",
chand_, this);
}
@ -1768,7 +1765,7 @@ void RetryFilter::LegacyCallData::FreeCachedSendInitialMetadata() {
void RetryFilter::LegacyCallData::FreeCachedSendMessage(size_t idx) {
if (send_messages_[idx].slices != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: destroying send_messages[%" PRIuPTR "]",
chand_, this, idx);
@ -1778,7 +1775,7 @@ void RetryFilter::LegacyCallData::FreeCachedSendMessage(size_t idx) {
}
void RetryFilter::LegacyCallData::FreeCachedSendTrailingMetadata() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: destroying send_trailing_metadata",
chand_, this);
}
@ -1817,7 +1814,7 @@ RetryFilter::LegacyCallData::PendingBatch*
RetryFilter::LegacyCallData::PendingBatchesAdd(
grpc_transport_stream_op_batch* batch) {
const size_t idx = GetBatchIndex(batch);
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: adding pending batch at index %" PRIuPTR,
chand_, this, idx);
@ -1848,7 +1845,7 @@ RetryFilter::LegacyCallData::PendingBatchesAdd(
// ops have already been sent, and we commit to that attempt.
if (GPR_UNLIKELY(bytes_buffered_for_retry_ >
chand_->per_rpc_retry_buffer_size())) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: exceeded retry buffer size, committing",
chand_, this);
@ -1885,7 +1882,7 @@ void RetryFilter::LegacyCallData::MaybeClearPendingBatch(
(!batch->recv_trailing_metadata ||
batch->payload->recv_trailing_metadata.recv_trailing_metadata_ready ==
nullptr)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: clearing pending batch", chand_,
this);
}
@ -1908,7 +1905,7 @@ void RetryFilter::LegacyCallData::FailPendingBatchInCallCombiner(
// This is called via the call combiner, so access to calld is synchronized.
void RetryFilter::LegacyCallData::PendingBatchesFail(grpc_error_handle error) {
CHECK(!error.ok());
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
if (pending_batches_[i].batch != nullptr) ++num_batches;
@ -1942,7 +1939,7 @@ RetryFilter::LegacyCallData::PendingBatchFind(const char* log_message,
PendingBatch* pending = &pending_batches_[i];
grpc_transport_stream_op_batch* batch = pending->batch;
if (batch != nullptr && predicate(batch)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: %s pending batch at index %" PRIuPTR,
chand_, this, log_message, i);
@ -1960,7 +1957,7 @@ RetryFilter::LegacyCallData::PendingBatchFind(const char* log_message,
void RetryFilter::LegacyCallData::RetryCommit(CallAttempt* call_attempt) {
if (retry_committed_) return;
retry_committed_ = true;
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: committing retries", chand_, this);
}
if (call_attempt != nullptr) {
@ -1994,7 +1991,7 @@ void RetryFilter::LegacyCallData::StartRetryTimer(
} else {
next_attempt_timeout = retry_backoff_.NextAttemptTime() - Timestamp::Now();
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO,
"chand=%p calld=%p: retrying failed call in %" PRId64 " ms", chand_,
this, next_attempt_timeout.millis());
@ -2027,7 +2024,7 @@ void RetryFilter::LegacyCallData::OnRetryTimerLocked(
void RetryFilter::LegacyCallData::AddClosureToStartTransparentRetry(
CallCombinerClosureList* closures) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(retry)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: scheduling transparent retry", chand_,
this);
}

View File

@ -94,9 +94,6 @@ namespace grpc_core {
using ::grpc_event_engine::experimental::EventEngine;
TraceFlag grpc_trace_subchannel(false, "subchannel");
DebugOnlyTraceFlag grpc_trace_subchannel_refcount(false, "subchannel_refcount");
//
// ConnectedSubchannel
//
@ -105,9 +102,8 @@ ConnectedSubchannel::ConnectedSubchannel(
const ChannelArgs& args,
RefCountedPtr<channelz::SubchannelNode> channelz_subchannel)
: RefCounted<ConnectedSubchannel>(
GRPC_TRACE_FLAG_ENABLED(grpc_trace_subchannel_refcount)
? "ConnectedSubchannel"
: nullptr),
GRPC_TRACE_FLAG_ENABLED(subchannel_refcount) ? "ConnectedSubchannel"
: nullptr),
args_(args),
channelz_subchannel_(std::move(channelz_subchannel)) {}
@ -421,7 +417,7 @@ class Subchannel::ConnectedSubchannelStateWatcher final
if (c->connected_subchannel_ == nullptr) return;
if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
new_state == GRPC_CHANNEL_SHUTDOWN) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_subchannel)) {
if (GRPC_TRACE_FLAG_ENABLED(subchannel)) {
gpr_log(GPR_INFO,
"subchannel %p %s: Connected subchannel %p reports %s: %s", c,
c->key_.ToString().c_str(), c->connected_subchannel_.get(),
@ -520,9 +516,9 @@ BackOff::Options ParseArgsForBackoffValues(const ChannelArgs& args,
Subchannel::Subchannel(SubchannelKey key,
OrphanablePtr<SubchannelConnector> connector,
const ChannelArgs& args)
: DualRefCounted<Subchannel>(
GRPC_TRACE_FLAG_ENABLED(grpc_trace_subchannel_refcount) ? "Subchannel"
: nullptr),
: DualRefCounted<Subchannel>(GRPC_TRACE_FLAG_ENABLED(subchannel_refcount)
? "Subchannel"
: nullptr),
key_(std::move(key)),
args_(args),
pollset_set_(grpc_pollset_set_create()),
@ -606,7 +602,7 @@ void Subchannel::ThrottleKeepaliveTime(int new_keepalive_time) {
// Only update the value if the new keepalive time is larger.
if (new_keepalive_time > keepalive_time_) {
keepalive_time_ = new_keepalive_time;
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_subchannel)) {
if (GRPC_TRACE_FLAG_ENABLED(subchannel)) {
gpr_log(GPR_INFO, "subchannel %p %s: throttling keepalive time to %d",
this, key_.ToString().c_str(), new_keepalive_time);
}
@ -881,7 +877,7 @@ bool Subchannel::PublishTransportLocked() {
}
connecting_result_.Reset();
// Publish.
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_subchannel)) {
if (GRPC_TRACE_FLAG_ENABLED(subchannel)) {
gpr_log(GPR_INFO, "subchannel %p %s: new connected subchannel at %p", this,
key_.ToString().c_str(), connected_subchannel_.get());
}

View File

@ -36,8 +36,6 @@
namespace grpc_core {
TraceFlag grpc_subchannel_pool_trace(false, "subchannel_pool");
SubchannelKey::SubchannelKey(const grpc_resolved_address& address,
const ChannelArgs& args)
: address_(address), args_(args) {}

View File

@ -36,8 +36,6 @@ namespace grpc_core {
class Subchannel;
extern TraceFlag grpc_subchannel_pool_trace;
// A key that can uniquely identify a subchannel.
class SubchannelKey final {
public:
@ -68,7 +66,7 @@ class SubchannelKey final {
class SubchannelPoolInterface : public RefCounted<SubchannelPoolInterface> {
public:
SubchannelPoolInterface()
: RefCounted(GRPC_TRACE_FLAG_ENABLED(grpc_subchannel_pool_trace)
: RefCounted(GRPC_TRACE_FLAG_ENABLED(subchannel_pool)
? "SubchannelPoolInterface"
: nullptr) {}
~SubchannelPoolInterface() override {}

View File

@ -46,8 +46,6 @@
namespace grpc_core {
TraceFlag grpc_backend_metric_filter_trace(false, "backend_metric_filter");
const NoInterceptor BackendMetricFilter::Call::OnClientInitialMetadata;
const NoInterceptor BackendMetricFilter::Call::OnServerInitialMetadata;
const NoInterceptor BackendMetricFilter::Call::OnClientToServerMessage;
@ -131,20 +129,20 @@ void BackendMetricFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
if (md.get(GrpcCallWasCancelled()).value_or(false)) return;
auto* ctx = MaybeGetContext<BackendMetricProvider>();
if (ctx == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_filter_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(backend_metric_filter)) {
gpr_log(GPR_INFO, "[%p] No BackendMetricProvider.", this);
}
return;
}
absl::optional<std::string> serialized = MaybeSerializeBackendMetrics(ctx);
if (serialized.has_value() && !serialized->empty()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_filter_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(backend_metric_filter)) {
gpr_log(GPR_INFO, "[%p] Backend metrics serialized. size: %" PRIuPTR,
this, serialized->size());
}
md.Set(EndpointLoadMetricsBinMetadata(),
Slice::FromCopiedString(std::move(*serialized)));
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_filter_trace)) {
} else if (GRPC_TRACE_FLAG_ENABLED(backend_metric_filter)) {
gpr_log(GPR_INFO, "[%p] No backend metrics.", this);
}
}

View File

@ -68,12 +68,11 @@ const auto kDefaultMaxConnectionAgeGrace = Duration::Infinity();
const auto kDefaultMaxConnectionIdle = Duration::Infinity();
const auto kMaxConnectionAgeJitter = 0.1;
TraceFlag grpc_trace_client_idle_filter(false, "client_idle_filter");
} // namespace
#define GRPC_IDLE_FILTER_LOG(format, ...) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_client_idle_filter)) { \
if (GRPC_TRACE_FLAG_ENABLED(client_idle_filter)) { \
gpr_log(GPR_INFO, "(client idle filter) " format, ##__VA_ARGS__); \
} \
} while (0)

View File

@ -53,7 +53,6 @@
namespace grpc_core {
TraceFlag grpc_fault_injection_filter_trace(false, "fault_injection_filter");
const NoInterceptor FaultInjectionFilter::Call::OnServerInitialMetadata;
const NoInterceptor FaultInjectionFilter::Call::OnServerTrailingMetadata;
const NoInterceptor FaultInjectionFilter::Call::OnClientToServerMessage;
@ -151,7 +150,7 @@ FaultInjectionFilter::FaultInjectionFilter(ChannelFilter::Args filter_args)
ArenaPromise<absl::Status> FaultInjectionFilter::Call::OnClientInitialMetadata(
ClientMetadata& md, FaultInjectionFilter* filter) {
auto decision = filter->MakeInjectionDecision(md);
if (GRPC_TRACE_FLAG_ENABLED(grpc_fault_injection_filter_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(fault_injection_filter)) {
gpr_log(GPR_INFO, "chand=%p: Fault injection triggered %s", this,
decision.ToString().c_str());
}

View File

@ -49,7 +49,6 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/call_trace.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/telemetry/call_tracer.h"
@ -114,7 +113,7 @@ ChannelCompression::ChannelCompression(const ChannelArgs& args)
MessageHandle ChannelCompression::CompressMessage(
MessageHandle message, grpc_compression_algorithm algorithm) const {
if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(compression)) {
gpr_log(GPR_INFO, "CompressMessage: len=%" PRIdPTR " alg=%d flags=%d",
message->payload()->Length(), algorithm, message->flags());
}
@ -138,7 +137,7 @@ MessageHandle ChannelCompression::CompressMessage(
// If we achieved compression send it as compressed, otherwise send it as (to
// avoid spending cycles on the receiver decompressing).
if (did_compress) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(compression)) {
const char* algo_name;
const size_t before_size = payload->Length();
const size_t after_size = tmp.Length();
@ -156,7 +155,7 @@ MessageHandle ChannelCompression::CompressMessage(
call_tracer->RecordSendCompressedMessage(*message->payload());
}
} else {
if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(compression)) {
const char* algo_name;
CHECK(grpc_compression_algorithm_name(algorithm, &algo_name));
gpr_log(GPR_INFO,
@ -170,7 +169,7 @@ MessageHandle ChannelCompression::CompressMessage(
absl::StatusOr<MessageHandle> ChannelCompression::DecompressMessage(
bool is_client, MessageHandle message, DecompressArgs args) const {
if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(compression)) {
gpr_log(GPR_INFO, "DecompressMessage: len=%" PRIdPTR " max=%d alg=%d",
message->payload()->Length(),
args.max_recv_message_length.value_or(-1), args.algorithm);

View File

@ -44,7 +44,6 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/percent_encoding.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/surface/call_trace.h"
#include "src/core/lib/transport/metadata_batch.h"
namespace grpc_core {
@ -140,7 +139,7 @@ ServerMetadataHandle HttpServerFilter::Call::OnClientInitialMetadata(
}
void HttpServerFilter::Call::OnServerInitialMetadata(ServerMetadata& md) {
if (grpc_call_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(call)) {
gpr_log(GPR_INFO, "%s[http-server] Write metadata",
GetContext<Activity>()->DebugTag().c_str());
}

View File

@ -40,7 +40,6 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/surface/call_trace.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
@ -160,7 +159,7 @@ ServerMetadataHandle CheckPayload(const Message& msg,
absl::optional<uint32_t> max_length,
bool is_client, bool is_send) {
if (!max_length.has_value()) return nullptr;
if (GRPC_TRACE_FLAG_ENABLED(grpc_call_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(call)) {
gpr_log(GPR_INFO, "%s[message_size] %s len:%" PRIdPTR " max:%d",
GetContext<Activity>()->DebugTag().c_str(),
is_send ? "send" : "recv", msg.payload()->Length(), *max_length);

View File

@ -57,7 +57,6 @@
namespace grpc_core {
TraceFlag grpc_stateful_session_filter_trace(false, "stateful_session_filter");
const NoInterceptor StatefulSessionFilter::Call::OnClientToServerMessage;
const NoInterceptor StatefulSessionFilter::Call::OnClientToServerHalfClose;
const NoInterceptor StatefulSessionFilter::Call::OnServerToClientMessage;

View File

@ -1,21 +0,0 @@
// Copyright 2023 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/core/ext/transport/chaotic_good/chaotic_good_transport.h"
#include <grpc/support/port_platform.h>
grpc_core::TraceFlag grpc_chaotic_good_trace(false, "chaotic_good");
namespace grpc_core {} // namespace grpc_core

View File

@ -33,8 +33,6 @@
#include "src/core/lib/promise/try_seq.h"
#include "src/core/lib/transport/promise_endpoint.h"
extern grpc_core::TraceFlag grpc_chaotic_good_trace;
namespace grpc_core {
namespace chaotic_good {
@ -54,8 +52,10 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
}
auto WriteFrame(const FrameInterface& frame) {
auto buffers = frame.Serialize(&encoder_);
if (grpc_chaotic_good_trace.enabled()) {
bool saw_encoding_errors = false;
auto buffers = frame.Serialize(&encoder_, saw_encoding_errors);
// ignore encoding errors: they will be logged separately already
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: WriteFrame to:%s %s",
ResolvedAddressToString(control_endpoint_.GetPeerAddress())
.value_or("<<unknown peer address>>")
@ -76,7 +76,7 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
auto frame_header =
FrameHeader::Parse(reinterpret_cast<const uint8_t*>(
GRPC_SLICE_START_PTR(read_buffer.c_slice())));
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: ReadHeader from:%s %s",
ResolvedAddressToString(control_endpoint_.GetPeerAddress())
.value_or("<<unknown peer address>>")
@ -125,7 +125,7 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
FrameLimits limits) {
auto s = frame.Deserialize(&parser_, header, bitgen_, arena,
std::move(buffers), limits);
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: DeserializeFrame %s",
s.ok() ? frame.ToString().c_str() : s.ToString().c_str());
}

View File

@ -114,7 +114,10 @@ auto ChaoticGoodConnector::DataEndpointWriteSettingsFrame(
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kData,
self->connection_id_, kDataAlignmentBytes}
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
bool saw_encoding_errors = false;
auto write_buffer =
frame.Serialize(&self->hpack_compressor_, saw_encoding_errors);
// ignore encoding errors: they will be logged separately already
return self->data_endpoint_.Write(std::move(write_buffer.control));
}
@ -215,7 +218,10 @@ auto ChaoticGoodConnector::ControlEndpointWriteSettingsFrame(
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kControl,
absl::nullopt, absl::nullopt}
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
bool saw_encoding_errors = false;
auto write_buffer =
frame.Serialize(&self->hpack_compressor_, saw_encoding_errors);
// ignore encoding errors: they will be logged separately already
return self->control_endpoint_.Write(std::move(write_buffer.control));
}
@ -313,7 +319,7 @@ void ChaoticGoodConnector::OnHandshakeDone(void* arg, grpc_error_handle error) {
},
EventEngineWakeupScheduler(self->event_engine_),
[self](absl::Status status) {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "ChaoticGoodConnector::OnHandshakeDone: %s",
status.ToString().c_str());
}

View File

@ -259,7 +259,7 @@ auto ChaoticGoodClientTransport::CallOutboundLoop(uint32_t stream_id,
// Wait for initial metadata then send it out.
call_handler.PullClientInitialMetadata(),
[send_fragment](ClientMetadataHandle md) mutable {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Sending initial metadata: %s",
md->DebugString().c_str());
}
@ -298,7 +298,7 @@ void ChaoticGoodClientTransport::StartCall(CallHandler call_handler) {
const uint32_t stream_id = MakeStream(call_handler);
return Map(CallOutboundLoop(stream_id, call_handler),
[stream_id, this](absl::Status result) {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Call %d finished with %s",
stream_id, result.ToString().c_str());
}

View File

@ -218,10 +218,12 @@ absl::Status SettingsFrame::Deserialize(HPackParser* parser,
return deserializer.Finish();
}
BufferPair SettingsFrame::Serialize(HPackCompressor* encoder) const {
BufferPair SettingsFrame::Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const {
FrameSerializer serializer(FrameType::kSettings, 0);
if (headers.get() != nullptr) {
encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
saw_encoding_errors |=
!encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
}
return serializer.Finish();
}
@ -275,11 +277,13 @@ absl::Status ClientFragmentFrame::Deserialize(HPackParser* parser,
return deserializer.Finish();
}
BufferPair ClientFragmentFrame::Serialize(HPackCompressor* encoder) const {
BufferPair ClientFragmentFrame::Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const {
CHECK_NE(stream_id, 0u);
FrameSerializer serializer(FrameType::kFragment, stream_id);
if (headers.get() != nullptr) {
encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
saw_encoding_errors |=
!encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
}
if (message.has_value()) {
serializer.AddMessage(message.value());
@ -354,17 +358,20 @@ absl::Status ServerFragmentFrame::Deserialize(HPackParser* parser,
return deserializer.Finish();
}
BufferPair ServerFragmentFrame::Serialize(HPackCompressor* encoder) const {
BufferPair ServerFragmentFrame::Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const {
CHECK_NE(stream_id, 0u);
FrameSerializer serializer(FrameType::kFragment, stream_id);
if (headers.get() != nullptr) {
encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
saw_encoding_errors |=
!encoder->EncodeRawHeaders(*headers.get(), serializer.AddHeaders());
}
if (message.has_value()) {
serializer.AddMessage(message.value());
}
if (trailers.get() != nullptr) {
encoder->EncodeRawHeaders(*trailers.get(), serializer.AddTrailers());
saw_encoding_errors |=
!encoder->EncodeRawHeaders(*trailers.get(), serializer.AddTrailers());
}
return serializer.Finish();
}
@ -399,7 +406,7 @@ absl::Status CancelFrame::Deserialize(HPackParser*, const FrameHeader& header,
return deserializer.Finish();
}
BufferPair CancelFrame::Serialize(HPackCompressor*) const {
BufferPair CancelFrame::Serialize(HPackCompressor*, bool&) const {
CHECK_NE(stream_id, 0u);
FrameSerializer serializer(FrameType::kCancel, stream_id);
return serializer.Finish();

View File

@ -55,9 +55,15 @@ class FrameInterface {
const FrameHeader& header,
absl::BitGenRef bitsrc, Arena* arena,
BufferPair buffers, FrameLimits limits) = 0;
virtual BufferPair Serialize(HPackCompressor* encoder) const = 0;
virtual BufferPair Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const = 0;
virtual std::string ToString() const = 0;
template <typename Sink>
friend void AbslStringify(Sink& sink, const FrameInterface& frame) {
sink.Append(frame.ToString());
}
protected:
static bool EqVal(const grpc_metadata_batch& a,
const grpc_metadata_batch& b) {
@ -72,11 +78,16 @@ class FrameInterface {
~FrameInterface() = default;
};
inline std::ostream& operator<<(std::ostream& os, const FrameInterface& frame) {
return os << frame.ToString();
}
struct SettingsFrame final : public FrameInterface {
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
absl::BitGenRef bitsrc, Arena* arena,
BufferPair buffers, FrameLimits limits) override;
BufferPair Serialize(HPackCompressor* encoder) const override;
BufferPair Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const override;
ClientMetadataHandle headers;
std::string ToString() const override;
@ -110,7 +121,8 @@ struct ClientFragmentFrame final : public FrameInterface {
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
absl::BitGenRef bitsrc, Arena* arena,
BufferPair buffers, FrameLimits limits) override;
BufferPair Serialize(HPackCompressor* encoder) const override;
BufferPair Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const override;
std::string ToString() const override;
uint32_t stream_id;
@ -128,7 +140,8 @@ struct ServerFragmentFrame final : public FrameInterface {
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
absl::BitGenRef bitsrc, Arena* arena,
BufferPair buffers, FrameLimits limits) override;
BufferPair Serialize(HPackCompressor* encoder) const override;
BufferPair Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const override;
std::string ToString() const override;
uint32_t stream_id;
@ -146,7 +159,8 @@ struct CancelFrame final : public FrameInterface {
absl::Status Deserialize(HPackParser* parser, const FrameHeader& header,
absl::BitGenRef bitsrc, Arena* arena,
BufferPair buffers, FrameLimits limits) override;
BufferPair Serialize(HPackCompressor* encoder) const override;
BufferPair Serialize(HPackCompressor* encoder,
bool& saw_encoding_errors) const override;
std::string ToString() const override;
uint32_t stream_id;

View File

@ -34,6 +34,19 @@ enum class FrameType : uint8_t {
kCancel = 0x81,
};
inline std::ostream& operator<<(std::ostream& out, FrameType type) {
switch (type) {
case FrameType::kSettings:
return out << "Settings";
case FrameType::kFragment:
return out << "Fragment";
case FrameType::kCancel:
return out << "Cancel";
default:
return out << "Unknown[" << static_cast<int>(type) << "]";
}
}
struct FrameHeader {
FrameType type = FrameType::kCancel;
BitSet<3> flags;

View File

@ -98,7 +98,7 @@ ChaoticGoodServerListener::~ChaoticGoodServerListener() {
absl::StatusOr<int> ChaoticGoodServerListener::Bind(
grpc_event_engine::experimental::EventEngine::ResolvedAddress addr) {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
auto str = grpc_event_engine::experimental::ResolvedAddressToString(addr);
LOG(INFO) << "CHAOTIC_GOOD: Listen on "
<< (str.ok() ? str->c_str() : str.status().ToString());
@ -139,9 +139,9 @@ absl::Status ChaoticGoodServerListener::StartListening() {
CHECK(ee_listener_ != nullptr);
auto status = ee_listener_->Start();
if (!status.ok()) {
LOG(ERROR) << "Start listening failed: " << status.ToString();
} else if (grpc_chaotic_good_trace.enabled()) {
LOG(INFO) << "CHAOTIC_GOOD: Started listening";
LOG(ERROR) << "Start listening failed: " << status;
} else {
GRPC_TRACE_LOG(chaotic_good, INFO) << "CHAOTIC_GOOD: Started listening";
}
return status;
}
@ -159,9 +159,7 @@ ChaoticGoodServerListener::ActiveConnection::~ActiveConnection() {
}
void ChaoticGoodServerListener::ActiveConnection::Orphan() {
if (grpc_chaotic_good_trace.enabled()) {
LOG(INFO) << "ActiveConnection::Orphan() " << this;
}
GRPC_TRACE_LOG(chaotic_good, INFO) << "ActiveConnection::Orphan() " << this;
if (handshaking_state_ != nullptr) {
handshaking_state_->Shutdown();
handshaking_state_.reset();
@ -299,7 +297,7 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
},
[self](PromiseEndpoint ret) -> absl::Status {
MutexLock lock(&self->connection_->listener_->mu_);
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(
GPR_INFO, "%p Data endpoint setup done: shutdown=%s",
self->connection_.get(),
@ -338,7 +336,10 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
SettingsMetadata{absl::nullopt, self->connection_->connection_id_,
absl::nullopt}
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_);
bool saw_encoding_errors = false;
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_,
saw_encoding_errors);
// ignore encoding errors: they will be logged separately already
return TrySeq(
self->connection_->endpoint_.Write(std::move(write_buffer.control)),
WaitForDataEndpointSetup(self));
@ -352,7 +353,10 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
SettingsMetadata{absl::nullopt, self->connection_->connection_id_,
self->connection_->data_alignment_}
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_);
bool saw_encoding_errors = false;
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_,
saw_encoding_errors);
// ignore encoding errors: they will be logged separately already
return TrySeq(
self->connection_->endpoint_.Write(std::move(write_buffer.control)),
[self]() mutable {
@ -445,19 +449,14 @@ void ChaoticGoodServerListener::ActiveConnection::HandshakingState::
Timestamp ChaoticGoodServerListener::ActiveConnection::HandshakingState::
GetConnectionDeadline() {
if (connection_->args().Contains(GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS)) {
return Timestamp::Now() +
connection_->args()
.GetDurationFromIntMillis(GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS)
.value();
}
return Timestamp::Now() + kConnectionDeadline;
return Timestamp::Now() +
connection_->args()
.GetDurationFromIntMillis(GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS)
.value_or(kConnectionDeadline);
}
void ChaoticGoodServerListener::Orphan() {
if (grpc_chaotic_good_trace.enabled()) {
LOG(INFO) << "ChaoticGoodServerListener::Orphan()";
}
GRPC_TRACE_LOG(chaotic_good, INFO) << "ChaoticGoodServerListener::Orphan()";
{
absl::flat_hash_set<OrphanablePtr<ActiveConnection>> connection_list;
MutexLock lock(&mu_);

View File

@ -74,7 +74,7 @@ auto ChaoticGoodServerTransport::PushFragmentIntoCall(
CallInitiator call_initiator, ClientFragmentFrame frame,
uint32_t stream_id) {
DCHECK(frame.headers == nullptr);
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: PushFragmentIntoCall: frame=%s",
frame.ToString().c_str());
}
@ -87,7 +87,7 @@ auto ChaoticGoodServerTransport::PushFragmentIntoCall(
[]() -> StatusFlag { return Success{}; }),
[this, call_initiator, end_of_stream = frame.end_of_stream,
stream_id](StatusFlag status) mutable -> StatusFlag {
if (!status.ok() && grpc_chaotic_good_trace.enabled()) {
if (!status.ok() && GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Failed PushFragmentIntoCall");
}
if (end_of_stream || !status.ok()) {
@ -135,7 +135,7 @@ auto ChaoticGoodServerTransport::MaybePushFragmentIntoCall(
auto ChaoticGoodServerTransport::SendFragment(
ServerFragmentFrame frame, MpscSender<ServerFrame> outgoing_frames,
CallInitiator call_initiator) {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: SendFragment: frame=%s",
frame.ToString().c_str());
}
@ -187,7 +187,7 @@ auto ChaoticGoodServerTransport::SendCallInitialMetadataAndBody(
call_initiator.PullServerInitialMetadata(),
[stream_id, outgoing_frames, call_initiator,
this](absl::optional<ServerMetadataHandle> md) mutable {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO,
"CHAOTIC_GOOD: SendCallInitialMetadataAndBody: md=%s",
md.has_value() ? (*md)->DebugString().c_str() : "null");
@ -213,7 +213,7 @@ auto ChaoticGoodServerTransport::CallOutboundLoop(
return Seq(Map(SendCallInitialMetadataAndBody(stream_id, outgoing_frames,
call_initiator),
[stream_id](absl::Status main_body_result) {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_DEBUG,
"CHAOTIC_GOOD: CallOutboundLoop: stream_id=%d "
"main_body_result=%s",
@ -345,7 +345,7 @@ auto ChaoticGoodServerTransport::OnTransportActivityDone(
absl::string_view activity) {
return [self = RefAsSubclass<ChaoticGoodServerTransport>(),
activity](absl::Status status) {
if (grpc_chaotic_good_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO,
"CHAOTIC_GOOD: OnTransportActivityDone: activity=%s status=%s",
std::string(activity).c_str(), status.ToString().c_str());

View File

@ -64,7 +64,6 @@
#include "src/core/ext/transport/chttp2/transport/frame_rst_stream.h"
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h"
@ -95,7 +94,6 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/resource_quota/trace.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/slice/slice_internal.h"
@ -143,7 +141,6 @@ static bool g_default_server_keepalive_permit_without_calls = false;
#define GRPC_ARG_HTTP_TARPIT_MAX_DURATION_MS "grpc.http.tarpit_max_duration_ms"
#define MAX_CLIENT_STREAM_ID 0x7fffffffu
grpc_core::TraceFlag grpc_keepalive_trace(false, "http_keepalive");
// forward declarations of various callbacks that we'll build closures around
static void write_action_begin_locked(
@ -827,10 +824,9 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
t->streams_allocated.fetch_add(1, std::memory_order_relaxed);
if (server_data) {
id = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(server_data));
if (grpc_http_trace.enabled()) {
VLOG(2) << "HTTP:" << t << "/" << this << " creating accept stream " << id
<< " [from " << server_data << "]";
}
GRPC_TRACE_VLOG(http, 2)
<< "HTTP:" << t << "/" << this << " creating accept stream " << id
<< " [from " << server_data << "]";
*t->accepting_stream = this;
t->stream_map.emplace(id, this);
post_destructive_reclaimer(t);
@ -1061,10 +1057,9 @@ static void write_action(grpc_chttp2_transport* t) {
if (max_frame_size == 0) {
max_frame_size = INT_MAX;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
LOG(INFO) << (t->is_client ? "CLIENT" : "SERVER") << "[" << t << "]: Write "
<< t->outbuf.Length() << " bytes";
}
GRPC_TRACE_LOG(http2_ping, INFO)
<< (t->is_client ? "CLIENT" : "SERVER") << "[" << t << "]: Write "
<< t->outbuf.Length() << " bytes";
t->write_size_policy.BeginWrite(t->outbuf.Length());
grpc_endpoint_write(t->ep, t->outbuf.c_slice_buffer(),
grpc_core::InitTransportClosure<write_action_end>(
@ -1075,10 +1070,8 @@ static void write_action(grpc_chttp2_transport* t) {
static void write_action_end(grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
grpc_error_handle error) {
auto* tp = t.get();
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
LOG(INFO) << (t->is_client ? "CLIENT" : "SERVER") << "[" << t.get()
<< "]: Finish write";
}
GRPC_TRACE_LOG(http2_ping, INFO) << (t->is_client ? "CLIENT" : "SERVER")
<< "[" << t.get() << "]: Finish write";
tp->combiner->Run(grpc_core::InitTransportClosure<write_action_end_locked>(
std::move(t), &tp->write_action_end_locked),
error);
@ -1295,7 +1288,7 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
return;
}
closure->next_data.scratch -= CLOSURE_BARRIER_FIRST_REF_BIT;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(
GPR_INFO,
"complete_closure_step: t=%p %p refs=%d flags=0x%04x desc=%s err=%s "
@ -1365,7 +1358,7 @@ static void perform_stream_op_locked(void* stream_op,
s->traced = op->is_traced;
s->call_tracer = CallTracerIfSampled(s);
s->tcp_tracer = TcpTracerIfSampled(s);
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO,
"perform_stream_op_locked[s=%p; op=%p]: %s; on_complete = %p", s,
op, grpc_transport_stream_op_batch_string(op, false).c_str(),
@ -1632,7 +1625,7 @@ void grpc_chttp2_transport::PerformStreamOp(
}
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "perform_stream_op[s=%p; op=%p]: %s", s, op,
grpc_transport_stream_op_batch_string(op, false).c_str());
}
@ -1976,7 +1969,7 @@ static void perform_transport_op_locked(void* stream_op,
}
void grpc_chttp2_transport::PerformOp(grpc_transport_op* op) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "perform_transport_op[t=%p]: %s", this,
grpc_transport_op_string(op).c_str());
}
@ -2029,7 +2022,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
// Lambda is immediately invoked as a big scoped section that can be
// exited out of at any point by returning.
[&]() {
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_DEBUG,
"maybe_complete_recv_message %p final_metadata_requested=%d "
"seen_error=%d",
@ -2045,7 +2038,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
int64_t min_progress_size;
auto r = grpc_deframe_unprocessed_incoming_frames(
s, &min_progress_size, &**s->recv_message, s->recv_message_flags);
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_DEBUG, "Deframe data frame: %s",
grpc_core::PollToString(r, [](absl::Status r) {
return r.ToString();
@ -2101,7 +2094,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
grpc_chttp2_maybe_complete_recv_message(t, s);
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_DEBUG,
"maybe_complete_recv_trailing_metadata cli=%d s=%p closure=%p "
"read_closed=%d "
@ -2312,7 +2305,7 @@ grpc_chttp2_transport::RemovedStreamHandle grpc_chttp2_mark_stream_closed(
grpc_chttp2_transport* t, grpc_chttp2_stream* s, int close_reads,
int close_writes, grpc_error_handle error) {
grpc_chttp2_transport::RemovedStreamHandle rsh;
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(
GPR_DEBUG, "MARK_STREAM_CLOSED: t=%p s=%p(id=%d) %s [%s]", t, s, s->id,
(close_reads && close_writes)
@ -2743,8 +2736,8 @@ static void read_action_locked(
// got an incoming read, cancel any pending keepalive timers
t->keepalive_incoming_data_wanted = false;
if (t->keepalive_ping_timeout_handle != TaskHandle::kInvalid) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http2_ping) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive)) {
gpr_log(GPR_INFO,
"%s[%p]: Clear keepalive timer because data was received",
t->is_client ? "CLIENT" : "SERVER", t.get());
@ -2797,7 +2790,7 @@ static void start_bdp_ping(grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
static void start_bdp_ping_locked(
grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s",
std::string(t->peer_string.as_string_view()).c_str(),
grpc_core::StatusToString(error).c_str());
@ -2824,7 +2817,7 @@ static void finish_bdp_ping(grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
static void finish_bdp_ping_locked(
grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s",
std::string(t->peer_string.as_string_view()).c_str(),
grpc_core::StatusToString(error).c_str());
@ -2968,8 +2961,8 @@ static void finish_keepalive_ping_locked(
grpc_error_handle error) {
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
if (error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive)) {
gpr_log(GPR_INFO, "%s: Finish keepalive ping",
std::string(t->peer_string.as_string_view()).c_str());
}
@ -2990,8 +2983,8 @@ static void maybe_reset_keepalive_ping_timer_locked(grpc_chttp2_transport* t) {
t->event_engine->Cancel(t->keepalive_ping_timer_handle)) {
// Cancel succeeds, resets the keepalive ping timer. Note that we don't
// need to Ref or Unref here since we still hold the Ref.
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive)) {
gpr_log(GPR_INFO, "%s: Keepalive ping cancelled. Resetting timer.",
std::string(t->peer_string.as_string_view()).c_str());
}
@ -3090,7 +3083,7 @@ static void benign_reclaimer_locked(
if (error.ok() && t->stream_map.empty()) {
// Channel with no active streams: send a goaway to try and make it
// disconnect cleanly
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(resource_quota)) {
gpr_log(GPR_INFO, "HTTP2: %s - send goaway to free memory",
std::string(t->peer_string.as_string_view()).c_str());
}
@ -3099,7 +3092,7 @@ static void benign_reclaimer_locked(
grpc_core::StatusIntProperty::kHttp2Error,
GRPC_HTTP2_ENHANCE_YOUR_CALM),
/*immediate_disconnect_hint=*/true);
} else if (error.ok() && GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
} else if (error.ok() && GRPC_TRACE_FLAG_ENABLED(resource_quota)) {
gpr_log(GPR_INFO,
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
" streams",
@ -3119,7 +3112,7 @@ static void destructive_reclaimer_locked(
if (error.ok() && !t->stream_map.empty()) {
// As stream_map is a hash map, this selects effectively a random stream.
grpc_chttp2_stream* s = t->stream_map.begin()->second;
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(resource_quota)) {
gpr_log(GPR_INFO, "HTTP2: %s - abandon stream id %d",
std::string(t->peer_string.as_string_view()).c_str(), s->id);
}

View File

@ -40,11 +40,6 @@
#include "src/core/lib/transport/transport.h"
#include "src/core/telemetry/call_tracer.h"
extern grpc_core::TraceFlag grpc_keepalive_trace;
extern grpc_core::TraceFlag grpc_trace_http2_stream_state;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser;
/// Creates a CHTTP2 Transport. This takes ownership of a \a resource_user ref
/// from the caller; if the caller still needs the resource_user after creating
/// a transport, the caller must take another ref.

View File

@ -40,8 +40,6 @@
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/util/useful.h"
grpc_core::TraceFlag grpc_flowctl_trace(false, "flowctl");
namespace grpc_core {
namespace chttp2 {
@ -235,7 +233,7 @@ void TransportFlowControl::UpdateSetting(
FlowControlAction& (FlowControlAction::*set)(FlowControlAction::Urgency,
uint32_t)) {
if (new_desired_value != *desired_value) {
if (grpc_flowctl_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(flowctl)) {
gpr_log(GPR_INFO, "[flowctl] UPDATE SETTING %s from %" PRId64 " to %d",
std::string(name).c_str(), *desired_value, new_desired_value);
}

View File

@ -41,8 +41,6 @@
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/transport/bdp_estimator.h"
extern grpc_core::TraceFlag grpc_flowctl_trace;
namespace grpc {
namespace testing {
class TrickledCHTTP2; // to make this a friend

View File

@ -37,9 +37,6 @@
#include "src/core/ext/transport/chttp2/transport/ping_callbacks.h"
#include "src/core/lib/debug/trace.h"
extern grpc_core::TraceFlag grpc_keepalive_trace;
extern grpc_core::TraceFlag grpc_http_trace;
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes) {
grpc_slice slice = GRPC_SLICE_MALLOC(9 + 8);
uint8_t* p = GRPC_SLICE_START_PTR(slice);
@ -96,7 +93,7 @@ grpc_error_handle grpc_chttp2_ping_parser_parse(void* parser,
if (p->byte == 8) {
CHECK(is_last);
if (p->is_ack) {
if (grpc_ping_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http2_ping)) {
gpr_log(GPR_INFO, "%s[%p]: received ping ack %" PRIx64,
t->is_client ? "CLIENT" : "SERVER", t, p->opaque_8bytes);
}
@ -105,7 +102,8 @@ grpc_error_handle grpc_chttp2_ping_parser_parse(void* parser,
if (!t->is_client) {
const bool transport_idle =
t->keepalive_permit_without_calls == 0 && t->stream_map.empty();
if (grpc_keepalive_trace.enabled() || grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http_keepalive) ||
GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "SERVER[%p]: received ping %" PRIx64 ": %s", t,
p->opaque_8bytes,
t->ping_abuse_policy.GetDebugString(transport_idle).c_str());
@ -113,7 +111,7 @@ grpc_error_handle grpc_chttp2_ping_parser_parse(void* parser,
if (t->ping_abuse_policy.ReceivedOnePing(transport_idle)) {
grpc_chttp2_exceeded_ping_strikes(t);
}
} else if (grpc_ping_trace.enabled()) {
} else if (GRPC_TRACE_FLAG_ENABLED(http2_ping)) {
gpr_log(GPR_INFO, "CLIENT[%p]: received ping %" PRIx64, t,
p->opaque_8bytes);
}

View File

@ -30,7 +30,6 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/ext/transport/chttp2/transport/ping_callbacks.h"
@ -111,7 +110,7 @@ grpc_error_handle grpc_chttp2_rst_stream_parser_parse(void* parser,
((static_cast<uint32_t>(p->reason_bytes[1])) << 16) |
((static_cast<uint32_t>(p->reason_bytes[2])) << 8) |
((static_cast<uint32_t>(p->reason_bytes[3])));
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO,
"[chttp2 transport=%p stream=%p] received RST_STREAM(reason=%d)",
t, s, reason);

View File

@ -33,7 +33,6 @@
#include "src/core/ext/transport/chttp2/transport/flow_control.h"
#include "src/core/ext/transport/chttp2/transport/frame_goaway.h"
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/lib/debug/trace.h"
@ -171,8 +170,8 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
t->initial_window_update +=
static_cast<int64_t>(parser->value) -
parser->incoming_settings->initial_window_size();
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_flowctl_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(flowctl)) {
gpr_log(GPR_INFO, "%p[%s] adding %d for initial_window change", t,
t->is_client ? "cli" : "svr",
static_cast<int>(t->initial_window_update));
@ -188,7 +187,7 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
"invalid value %u passed for %s", parser->value,
grpc_core::Http2Settings::WireIdToName(parser->id).c_str()));
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "CHTTP2:%s:%s: got setting %s = %d",
t->is_client ? "CLI" : "SVR",
std::string(t->peer_string.as_string_view()).c_str(),

View File

@ -31,7 +31,6 @@
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
#include "src/core/ext/transport/chttp2/transport/hpack_encoder_table.h"
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/ext/transport/chttp2/transport/varint.h"
#include "src/core/lib/debug/trace.h"
@ -118,7 +117,7 @@ void HPackCompressor::SetMaxUsableSize(uint32_t max_table_size) {
void HPackCompressor::SetMaxTableSize(uint32_t max_table_size) {
if (table_.SetMaxSize(std::min(max_usable_size_, max_table_size))) {
advertise_table_size_change_ = true;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "set max table size from encoder to %d",
max_table_size);
}
@ -378,7 +377,8 @@ void Compressor<HttpSchemeMetadata, HttpSchemeCompressor>::EncodeWith(
encoder->EmitIndexed(7); // :scheme: https
break;
case HttpSchemeMetadata::ValueType::kInvalid:
Crash("invalid http scheme encoding");
LOG(ERROR) << "Not encoding bad http scheme";
encoder->NoteEncodingError();
break;
}
}
@ -435,7 +435,8 @@ void Compressor<HttpMethodMetadata, HttpMethodCompressor>::EncodeWith(
Slice::FromStaticString(":method"), Slice::FromStaticString("PUT"));
break;
case HttpMethodMetadata::ValueType::kInvalid:
Crash("invalid http method encoding");
LOG(ERROR) << "Not encoding bad http method";
encoder->NoteEncodingError();
break;
}
}

View File

@ -82,10 +82,14 @@ class Encoder {
const Slice& slice, uint32_t* index,
size_t max_compression_size);
void NoteEncodingError() { saw_encoding_errors_ = true; }
bool saw_encoding_errors() const { return saw_encoding_errors_; }
HPackEncoderTable& hpack_table();
private:
const bool use_true_binary_metadata_;
bool saw_encoding_errors_ = false;
HPackCompressor* const compressor_;
SliceBuffer& output_;
};
@ -207,6 +211,7 @@ class Compressor<
gpr_log(GPR_ERROR, "%s",
absl::StrCat("Not encoding bad ", MetadataTrait::key(), " header")
.c_str());
encoder->NoteEncodingError();
return;
}
Slice encoded(MetadataTrait::Encode(known_value));
@ -354,19 +359,21 @@ class HPackCompressor {
};
template <typename HeaderSet>
void EncodeHeaders(const EncodeHeaderOptions& options,
bool EncodeHeaders(const EncodeHeaderOptions& options,
const HeaderSet& headers, grpc_slice_buffer* output) {
SliceBuffer raw;
hpack_encoder_detail::Encoder encoder(
this, options.use_true_binary_metadata, raw);
headers.Encode(&encoder);
Frame(options, raw, output);
return !encoder.saw_encoding_errors();
}
template <typename HeaderSet>
void EncodeRawHeaders(const HeaderSet& headers, SliceBuffer& output) {
bool EncodeRawHeaders(const HeaderSet& headers, SliceBuffer& output) {
hpack_encoder_detail::Encoder encoder(this, true, output);
headers.Encode(&encoder);
return !encoder.saw_encoding_errors();
}
private:

View File

@ -59,8 +59,6 @@
namespace grpc_core {
TraceFlag grpc_trace_chttp2_hpack_parser(false, "chttp2_hpack_parser");
namespace {
// The alphabet used for base64 encoding binary metadata.
constexpr char kBase64Alphabet[] =
@ -733,7 +731,7 @@ class HPackParser::Parser {
bool FinishHeaderAndAddToTable(HPackTable::Memento md) {
// Log if desired
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) {
if (GRPC_TRACE_FLAG_ENABLED(chttp2_hpack_parser)) {
LogHeader(md);
}
// Emit whilst we own the metadata.
@ -758,7 +756,7 @@ class HPackParser::Parser {
void FinishHeaderOmitFromTable(const HPackTable::Memento& md) {
// Log if desired
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) {
if (GRPC_TRACE_FLAG_ENABLED(chttp2_hpack_parser)) {
LogHeader(md);
}
EmitHeader(md);

View File

@ -35,7 +35,6 @@
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
#include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/slice/slice.h"
@ -99,9 +98,7 @@ void HPackTable::SetMaxBytes(uint32_t max_bytes) {
if (max_bytes_ == max_bytes) {
return;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
LOG(INFO) << "Update hpack parser max size to " << max_bytes;
}
GRPC_TRACE_LOG(http, INFO) << "Update hpack parser max size to " << max_bytes;
while (mem_used_ > max_bytes) {
EvictOne();
}
@ -111,9 +108,7 @@ void HPackTable::SetMaxBytes(uint32_t max_bytes) {
bool HPackTable::SetCurrentTableSize(uint32_t bytes) {
if (current_table_bytes_ == bytes) return true;
if (bytes > max_bytes_) return false;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
LOG(INFO) << "Update hpack parser table size to " << bytes;
}
GRPC_TRACE_LOG(http, INFO) << "Update hpack parser table size to " << bytes;
while (mem_used_ > bytes) {
EvictOne();
}

View File

@ -1,19 +0,0 @@
// Copyright 2022 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include <grpc/support/port_platform.h>
grpc_core::TraceFlag grpc_http_trace(false, "http");

View File

@ -1,24 +0,0 @@
// Copyright 2022 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP_TRACE_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP_TRACE_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/debug/trace.h"
extern grpc_core::TraceFlag grpc_http_trace;
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP_TRACE_H

View File

@ -807,13 +807,12 @@ void grpc_chttp2_settings_timeout(
#define GRPC_CHTTP2_CLIENT_CONNECT_STRLEN \
(sizeof(GRPC_CHTTP2_CLIENT_CONNECT_STRING) - 1)
// extern grpc_core::TraceFlag grpc_flowctl_trace;
#define GRPC_CHTTP2_IF_TRACING(stmt) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { \
(stmt); \
} \
//
#define GRPC_CHTTP2_IF_TRACING(stmt) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(http)) { \
(stmt); \
} \
} while (0)
void grpc_chttp2_fake_status(grpc_chttp2_transport* t,

View File

@ -54,7 +54,6 @@
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h"
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h"
@ -78,8 +77,6 @@
using grpc_core::HPackParser;
grpc_core::TraceFlag grpc_trace_chttp2_new_stream(false, "chttp2_new_stream");
static grpc_error_handle init_frame_parser(grpc_chttp2_transport* t,
size_t& requests_started);
static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
@ -334,7 +331,7 @@ absl::variant<size_t, absl::Status> grpc_chttp2_perform_read(
case GRPC_DTS_FH_8:
DCHECK_LT(cur, end);
t->incoming_stream_id |= (static_cast<uint32_t>(*cur));
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_INFO, "INCOMING[%p]: %s len:%d id:0x%08x", t,
FrameTypeString(t->incoming_frame_type, t->incoming_frame_flags)
.c_str(),
@ -455,7 +452,7 @@ static grpc_error_handle init_frame_parser(grpc_chttp2_transport* t,
case GRPC_CHTTP2_FRAME_GOAWAY:
return init_goaway_parser(t);
default:
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_ERROR, "Unknown frame type %02x", t->incoming_frame_type);
}
return init_non_header_skip_frame_parser(t);
@ -715,8 +712,8 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
return init_header_skip_frame_parser(t, priority_type, is_eoh);
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_new_stream)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(chttp2_new_stream)) {
gpr_log(GPR_INFO,
"[t:%p fd:%d peer:%s] Accepting new stream; "
"num_incoming_streams_before_settings_ack=%u",
@ -796,7 +793,7 @@ static grpc_error_handle init_window_update_frame_parser(
grpc_chttp2_stream* s = t->incoming_stream =
grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
if (s == nullptr) {
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_ERROR, "Stream %d not found, ignoring WINDOW_UPDATE",
t->incoming_stream_id);
}
@ -888,18 +885,17 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
const grpc_slice& slice,
int is_last) {
grpc_chttp2_stream* s = t->incoming_stream;
if (grpc_http_trace.enabled()) {
VLOG(2) << "INCOMING[" << t << ";" << s << "]: Parse "
<< GRPC_SLICE_LENGTH(slice) << "b " << (is_last ? "last " : "")
<< "frame fragment with " << t->parser.name;
}
GRPC_TRACE_VLOG(http, 2) << "INCOMING[" << t << ";" << s << "]: Parse "
<< GRPC_SLICE_LENGTH(slice) << "b "
<< (is_last ? "last " : "") << "frame fragment with "
<< t->parser.name;
grpc_error_handle err =
t->parser.parser(t->parser.user_data, t, s, slice, is_last);
intptr_t unused;
if (GPR_LIKELY(err.ok())) {
return err;
}
if (grpc_http_trace.enabled()) {
if (GRPC_TRACE_FLAG_ENABLED(http)) {
gpr_log(GPR_ERROR, "INCOMING[%p;%p]: Parse failed with %s", t, s,
err.ToString().c_str());
}

View File

@ -23,8 +23,6 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
grpc_core::TraceFlag grpc_ping_trace(false, "http2_ping");
namespace grpc_core {
void Chttp2PingCallbacks::OnPing(Callback on_start, Callback on_ack) {

View File

@ -33,8 +33,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/time.h"
extern grpc_core::TraceFlag grpc_ping_trace;
namespace grpc_core {
class Chttp2PingCallbacks {

View File

@ -44,8 +44,6 @@ static const char* stream_list_id_string(grpc_chttp2_stream_list_id id) {
GPR_UNREACHABLE_CODE(return "unknown");
}
grpc_core::TraceFlag grpc_trace_http2_stream_state(false, "http2_stream_state");
// core list management
static bool stream_list_empty(grpc_chttp2_transport* t,
@ -70,7 +68,7 @@ static bool stream_list_pop(grpc_chttp2_transport* t,
s->included.clear(id);
}
*stream = s;
if (s && GRPC_TRACE_FLAG_ENABLED(grpc_trace_http2_stream_state)) {
if (s && GRPC_TRACE_FLAG_ENABLED(http2_stream_state)) {
gpr_log(GPR_INFO, "%p[%d][%s]: pop from %s", t, s->id,
t->is_client ? "cli" : "svr", stream_list_id_string(id));
}
@ -92,7 +90,7 @@ static void stream_list_remove(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
} else {
t->lists[id].tail = s->links[id].prev;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_http2_stream_state)) {
if (GRPC_TRACE_FLAG_ENABLED(http2_stream_state)) {
gpr_log(GPR_INFO, "%p[%d][%s]: remove from %s", t, s->id,
t->is_client ? "cli" : "svr", stream_list_id_string(id));
}
@ -124,7 +122,7 @@ static void stream_list_add_tail(grpc_chttp2_transport* t,
}
t->lists[id].tail = s;
s->included.set(id);
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_http2_stream_state)) {
if (GRPC_TRACE_FLAG_ENABLED(http2_stream_state)) {
gpr_log(GPR_INFO, "%p[%d][%s]: add to %s", t, s->id,
t->is_client ? "cli" : "svr", stream_list_id_string(id));
}

View File

@ -47,7 +47,6 @@
#include "src/core/ext/transport/chttp2/transport/frame_window_update.h"
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h"
@ -133,10 +132,10 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
t->channelz_socket->RecordKeepaliveSent();
}
grpc_core::global_stats().IncrementHttp2PingsSent();
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(bdp_estimator) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive) ||
GRPC_TRACE_FLAG_ENABLED(http2_ping)) {
gpr_log(GPR_INFO, "%s[%p]: Ping %" PRIx64 " sent [%s]: %s",
t->is_client ? "CLIENT" : "SERVER", t, id,
std::string(t->peer_string.as_string_view()).c_str(),
@ -145,10 +144,10 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
},
[t](grpc_core::Chttp2PingRatePolicy::TooManyRecentPings) {
// need to receive something of substance before sending a ping again
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(bdp_estimator) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive) ||
GRPC_TRACE_FLAG_ENABLED(http2_ping)) {
gpr_log(GPR_INFO,
"%s[%p]: Ping delayed [%s]: too many recent pings: %s",
t->is_client ? "CLIENT" : "SERVER", t,
@ -158,10 +157,10 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
},
[t](grpc_core::Chttp2PingRatePolicy::TooSoon too_soon) {
// not enough elapsed time between successive pings
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http) ||
GRPC_TRACE_FLAG_ENABLED(bdp_estimator) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive) ||
GRPC_TRACE_FLAG_ENABLED(http2_ping)) {
gpr_log(
GPR_INFO,
"%s[%p]: Ping delayed [%s]: not enough time elapsed since last "
@ -207,7 +206,7 @@ static bool update_list(grpc_chttp2_transport* t, int64_t send_bytes,
static void report_stall(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
const char* staller) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_flowctl_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(flowctl)) {
gpr_log(
GPR_DEBUG,
"%s:%p stream %d moved to stalled list by %s. This is FULLY expected "
@ -728,7 +727,7 @@ void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error_handle error) {
grpc_core::ExecCtx exec_ctx;
grpc_chttp2_ping_timeout(t);
});
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace) && id.has_value()) {
if (GRPC_TRACE_FLAG_ENABLED(http2_ping) && id.has_value()) {
gpr_log(GPR_INFO,
"%s[%p]: Set ping timeout timer of %s for ping id %" PRIx64,
t->is_client ? "CLIENT" : "SERVER", t, timeout.ToString().c_str(),
@ -740,8 +739,8 @@ void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error_handle error) {
t->keepalive_ping_timeout_handle !=
grpc_event_engine::experimental::EventEngine::TaskHandle::
kInvalid) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(http2_ping) ||
GRPC_TRACE_FLAG_ENABLED(http_keepalive)) {
gpr_log(GPR_INFO, "%s[%p]: Set keepalive ping timeout timer of %s",
t->is_client ? "CLIENT" : "SERVER", t,
t->keepalive_timeout.ToString().c_str());

View File

@ -67,10 +67,9 @@
#define GRPC_HEADER_SIZE_IN_BYTES 5
#define GRPC_FLUSH_READ_SIZE 4096
grpc_core::TraceFlag grpc_cronet_trace(false, "cronet");
#define CRONET_LOG(...) \
do { \
if (grpc_cronet_trace.enabled()) gpr_log(__VA_ARGS__); \
#define CRONET_LOG(...) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(cronet)) gpr_log(__VA_ARGS__); \
} while (0)
enum e_op_result {

View File

@ -1,23 +0,0 @@
//
//
// Copyright 2017 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#include <grpc/support/port_platform.h>
#include "src/core/lib/debug/trace.h"
grpc_core::TraceFlag grpc_inproc_trace(false, "inproc");

View File

@ -25,8 +25,6 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
const grpc_channel_args* args,
void* reserved);
extern grpc_core::TraceFlag grpc_inproc_trace;
namespace grpc_core {
std::pair<OrphanablePtr<Transport>, OrphanablePtr<Transport>>

View File

@ -69,11 +69,11 @@
#include "src/core/lib/transport/transport.h"
#include "src/core/server/server.h"
#define INPROC_LOG(...) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_inproc_trace)) { \
gpr_log(__VA_ARGS__); \
} \
#define INPROC_LOG(...) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(inproc)) { \
gpr_log(__VA_ARGS__); \
} \
} while (0)
namespace {
@ -352,7 +352,7 @@ class CopySink {
void fill_in_metadata(inproc_stream* s, const grpc_metadata_batch* metadata,
grpc_metadata_batch* out_md, bool* markfilled) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_inproc_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(inproc)) {
log_metadata(metadata, s->t->is_client,
metadata->get_pointer(grpc_core::WaitForReady()) != nullptr);
}
@ -949,7 +949,7 @@ void inproc_transport::PerformStreamOp(grpc_stream* gs,
gpr_mu* mu = &s->t->mu->mu; // save aside in case s gets closed
gpr_mu_lock(mu);
if (GRPC_TRACE_FLAG_ENABLED(grpc_inproc_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(inproc)) {
if (op->send_initial_metadata) {
log_metadata(op->payload->send_initial_metadata.send_initial_metadata,
s->t->is_client, true);

View File

@ -24,6 +24,4 @@ grpc_channel* grpc_legacy_inproc_channel_create(grpc_server* server,
const grpc_channel_args* args,
void* reserved);
extern grpc_core::TraceFlag grpc_inproc_trace;
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_INPROC_LEGACY_INPROC_TRANSPORT_H

View File

@ -43,8 +43,6 @@
namespace grpc_core {
TraceFlag grpc_handshaker_trace(false, "handshaker");
namespace {
using ::grpc_event_engine::experimental::EventEngine;
@ -62,13 +60,12 @@ std::string HandshakerArgsString(HandshakerArgs* args) {
} // namespace
HandshakeManager::HandshakeManager()
: RefCounted(GRPC_TRACE_FLAG_ENABLED(grpc_handshaker_trace)
? "HandshakeManager"
: nullptr) {}
: RefCounted(GRPC_TRACE_FLAG_ENABLED(handshaker) ? "HandshakeManager"
: nullptr) {}
void HandshakeManager::Add(RefCountedPtr<Handshaker> handshaker) {
MutexLock lock(&mu_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_handshaker_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(
GPR_INFO,
"handshake_manager %p: adding handshaker %s [%p] at index %" PRIuPTR,
@ -94,7 +91,7 @@ void HandshakeManager::Shutdown(grpc_error_handle why) {
// on_handshake_done callback.
// Returns true if we've scheduled the on_handshake_done callback.
bool HandshakeManager::CallNextHandshakerLocked(grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_handshaker_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(GPR_INFO,
"handshake_manager %p: error=%s shutdown=%d index=%" PRIuPTR
", args=%s",
@ -123,7 +120,7 @@ bool HandshakeManager::CallNextHandshakerLocked(grpc_error_handle error) {
}
args_.args = ChannelArgs();
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_handshaker_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(GPR_INFO,
"handshake_manager %p: handshaking complete -- scheduling "
"on_handshake_done with error=%s",
@ -136,7 +133,7 @@ bool HandshakeManager::CallNextHandshakerLocked(grpc_error_handle error) {
is_shutdown_ = true;
} else {
auto handshaker = handshakers_[index_];
if (GRPC_TRACE_FLAG_ENABLED(grpc_handshaker_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(
GPR_INFO,
"handshake_manager %p: calling handshaker %s [%p] at index %" PRIuPTR,

View File

@ -26,6 +26,7 @@
#include "absl/base/thread_annotations.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
@ -51,7 +52,6 @@
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/resource_quota/trace.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/tsi/transport_security_grpc.h"
@ -146,8 +146,6 @@ struct secure_endpoint {
};
} // namespace
grpc_core::TraceFlag grpc_trace_secure_endpoint(false, "secure_endpoint");
static void destroy(secure_endpoint* ep) { delete ep; }
#ifndef NDEBUG
@ -157,7 +155,7 @@ static void destroy(secure_endpoint* ep) { delete ep; }
secure_endpoint_ref((ep), (reason), __FILE__, __LINE__)
static void secure_endpoint_unref(secure_endpoint* ep, const char* reason,
const char* file, int line) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_secure_endpoint)) {
if (GRPC_TRACE_FLAG_ENABLED(secure_endpoint)) {
gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val,
@ -170,7 +168,7 @@ static void secure_endpoint_unref(secure_endpoint* ep, const char* reason,
static void secure_endpoint_ref(secure_endpoint* ep, const char* reason,
const char* file, int line) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_secure_endpoint)) {
if (GRPC_TRACE_FLAG_ENABLED(secure_endpoint)) {
gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val,
@ -198,7 +196,7 @@ static void maybe_post_reclaimer(secure_endpoint* ep) {
grpc_core::ReclamationPass::kBenign,
[ep](absl::optional<grpc_core::ReclamationSweep> sweep) {
if (sweep.has_value()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
if (GRPC_TRACE_FLAG_ENABLED(resource_quota)) {
gpr_log(GPR_INFO,
"secure endpoint: benign reclamation to free memory");
}
@ -235,13 +233,12 @@ static void flush_read_staging_buffer(secure_endpoint* ep, uint8_t** cur,
}
static void call_read_cb(secure_endpoint* ep, grpc_error_handle error) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_secure_endpoint) &&
gpr_should_log(GPR_LOG_SEVERITY_INFO)) {
if (GRPC_TRACE_FLAG_ENABLED(secure_endpoint) && ABSL_VLOG_IS_ON(2)) {
size_t i;
for (i = 0; i < ep->read_buffer->count; i++) {
char* data = grpc_dump_slice(ep->read_buffer->slices[i],
GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_INFO, "READ %p: %s", ep, data);
VLOG(2) << "READ " << ep << ": " << data;
gpr_free(data);
}
}
@ -403,12 +400,11 @@ static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
grpc_slice_buffer_reset_and_unref(&ep->output_buffer);
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_secure_endpoint) &&
gpr_should_log(GPR_LOG_SEVERITY_INFO)) {
if (GRPC_TRACE_FLAG_ENABLED(secure_endpoint) && ABSL_VLOG_IS_ON(2)) {
for (i = 0; i < slices->count; i++) {
char* data =
grpc_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_INFO, "WRITE %p: %s", ep, data);
VLOG(2) << "WRITE " << ep << ": " << data;
gpr_free(data);
}
}

View File

@ -28,8 +28,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/endpoint.h"
extern grpc_core::TraceFlag grpc_trace_secure_endpoint;
// Takes ownership of protector, zero_copy_protector, and to_wrap, and refs
// leftover_slices. If zero_copy_protector is not NULL, protector will never be
// used.

Some files were not shown because too many files have changed in this diff Show More