Commit Graph

1026 Commits

Author SHA1 Message Date
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
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
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
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
Yash Tibrewal cb6eaeb4f0 [CSM O11y] Follow-up from #36806 (#36823)
Closes #36823

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36823 from yashykt:CsmObsEgFollowup b5d0dcd455
PiperOrigin-RevId: 640632444
2024-06-05 13:36:16 -07:00
Yash Tibrewal d110960d56 [CSM O11y] Add example without Stateful Session Affinity (#36806)
Fork the existing CSM example and just keep the observability parts.

Closes #36806

PiperOrigin-RevId: 640580476
2024-06-05 11:01:42 -07:00
Yash Tibrewal ac303a09f6 [OTel] Generate pkg-config file for grpcpp_otel_plugin (#36686)
Public Changes -
* Add a pkgconfig installer for `grpcpp_otel_plugin`

Example Changes -
* Add example of how to use the pkgconfig for `grpcpp_otel_plugin` with the existing OpenTelemetry example.
* Add another OpenTelemetry example that uses OTel's OStream exporter. This makes it easier to test the pkgconfig file for `grpcpp_otel_plugin` since the OStream exporter does not require any additional dependencies, as opposed to the Prometheus exporter.

Test changes -
* Modify `run_distrib_test_cmake_pkgconfig.sh` test to install opentelemetry and build the example with the OStream exporter.

Closes #36686

PiperOrigin-RevId: 636965475
2024-05-24 10:41:11 -07:00
Yash Tibrewal 2fb9e99f47 [OTel] Add latency view to example (#36601)
Closes #36601

PiperOrigin-RevId: 633373861
2024-05-13 16:59:48 -07:00
Xuan Wang 811bb258d8 [Python Otel] Use registered method at server side (#36371)
Add registered method change to sync stack server.

## Note
* We're keeping both generic and registered handler in generated stubs (`*_pb2_grpc.py`) because registered method flow is not implemented in aysncio yet, since the stub is used for both sync and asyncio, we can't remove generic method flow until we fully implement the registered method flow in asyncio.

<!--

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

PiperOrigin-RevId: 629842051
2024-05-01 14:43:15 -07:00
Xuan Wang 79e42f9837 [Python Otel] Remove opentelemetry version pin (#36448)
<!--

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

PiperOrigin-RevId: 629113962
2024-04-29 10:40:27 -07:00
Yijie Ma c3a077e184 [examples/cpp] Fix missing parentheses (#36382)
Fix https://github.com/grpc/grpc/issues/36367.

<!--

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36382 from yijiem:fix-example-cmake 54521e87a1
PiperOrigin-RevId: 625469934
2024-04-17 01:22:51 +00:00
Tanvi Jagtap 38fd697579 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36359)
<!--

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

PiperOrigin-RevId: 625183028
2024-04-15 20:56:16 -07:00
Tanvi Jagtap fc09bb43b7 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36327)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging

go/gpr_to_absl_logs

Replacing GPR_ASSERT with absl CHECK

GPR_ASSERT http://google3/third_party/grpc/include/grpc/support/log.h?q=symbol%3A%5CbGPR_ASSERT%5Cb%20case%3Ayes

CHECK http://google3/third_party/absl/log/check.h?q=symbol%3A%5CbCHECK%5Cb%20case%3Ayes

<!--

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

PiperOrigin-RevId: 623851813
2024-04-11 09:44:44 -07:00
Eugene Ostroukhov 33f56657d2 [Samples] Health checking example (#36235)
Closes #36235

PiperOrigin-RevId: 623204716
2024-04-09 10:14:18 -07:00
Ming-Chuan d6bb391449 [Build] Migrate Android NDK, android rules and platforms (#36116)
This commit does the following 3 things for Android bazel rules, which depends on each other

1. Update NDK to 26.2.11394342 (and a few other Android things)
2. Use rules_android_ndk instead of builtin `native.android_ndk_repository`
    * `third_party/android/android_configure.bzl` was a workaround for users who don't set `$ANDROID_NDK_HOME` env var. Now with rules_android_ndk, we can declare repo without registering the toolchain. Instead users who need NDK toolchain should use `--extra_toolchains` to manually register the toolchain, as shown in README.md.
3. Migrate to platforms. See https://bazel.build/concepts/platforms
    * Currently we declares android platforms that is needed for binder transport APK. Later gRPC repo can gradually migrate to platforms for other platforms.
    * The value of `crosstool_top` will still be `//external:android/crosstool` (which is the default value), so existings android `config_settings` will still work. We should migrate them to match with `@platforms//os:android` constraint later.

The platforms migration needs Bazel 7.0 to work so we also override bazel version in testing scripts.

Closes #36116

PiperOrigin-RevId: 617244655
2024-03-19 11:46:15 -07:00
Xuan Wang 24be69b9bd [Python O11y] Change public interface (#36094)
Address comments from design review meeting, mainly:
* Use `OpenTelemetryPlugin` as public API.
* Use keyword args to build plugin.
<!--

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

PiperOrigin-RevId: 615807264
2024-03-14 09:37:19 -07:00
Xuan Wang c910004328 [Python Stub] Add version check to stubs generated by grpcio_tools (#35906)
The stubs generated by grpcio_tools should always be used with [the same or higher version of grpcio](https://github.com/grpc/grpc/blob/master/tools/distrib/python/grpcio_tools/setup.py#L313), this change will add a run time check for this requirement inside the generated stubs and therefor enforce this requirement.

Please note for now we're just printing a warning for incorrect usage, we'll **change it to an error** soon.

Example warning message:
```
/usr/local/google/home/xuanwn/workspace/misc/grpc/examples/python/helloworld/helloworld_pb2_grpc.py:21: RuntimeWarning: The grpc package installed is at version 1.60.1, but the generated code in helloworld_pb2_grpc.py depends on grpcio>=1.63.0.dev0. Please upgrade your grpc module to grpcio>=1.63.0.dev0 or downgrade your generated code using grpcio-tools<=1.60.1. This warning will become an error in 1.64.0, scheduled for release on May 14,2024.
```
<!--

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

PiperOrigin-RevId: 615659471
2024-03-13 22:47:01 -07:00
nipil ed8af1fb82 [examples] fix binary path in systemd socket activation test script (#36034)
Fix failing copy operations due to incorrect path levels

Closes #36034

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

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

Closes #36063

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36063 from yashykt:OTelCMakeSupport 3bc783823b
PiperOrigin-RevId: 613734473
2024-03-07 16:12:10 -08:00
Xuan Wang 672d8abdca [Python Otel] Allow start observability without context manager (#35932)
Allow start observability globally with a new API `start_open_telemetry_observability`.

<!--

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

PiperOrigin-RevId: 612639020
2024-03-04 17:08:15 -08:00
Stanley Cheung 18af795edf Update min PHP testing version from PHP 7.4 to 8.1 (#35964)
- PHP 7.4 and 8.0 have been EOL https://www.php.net/supported-versions.php
- See go/drop-php-8.0 for more details

Most of the changes came from `generate_projects.sh` after updating the `tools/buildgen/plugins/expand_version.py` file. The change to `tools/internal_ci/helper_scripts/prepare_build_macos_rc` is manual.

Closes #35964

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35964 from stanley-cheung:php-update-to-8_1 0c24c4eac2
PiperOrigin-RevId: 609495798
2024-02-22 14:32:42 -08:00
Xuan Wang 2c9b599e5e [Python O11Y] Reapply registered method change (#35850)
This reverts commit a18279db2e.

<!--

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

PiperOrigin-RevId: 607476066
2024-02-15 15:36:27 -08:00
Yash Tibrewal 2999332d64 [CSM] De-experimentalize CsmObservability API (#35836)
Closes #35836

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35836 from yashykt:DeexperimentalizeCsmObs 1711e6d9b0
PiperOrigin-RevId: 605650394
2024-02-09 09:28:18 -08:00
Xuan Wang 9aa3c5835a [Python O11y] Remove exporter from public API and refactor tests (#35792)
<!--

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

PiperOrigin-RevId: 604695910
2024-02-06 10:48:40 -08:00
Yash Tibrewal 3ebccf55cd [otel] Add gRPC OpenTelemetry example (#35793)
Closes #35793

PiperOrigin-RevId: 604371764
2024-02-05 11:05:44 -08:00
Eugene Ostroukhov 97e889d568 [examples] Update SSA client example (#35799)
1. Update cookies after all successful RPCs. Ensures that client adapts to changes in cluster configuration.
2. Reorganized client code to extract more snippets that could be copy-pasted.
3. Docker build now uses the same bazel build as outside code.

Closes #35799

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35799 from eugeneo:tasks/ssa-example-bug 801205a532
PiperOrigin-RevId: 603805785
2024-02-02 15:42:19 -08:00
Xuan Wang 80f3a90556
[Python O11Y] Add observability example (#35637)
<!--

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-01-25 10:04:06 -08:00
Esun Kim 32c5d1c160 [Example] Added gRPC C++ generic API example (#35411)
Closes #35411

PiperOrigin-RevId: 599930218
2024-01-19 14:03:17 -08:00
Esun Kim 5c0f349761 [Build] Bump the required CMake version to 3.13 (#35572)
We've been trying to upgrade Cmake to 3.13 or later as OSS policy bumped it. But we couldn't as Android has a weird linker error with Cmake 3.18 (you can see the error from https://github.com/grpc/grpc/pull/34331) This PR instead upgrades it to use 3.22 for Android test.

Closes #35572

PiperOrigin-RevId: 599317285
2024-01-17 16:08:53 -08:00
Xuan Wang a18279db2e [Python O11Y] Revert registered method change (#35522)
We're having some issues internally, rolling this change back for now and wait for the affected users to figure out a solution.

This reverts: https://github.com/grpc/grpc/pull/35002, https://github.com/grpc/grpc/pull/35482 and 6872a7a473

<!--

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

PiperOrigin-RevId: 597671989
2024-01-11 15:40:10 -08:00
Xuan Wang cd68c5e783
[Python Example] Add token based authentication example (#35477)
Add token based authentication example

<!--

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-01-10 11:06:46 -08:00
Xuan Wang 9a7c0b5f57 [Python Observability] Allow create call with registered method (#35002)
Based on [OpenTelemetry Metrics gRFC](https://github.com/grpc/proposal/blob/master/A66-otel-stats.md#opentelemetry-metrics), we should recored unregistered RPC method name as `other`, this PR adds the ability to pass register method information when creating a call.

We'll consider calls created using generated stubs as registered, note that this won't prevent user from setting `registered_method=True` when creating calls manually.

This is also enabled for simple stub flow but **NOT enabled for AsyncIO**, we'll add that later when start working on AsyncIO Observability.
<!--

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

PiperOrigin-RevId: 596719121
2024-01-08 15:30:17 -08:00
Tanvi Jagtap f3aa7dc2f2
[grpc] Move contents of objective_c to objective-c (#35361)
Due to an internal issue, some code from objective-c folder was copied
into objective_c .
Trying to undo that.

<!--

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

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

-->
2023-12-21 09:19:55 -08:00
Yash Tibrewal a1335d1b16 [examples] Fix csm greeter client (#35355)
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35355 from yashykt:CsmExampleFix e394990389
PiperOrigin-RevId: 592413377
2023-12-19 20:06:07 -08:00
Esun Kim f0dcac330f [Example] Added the deadline example (#35217)
Added the deadline example

Closes #35217

PiperOrigin-RevId: 591074224
2023-12-14 15:51:11 -08:00
Tanvi Jagtap 0353e5b9c4 Internal configuration
PiperOrigin-RevId: 590178979
2023-12-12 06:18:27 -08:00
Yash Tibrewal c2261c6f28
[example] Add WAIT_FOR_READY example (#35219) 2023-12-08 14:34:26 -08:00
Eugene Ostroukhov d9e4d1302e
[examples] Implement custom metrics reporting from server (#35218) 2023-12-08 14:33:59 -08:00
AJ Heller 8c378461c3
[example] C++ Debugging (#35222) 2023-12-06 11:21:11 -08:00
Xuan Wang 49d48c94ab
[Python Example] Fix compression example (#34745)
Fix: https://github.com/grpc/grpc/issues/34690

Also added generated proto files to example folder so we can run example
directly.
<!--

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

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

-->
2023-10-20 09:10:14 -07:00
Richard Belleville 49e6aa68bb
[CSM] Add CSM Example client and server images (#34447)
Joint effort with @yashykt and @sanjaypujare

---------

Co-authored-by: Yash Tibrewal <yashkt@google.com>
Co-authored-by: Sanjay Pujare <sanjaypujare@users.noreply.github.com>
2023-09-24 12:07:17 -07:00
Esun Kim d72ce236d8
[Example] Added gRPC C++ cancellation example (#34239) 2023-09-06 09:07:33 -07:00
Xuan Wang cedef1b7f3
[Python example] Add example for TLS (#34116)
Add example for TLS.

<!--

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

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

-->
2023-08-22 13:02:40 -07:00
Yash Tibrewal 874641499b
[GCP Observability] Add missing link (#34026)
<!--

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

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

-->
2023-08-10 13:18:31 -07:00
Michael Lumish 1bf3f56c97
[examples] Replace Node example files with references to the new location (#33522)
This change is part of a migration of the Node examples from this
repository to the grpc/grpc-node repository, along with
grpc/grpc-node#2474. I replaced the files with references to the new
location instead of deleting them so that people following links in
existing external resources would find information about the new
location instead of an unhelpful 404 error. I discovered that even some
of the individual `.js` files are linked from other places, so to be
safe I performed this replacement on every file in the directory.
2023-06-22 17:48:33 -07:00
Sergii Tkachenko de6ed9ba9f
[Python] Migrate from yapf to black (#33138)
- Switched  from yapf to black
- Reconfigure isort for black
- Resolve black/pylint idiosyncrasies 

Note: I used `--experimental-string-processing` because black was
producing "implicit string concatenation", similar to what described
here: https://github.com/psf/black/issues/1837. While currently this
feature is experimental, it will be enabled by default:
https://github.com/psf/black/issues/2188. After running black with the
new string processing so that the generated code merges these `"hello" "
world"` strings concatenations, then I removed
`--experimental-string-processing` for stability, and regenerated the
code again.

To the reviewer: don't even try to open "Files Changed" tab 😄 It's
better to review commit-by-commit, and ignore `run black and isort`.
2023-06-09 15:08:55 -07:00
AJ Heller dbcb09d3d4
[Example] Move systemd socket activation example (#33221) 2023-05-23 13:18:06 -07:00
AJ Heller d58af7397f
[example] Move unix abstract domain sockets example (#33220)
A different scheme was decided upon for adding feature examples. This
moves the old UDS example and deletes the CI job.
2023-05-23 12:53:51 -07:00
Esun Kim f3574e3f64
[Example] Adding error_handling & error_details example (#33129)
Adding a new example showing how to propagate error status from the
server to the client with optional detail information.
2023-05-20 19:47:16 -07:00
Hannah Shi 988c85535d
[ObjC] Upgrade podspec xx.deployment_target (#33091)
Upgrade apple platform deployment_target versions to fix the cocoapods
push of BoringSSL-GRPC about the following error:
```
ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
ref: https://developer.apple.com/forums/thread/725300

This also aligns with the versions required by
[protobuf](https://github.com/protocolbuffers/protobuf/pull/10652)

```
ios.deployment_target = '10.0'
osx.deployment_target = '10.12'
tvos.deployment_target = '12.0'
watchos.deployment_target = '6.0'
```
2023-05-20 20:38:24 +00:00