1024 Commits

Author SHA1 Message Date
Craig Tiller
a8b31fab81 Refactor CallTracer API for SendInitialMetadata.
This change introduces a new experiment `call_tracer_send_initial_metadata_is_an_annotation`. When enabled, the `CallTracer::RecordSendInitialMetadata` method will now record a `SendInitialMetadataAnnotation` and call a new `MutateSendInitialMetadata` method on the underlying `CallTracerInterface`.

The `CallTracerInterface` and its implementations (including XorMetrics, OpenCensus, OpenTelemetry, and test fakes) have been updated to include the new `MutateSendInitialMetadata` virtual method. The existing `RecordSendInitialMetadata` implementations are modified to check the experiment flag and delegate to `MutateSendInitialMetadata` if the experiment is active.

A new `SendInitialMetadataAnnotation` class is added, which inherits from `CallTracerAnnotationInterface::Annotation`. This annotation type is used to capture the state of the initial metadata for immutable tracing purposes.

Additionally, `ForEachKeyValue` methods are added to `MetadataInfo` and `HttpAnnotation` to facilitate iterating over metadata key-value pairs for annotation recording. The experiment configuration files are updated to include the new experiment.

PiperOrigin-RevId: 854227812
2026-01-09 09:47:03 -08:00
Jordan Rupprecht
41780cddd1 Avoid multimap::find unspecified behavior (#41279)
When a `std::multimap` has multiple entries with the same key, calling `m.find(key)` returns an unspecified element.

Historically, this returns the first matching element. However, this is not guaranteed, and recent libc++ changes make this return an arbitrary element.

Using `m.equal_range(key)` is a replacement that will preserve the current behavior. The behavior of this is guaranteed to return a range of all matching elements in insertion order, and the beginning of the range is the same element as what's normally returned by `m.find(key)`.

Closes #41279

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41279 from rupprecht:multimap-find 70b116441d03eff80523e010b25336f5a75c70c2
PiperOrigin-RevId: 852844558
2026-01-06 10:44:32 -08:00
Rishesh Agarwal
09218ae889 Adding layering_check and parse_headers in test files (#41226)
Closes #41226

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41226 from rishesh007:layering_test 02e735767f22e934850d5e150c5e3d577bdfbecb
PiperOrigin-RevId: 844606259
2025-12-14 23:05:28 -08:00
Akshit Patel
8e05cf46f8 [benchmark]
PiperOrigin-RevId: 833652476
2025-11-17 22:28:15 -08:00
Craig Tiller
339906443b [clang-format] Match include file ordering to internal clang-format (#40905)
gRPC is currently getting formatted with two different clang-format implementations, and due to some weirdness they have different include file orderings. This change introduces clang-format configuration to ensure that the two systems align - it's *highly* expected that this will need some maintenance going forward as the two systems evolve.

Closes #40905

PiperOrigin-RevId: 819606209
2025-10-15 00:24:11 -07:00
Rishesh Agarwal
ecb1d4a9b7 This PR adds the missing dependencies src/core:grpc_check and :channel_arg_names to the relevant parts of the codebase
PiperOrigin-RevId: 814622149
2025-10-03 03:29:30 -07:00
Adam Heller
f5ffef4d6b [test] Add PostMortem dumps on CHECK failures in test builds (#39945)
See `grpc_check.h`. This code  redefines the abseil `CHECK*` macros using custom gRPC macros when building tests. In `bazel test ...` builds, on check failure, `PostMortemEmit()` will dump state to the log before crashing.

Caveat: to prevent circular dependencies, code that `postmortem` relies on cannot use the custom gRPC CHECK macros. This is not much code, ~50 source files. grep for the `absl/log:check` bazel dependency.

Closes #39945

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39945 from drfloob:grpc_check ca8e46718f2021e0df79aa67a3a0b0c751b3ce44
PiperOrigin-RevId: 807452496
2025-09-15 17:43:19 -07:00
Rishesh Agarwal
ed7eaa5e54 update deps for eventmanager's build
PiperOrigin-RevId: 802499797
2025-09-03 04:40:04 -07:00
Rishesh Agarwal
931969b868 Update microbenchmarks, cpp/util deps for layering_check and parse_headers
PiperOrigin-RevId: 802413253
2025-09-02 23:00:40 -07:00
Rishesh Agarwal
86a025624c [build] Add Missing Dependencies for test/cpp/microbenchmarks, test/cpp/qps in Preparation for Enabling layering_check
PiperOrigin-RevId: 798064926
2025-08-21 23:12:41 -07:00
Craig Tiller
ccb51eaa23 [latent_see] Add always on latent-see, and a service to drive it (#39781)
Change up latent-see so that it's an always-on thing.

Most of the testing code we've got so far should be updated to use `grpc_core::latent_see::Collect()` - there's a JSON exporter there, and I plan to implement a Fuchsia Trace Format one eventually too (much more compact trace representaton!).

Also added is a service (visibility protected!) that we'll be able to share with partners to allow collecting this data from real systems. That part is strictly opt-in for the moment.

Closes #39781

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39781 from ctiller:nicety b2e855d9279ee4724961f479ba5c714c823e48a2
PiperOrigin-RevId: 786425381
2025-07-23 14:33:32 -07:00
Craig Tiller
82bdf31cfa Switch chaotic-good to new style endpoint-transport creation
Leverage the work done in https://github.com/grpc/grpc/pull/39294 and https://github.com/grpc/grpc/pull/39252 to allow chaotic-good to be instantiated with regular credentials.

PiperOrigin-RevId: 750635528
2025-04-23 10:15:10 -07:00
Craig Tiller
915b34cef5 [channelz] Add tracers to chaotic-good (#39233)
At the same time, makes the change to elevate channelz to a first class thing a transport should provide.
We still (for the moment) allow a transport to return a null SocketNode, but the transport must explicitly opt to do so.
In turn, update subchannel, server code to use the transport API to retrieve this object, instead of using an alternative squirrly method that's different between client, server.

Closes #39233

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39233 from ctiller:cg-tracer 7141b9bd8ccb802b21e1ba428f80c0fde05083f4
PiperOrigin-RevId: 749971664
2025-04-21 17:25:05 -07:00
Craig Tiller
e31434c6a6 [channelz] HTTP/2 ztrace facility (#39189)
<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39189 from ctiller:http2-trace 547f78604124cc3005fbee6098487a2110afb926
PiperOrigin-RevId: 746174350
2025-04-10 14:28:47 -07:00
Craig Tiller
3690c7bf16 Split connection and per-call metric tracking
We never want to call the connection recording methods on calls, nor call level metrics on connections - so there's really two interfaces here.

This CL separates those two interfaces to ease tracing data flow through the stack.

PiperOrigin-RevId: 743264459
2025-04-02 13:47:47 -07:00
Mark D. Roth
0bf60a425e [metrics] pass StatsPluginGroup down via channel args (#39130)
Closes #39130

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39130 from markdroth:stats_plugin_group_propagation 82b43c6adc1f007fe213cdf3d15b7647a3e39383
PiperOrigin-RevId: 743240083
2025-04-02 12:39:19 -07:00
Mark D. Roth
32881b9652 [reorg] move metadata, message, and interception_chain to src/core/call (#38972)
Closes #38972

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38972 from markdroth:reorg_call2 86686b70242c935076359c64123c47e707073aca
PiperOrigin-RevId: 737014454
2025-03-14 16:04:43 -07:00
Craig Tiller
12fcd268d4 Internal build cleanup
PiperOrigin-RevId: 732468670
2025-03-01 10:00:38 -08:00
Craig Tiller
a0ff460d2d Tag some targets that have internal build issues
PiperOrigin-RevId: 731520925
2025-02-26 17:56:54 -08:00
AJ Heller
69afb9c2e3 [core] Remove ApplicationCallbackExecCtx (#38444)
An experiment was conducted over the past few months to bypass the ApplicationCallbackExecCtx, instead running all application callbacks on an EventEngine. The rollout is completing ~today (2025-01-13). After another week or so without issues, this PR can be merged to delete the ApplicationCallbackExecCtx.

Closes #38444

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38444 from drfloob:rm-acec 79a6047af0406e614973c13fdfbfc1d0de9026ed
PiperOrigin-RevId: 725691141
2025-02-11 10:48:20 -08:00
Craig Tiller
eebce860be Slightly better latent_see tracing for these benchmarks (#38471)
Closes #38471

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38471 from ctiller:bmf c4b7c03954aa9a68505cd4f57bb8628a82100b0d
PiperOrigin-RevId: 721798628
2025-01-31 09:26:43 -08:00
Yash Tibrewal
ad8fcaa20b [CallTracer] Add hint on whether inbound message is compressed (#38485)
Needed for https://github.com/grpc/proposal/blob/master/A72-open-telemetry-tracing.md

Closes #38485

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38485 from yashykt:AddCompressedHintToRecordReceivedMessage a468e0a5387b35460620fb04dff8db70cea28f3d
PiperOrigin-RevId: 716788992
2025-01-17 13:54:15 -08:00
Craig Tiller
adeb4655e8 Automated rollback of commit 9651af5b43.
PiperOrigin-RevId: 702378862
2024-12-03 10:08:41 -08:00
Yijie Ma
9651af5b43 [Alarm] Fix Alarm reuse on cancellation (#38114)
Fix https://github.com/grpc/grpc/issues/38092

This change fixes the alarm object reuse on cancellation cases for the CQ-based alarm and callback alarm. The solution of letting `Set` wait for `cq.Next` is proposed by @drfloob in https://github.com/grpc/grpc/pull/38160.

<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38114 from yijiem:38092 e1aceffc2a86b22cf3bf081ed862f1f2026fea29
PiperOrigin-RevId: 702067567
2024-12-02 13:27:57 -08:00
Mark D. Roth
7570d8b545 [reorg] move src/core/lib/config -> src/core/config (#37847)
Closes #37847

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37847 from markdroth:reorg_config 191c5460bc2b9c974bf76a3eedc876963d296f47
PiperOrigin-RevId: 698957093
2024-11-22 05:46:04 +00:00
Esun Kim
6a0c483bea [CI] Upgraded clang to 19 for sanity tests (#38070)
This change upgrades the sanity test to use Clang 19, including clang-format and clang-tidy. (It's a partial implementation of the changes proposed in #38038)

Key updates:
- Docker images now utilize Clang 19.
- Code has been reformatted using the updated clang-format.
- Resolved `readability-math-missing-parentheses` warnings raised by clang-tidy.

Note that the other part of the clang-19 upgrade, "using clang-19 for C++ test" will be done once opentelemetry-cpp fixes the clang-19 build error.

Closes #38070

PiperOrigin-RevId: 693833548
2024-11-06 13:04:41 -08:00
Mark D. Roth
55b1ae9700 [build] replace grpc_proto_library rules with separate proto_library/cc_proto_library/cc_grpc_library rules (#37943)
Closes #37943

PiperOrigin-RevId: 691538475
2024-10-30 13:45:41 -07:00
AJ Heller
13efb55dbc [benchmark] Remove redundant callback benchmarks (#37935)
In https://github.com/grpc/grpc/pull/37077, the "different message size" benchmarks were made identical to the benchmarks defined on the lines above them.

Closes #37935

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37935 from drfloob:rm-duplicate-callback-benchmarks ad3f5694148e9a68ef70576a6932526e6665146c
PiperOrigin-RevId: 686647838
2024-10-16 14:44:08 -07:00
AJ Heller
0b13caed53 [benchmark] Measure all threads' CPU usage in callback benchmarks (#37936)
google/benchmark only measures the main thread's CPU by default, and benchmark iteration depends on CPU utilization. These benchmarks were taking a long time since the callback API uses a lot of internal threads, and the benchmarks weren't producing useful metrics. See the documentation here https://google.github.io/benchmark/user_guide.html#cpu-timers

Test command for master: `bazel test --config=opt --test_output=streamed //test/cpp/microbenchmarks:bm_callback_streaming_ping_pong --test_arg='--benchmark_min_time=0.05s' --test_arg='--benchmark_min_warmup_time=0.01' --test_arg='--benchmark_filter=.*<MinIn.*/*/1$'`

For this PR, change the filter to `--test_arg='--benchmark_filter=.*<MinIn.*/*/1/proc.*'`

Before this change (scroll right for `inf` bytes/s, and note the 10k iterations even though the specified benchmark time had been reached):
```
---------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                             Time             CPU   Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------------------------------
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/0/1              38932 ns         1052 ns        10000 bytes_per_second=0/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/1/1              39002 ns        0.000 ns        10000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/8/1              39457 ns        0.000 ns        10000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/64/1             51693 ns        0.000 ns        10000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/512/1            41174 ns        0.000 ns        10000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/4096/1           45006 ns        0.000 ns        10000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/32768/1          70990 ns        0.000 ns        10000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/262144/1        302831 ns        0.000 ns         1000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/2097152/1      2202385 ns        0.000 ns         1000 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/16777216/1    30137348 ns        0.000 ns           10 bytes_per_second=inf/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/134217728/1  437821865 ns        0.000 ns            1 bytes_per_second=inf/s
...
//test/cpp/microbenchmarks:bm_callback_streaming_ping_pong               PASSED in 25.7s
```

After this change:

```
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                                                    Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/0/1/process_time/real_time              38233 ns        75471 ns         1768 bytes_per_second=0/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/1/1/process_time/real_time              38847 ns        76616 ns         1781 bytes_per_second=50.2778Ki/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/8/1/process_time/real_time              38848 ns        76929 ns         1758 bytes_per_second=402.21Ki/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/64/1/process_time/real_time             49873 ns        95929 ns         1685 bytes_per_second=2.44761Mi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/512/1/process_time/real_time            41606 ns        80703 ns         1431 bytes_per_second=23.4718Mi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/4096/1/process_time/real_time           45495 ns        86097 ns         1335 bytes_per_second=171.722Mi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/32768/1/process_time/real_time          71506 ns       117093 ns          806 bytes_per_second=874.048Mi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/262144/1/process_time/real_time        353012 ns       433389 ns          183 bytes_per_second=1.38319Gi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/2097152/1/process_time/real_time      3059811 ns      3215404 ns           18 bytes_per_second=1.27663Gi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/16777216/1/process_time/real_time    34951210 ns     35279138 ns            2 bytes_per_second=915.562Mi/s
BM_CallbackBidiStreaming<MinInProcess, NoOpMutator, NoOpMutator>/134217728/1/process_time/real_time  443034887 ns    444528037 ns            1 bytes_per_second=577.833Mi/s
...
//test/cpp/microbenchmarks:bm_callback_streaming_ping_pong               PASSED in 5.1s
```

Closes #37936

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37936 from drfloob:bm-callback-measures-all-thread-cpu d5ba8420bd00e390209c49dc91ef08be9f31840e
PiperOrigin-RevId: 686640919
2024-10-16 14:24:22 -07:00
Craig Tiller
47faab618b Add more flexibility for internal benchmark monitoring systems
PiperOrigin-RevId: 685823731
2024-10-14 13:53:45 -07:00
Craig Tiller
6c89e3909f [benchmarks] Remove monitoring for one more expensive benchmark (#37906)
Closes #37906

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37906 from ctiller:lol-still-nope 754696369d419b27e717dbb959adeea876c2d50d
PiperOrigin-RevId: 685239520
2024-10-12 12:20:48 -07:00
Craig Tiller
a9038be11e [benchmarks] Disable monitoring on some of our larger microbenchmarks for now (#37905)
These look too large for the configured timeouts internally... will revisit later once the system is starting to be more ready.

Closes #37905

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37905 from ctiller:lol-nope 6d44e515b31405cd4b70954cb9ebbd2391c3d6c0
PiperOrigin-RevId: 685223450
2024-10-12 10:49:59 -07:00
Craig Tiller
92c9dec6c4 [benchmarks] Enable monitoring on a swath of benchmarks (#37903)
We'll probably disable some next week :)
But I want to watch a good selection and refine criteria for acceptance.

Closes #37903

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37903 from ctiller:ALL-the-things 5f829db87019ae81c64fceaf679d5adc50e115dd
PiperOrigin-RevId: 685010911
2024-10-11 17:46:35 -07:00
Craig Tiller
c7eebad1c0 Configure internal benchmark monitoring systems
PiperOrigin-RevId: 684961980
2024-10-11 14:51:07 -07:00
Nathan Baulch
b2a05bebe0 [maintenance] Fix cpp typos (#37755)
Continuation of #37541 but focused on C++.

Closes #37755

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37755 from NathanBaulch:typos-cpp 9a7fd9d65fa97a689d529772534df1a501031e9f
PiperOrigin-RevId: 684600898
2024-10-10 15:37:18 -07:00
Craig Tiller
dbb5164ac7 [clang-format] Remove custom clang-format rules for include ordering (#37820)
Closes #37820

PiperOrigin-RevId: 682352913
2024-10-04 09:44:20 -07:00
Mark D. Roth
f6c57b6384 [reorg] move a bunch of stuff to src/core/util (#36792)
The following files have been moved:
- src/core/lib/avl/*
- src/core/lib/backoff/*
- src/core/lib/debug/event_log*
- src/core/lib/iomgr/gethostname*
- src/core/lib/iomgr/grpc_if_nametoindex*
- src/core/lib/matchers/*
- src/core/lib/uri/* (renamed from uri_parser.* to uri.*)
- src/core/lib/gprpp/* (existing src/core/util/time.cc was renamed to gpr_time.cc to avoid conflict)

Closes #36792

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36792 from markdroth:reorg_util d4e8996f481c611ffbb06a8b04924ff81bc1bc2b
PiperOrigin-RevId: 676947640
2024-09-20 13:19:02 -07:00
Tanvi Jagtap
0b30791867 [Gpr_To_Absl_Logging] Remove gpr logging header include from other headers (#37513)
[Gpr_To_Absl_Logging] Remove gpr logging header include from other headers

Some of the cc files are using gpr_log_verbosity_init() functions.

So I removed the #include <grpc/support/log.h> from all headers and put it selectively only in the cc files that used gpr_log_verbosity_init()

Closes #37513

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37513 from tanvi-jagtap:remove_gpr_headers_from_headers_01 612ca6d0f7bc76a382c2f4b84371ee60977eb1e9
PiperOrigin-RevId: 663811895
2024-08-16 12:18:04 -07:00
Tanvi Jagtap
3c928436b4 [Gpr_To_Absl_Logging] Remove logging header from example and test/cpp folder (#37488)
[Gpr_To_Absl_Logging] Remove logging header from example and test/cpp folder

Closes #37488

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37488 from tanvi-jagtap:remove_header_examples 1423ee77fff3136f3157993c07a5288552768e0d
PiperOrigin-RevId: 663597077
2024-08-15 22:13:08 -07:00
Craig Tiller
951a8e410d [huffman] Code generate geometries at build time (#37424)
Closes #37424

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37424 from ctiller:hesia 0d851ce70f80d782048199f6f7017be870fee8d7
PiperOrigin-RevId: 661291638
2024-08-09 17:16:56 +00:00
Craig Tiller
116bcb46ee [benchmarks] Exclude from cmake (#37391)
The microbenchmarks are tools for us, and it doesn't seem like we're buying much by maintaining them for different build systems.

Closes #37391

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37391 from ctiller:pickthis 24184f2b443fedbe16c213939107f5764d6d7ad6
PiperOrigin-RevId: 658861012
2024-08-02 12:00:49 -07:00
Yash Tibrewal
25dea6e8cc [StatsPlugin] Some more benchmarks and fixes (#37299)
```
-------------------------------------------------------------------------------------
Benchmark                                           Time             CPU   Iterations
-------------------------------------------------------------------------------------
BM_AddCounterWithFakeStatsPlugin                 36.9 ns         36.9 ns     18606645
BM_AddCounterWithLabelsWithFakeStatsPlugin        407 ns          407 ns      1712866
BM_AddCounterWithOTelPlugin                      46.6 ns         46.6 ns     15022711
BM_AddCounterWithLabelsWithOTelPlugin             142 ns          142 ns      4957733
BM_AddCounterWithNoPlugin                       0.313 ns        0.313 ns   1000000000
BM_AddCounterWithLabelsWithNoPlugin              1.96 ns         1.96 ns    356217818
```

Closes #37299

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37299 from yashykt:BMStatsPlugin b4ad53e22ba6924e6bdf8944b9110765b6b37266
PiperOrigin-RevId: 655361009
2024-07-23 17:33:03 -07:00
Yijie Ma
eb2ed3e4da [Performance] Benchmark AddCounter with FakeStatsPlugin and OTelPlugin (#37282)
Sample output:

```
➜  grpc git:(otel-metrics-benchmark) ✗ bazel-bin/test/cpp/microbenchmarks/bm_stats_plugin
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1721695619.615582 2126186 config.cc:257] gRPC experiments enabled: call_status_override_on_cancellation, call_tracer_in_transport, event_engine_dns, event_engine_listener, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache
2024-07-22T17:46:59-07:00
Running bazel-bin/test/cpp/microbenchmarks/bm_stats_plugin
Run on (48 X 2450 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x24)
  L1 Instruction 32 KiB (x24)
  L2 Unified 512 KiB (x24)
  L3 Unified 32768 KiB (x3)
Load Average: 1.16, 0.85, 0.85
***WARNING*** Library was built as DEBUG. Timings may be affected.
---------------------------------------------------------------------------
Benchmark                                 Time             CPU   Iterations
---------------------------------------------------------------------------
BM_AddCounterWithFakeStatsPlugin       1738 ns         1738 ns       404265
BM_AddCounterWithOTelPlugin             757 ns          757 ns       928142
I0000 00:00:1721695621.304593 2126186 test_config.cc:186] TestEnvironment ends
```

<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37282 from yijiem:otel-metrics-benchmark eeba3dfb5e2991e7093bfaa613ac89e9215043f5
PiperOrigin-RevId: 655286398
2024-07-23 13:40:22 -07:00
Esun Kim
a47d91c7b2 [Clean-up] Tidy fix (#37104)
Applied two clang 17 tidy fixes;

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

Closes #37104

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37104 from veblush:fix-tidy 7b905869b819ac3bd6c45feed665e1f98a0585ca
PiperOrigin-RevId: 650815403
2024-07-09 18:08:10 -07:00
Mark D. Roth
952d6276b4 [CallTracer] report transport byte counts directly to CallTracer
Instead of passing the transport byte counts back up through the filter
stack to be reported to the `CallTracer`, we now have the transport
pass the transport byte counts directly to the `CallTracer` itself.
This will eventually allow us to avoid unnecessarily storing these byte
counts in cases where no `CallTracer` actually cares about the data, which
will reduce per-call memory.  (In the short term, it actually increases
memory usage, but we can separately do some work to avoid the memory
usage in the transport by removing the `grpc_transport_stream_stats`
struct from the legacy filter API.)

This is a prereq for supporting `CallTracer` in the new call v3 stack,
which does not include the transport byte counts as part of the
receieve-trailing-metadata hook, unlike the legacy filter stack.

This change is controlled by the `call_tracer_in_transport` experiment,
which is enabled by default.

As part of this experiment, we also fix a couple of related bugs:
- On the client side, the chttp2 transport was incorrectly adding
  annotations to the parent `ClientCallTracer` instead of the
  `CallAttemptTracer`.
- The OpenCensus `ServerCallTracer` was incorrectly swapping the values
  of sent and received bytes.

PiperOrigin-RevId: 650728181
2024-07-09 12:55:33 -07:00
Craig Tiller
69006e0c30 [benchmarks] Enable callback microbenchmarks (#37077)
Since these were disabled they stopped working, and we really need to be tracking overheads here.

Closes #37077

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37077 from ctiller:it-must-work aa19a4aa89e8e706b60928abfd2501f5f4a99a07
PiperOrigin-RevId: 648469428
2024-07-01 13:34:08 -07:00
Mark D. Roth
fa84360551 Automated rollback of commit af492ae70a.
PiperOrigin-RevId: 646224695
2024-06-24 14:39:23 -07:00
Craig Tiller
83ee2cd631 [benchmark] Add an opinionated macro for gRPC benchmark targets (#37012)
As we've learned what configuration is needed for our benchmarks the settings have been growing more and more bespoke for each binary. Try to consolidate that into some useful defaults.

Also ensure we always `linkstatic=1`. `cc_binary` defaults to this, so it's reasonable to assume that's the performance our customers see. It also deeply impacts performance for small microbenchmarks, and so enabling it gives us more apples:apples, and saves chasing things that don't matter.

Closes #37012

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37012 from ctiller:benchmark-bin b84cab58c61c75fc286c2ed7c0b393f2048915b6
PiperOrigin-RevId: 645483183
2024-06-21 13:25:55 -07:00
Mark D. Roth
af492ae70a Automated rollback of commit f1ab1d8cf3.
PiperOrigin-RevId: 645167659
2024-06-20 15:05:51 -07:00
Mark D. Roth
f1ab1d8cf3 [handshaker API] update handshaker API to use modern types
Specifically:
- use `OrphanablePtr<>` for `grpc_endpoint`
- use `absl::AnyInvocable<>` instead of `grpc_closure`
- use `EventEngine::Run()` instead of `ExecCtx::Run()`
- use `SliceBuffer` instead of `grpc_slice_buffer`
- use `absl::Status` instead of `grpc_error_handle`
- use `absl::string_view` instead of `const char*` for handshaker names

Also pass acceptor via `HandshakerArgs` instead of as a separate parameter.

Also changed chttp2 and httpcli to use `OrphanablePtr<>` for the endpoint.

PiperOrigin-RevId: 644551906
2024-06-18 16:49:51 -07:00