Commit Graph

189 Commits

Author SHA1 Message Date
Yash Tibrewal 261aa6340a
[OTel] Generate pkg-config file for grpcpp_otel_plugin (#36686) (#36721)
Backport #36686 to v1.63.x

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.
2024-05-27 21:53:40 -07:00
Yash Tibrewal bb99d4a69a
[OTel] Add latency view to example (#36601) (#36719)
Backport #36601 to v1.63. 

Needed to backport #36686
2024-05-24 12:04:12 -07:00
Eugene Ostroukhov 33f56657d2 [Samples] Health checking example (#36235)
Closes #36235

PiperOrigin-RevId: 623204716
2024-04-09 10:14:18 -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
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
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
Esun Kim 32c5d1c160 [Example] Added gRPC C++ generic API example (#35411)
Closes #35411

PiperOrigin-RevId: 599930218
2024-01-19 14:03:17 -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
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
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
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
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
Eugene Ostroukhov ec2a7668e3
[examples] Add CPP multiplex example (#33187) 2023-05-19 14:42:48 -07:00
Yash Tibrewal 4f445219ef
[C++ Examples] Add an example for keepalive (#33191)
<!--

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-05-19 11:15:25 -07:00
Yash Tibrewal 57cd079310
[example] Clean up the interceptors example (#33169)
<!--

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-05-18 10:56:54 -07:00
Yash Tibrewal 6e1f46fda7
[examples] Clean-up xds example (#33166)
<!--

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-05-18 10:56:27 -07:00
AJ Heller cf6e5ed843
[example] Server reflection (#33162)
This is nearly identical to the helloworld example's greeter callback
server, but without the health check service enabled. Having a separate
example for reflection may help folks find this code.
2023-05-17 13:12:10 -07:00
Esun Kim 303e568f27
[Build] Removed gRPC_PROTOBUF_PACKAGE_TYPE, supporting config only (#32988)
`FindProtobuf` isn't working as Protobuf began to use Abseil so gRPC is
now using `CONFIG` mode for protobuf module
(Context: https://gitlab.kitware.com/cmake/cmake/-/issues/24321)
2023-05-04 13:55:42 -07:00
Ravi Prakash d8699afe20
[example] Eliminate warning when building helloworld. (#32884)
Without this change, new users get this warning:
```
CMake Warning (dev) at $MY_INSTALL_DIR/lib64/cmake/protobuf/protobuf-options.cmake:6 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'protobuf_MODULE_COMPATIBLE'.
Call Stack (most recent call first):
  $MY_INSTALL_DIR/lib64/cmake/protobuf/protobuf-config.cmake:2 (include)
  $MY_SRC_PATH/examples/cpp/cmake/common.cmake:99 (find_package)
  CMakeLists.txt:24 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.
```

release notes: no


<!--

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-05-02 13:01:07 -07:00
Jan Tattermusch 0f1afec5a8
[protobuf] Upgrade third_party/protobuf to 22.x (#32606)
The very non-trivial upgrade of third_party/protobuf to 22.x
This PR strives to be as small as possible and many changes that were
compatible with protobuf 21.x and didn't have to be merged atomically
with the upgrade were already merged.
Due to the complexity of the upgrade, this PR wasn't created
automatically by a tool, but manually. Subsequent upgraded of
third_party/protobuf with our OSS release script should work again once
this change is merged.

This is best reviewed commit-by-commit, I tried to group changes in
logical areas.

Notable changes:
- the upgrade of third_party/protobuf submodule, the bazel protobuf
dependency itself
- upgrade of UPB dependency to 22.x (in the past, we used to always
upgrade upb to "main", but upb now has release branch as well). UPB
needs to be upgraded atomically with protobuf since there's a de-facto
circular dependency (new protobuf depends on new upb, which depends on
new protobuf for codegen).
- some protobuf and upb bazel rules are now aliases, so `
extract_metadata_from_bazel_xml.py` and `gen_upb_api_from_bazel_xml.py`
had to be modified to be able to follow aliases and reach the actual
aliased targets.
- some protobuf public headers were renamed, so especially
`src/compiler` needed to be updated to use the new headers.
- protobuf and upb now both depend on utf8_range project, so since we
bundle upb with grpc in some languages, we now have to bundle utf8_range
as well (hence changes in build for python, PHP, objC, cmake etc).
- protoc now depends on absl and utf8_range (previously protobuf had
absl dependency, but not for the codegen part), so python's
make_grpcio_tools.py required partial rewrite to be able to handle those
dependencies in the grpcio_tools build.
- many updates and fixes required for C++ distribtests (currently they
all pass, but we'll probably need to follow up, make protobuf's and
grpc's handling of dependencies more aligned and revisit the
distribtests)
- bunch of other changes mostly due to overhaul of protobuf's and upb's
internal build layout.

TODOs:
- [DONE] make sure IWYU and clang_tidy_code pass
- create a list of followups (e.g. work to reenable the few tests I had
to disable and to remove workaround I had to use)
- [DONE in cl/523706129] figure out problem(s) with internal import

---------

Co-authored-by: Craig Tiller <ctiller@google.com>
2023-04-12 18:43:58 +02:00
Yash Tibrewal bdd1ac4d1d
[GcpObservability C++] De-experimentalize API (#32715)
This PR aims to de-experimentalize the APIs for GCP Observability. 

We would have ideally wanted public feedback before declaring the APIs
stable, but we need stable APIs for GA.

Changes made after API review with @markdroth @veblush, @ctiller and the
entire Core/C++ team -
* The old experimental APIs `grpc::experimental::GcpObservabilityInit`
and `grpc::experimental::GcpObservabilityClose` are now deprecated and
will be deleted after v.1.55 release.
* The new API gets rid of the Close method and follows the RAII idiom
with a single `grpc::GcpObservability::Init()` call that returns an
`GcpObservability` object, the lifetime of which controls when
observability data is flushed.
* The `GcpObservability` class could in the future add more methods. For
example, a debug method that shows the current configuration.
* Document that GcpObservability initialization and flushing (on
`GcpObservability` destruction) are blocking calls.
* Document that gRPC is still usable if GcpObservability initialization
failed. (Added a test to prove the same).
* Since we don't have a good way to flush stats and tracing with
OpenCensus, the examples required users to sleep for 25 seconds. This
sleep is now part of `GcpObservability` destruction.

Additional Implementation details -
* `GcpObservability::Init` is now marked with `GRPC_MUST_USE_RESULT` to
make sure that the results are used. We ideally want users to store it,
but this is better than nothing.
* Added a note on GCP Observability lifetime guarantees.

<!--

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-04-05 21:45:21 +00:00
Yash Tibrewal f4280fb262
GCP Observability: Fix instructions for README (#32730)
<!--

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-03-27 21:33:28 -07:00
Yash Tibrewal 1293ee8286
Gcp Observability: Add example (#32710)
Adds a simple hello-world example for GCP Observability purposes along
with a README.
The microservices observability user guide is not yet up, but this still
refers to it anyway.

<!--

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-03-27 12:59:45 -07:00
Jan Tattermusch 3fde13929b
Switch to protobuf's /CMakeLists.txt instead of /cmake/CMakeLists.txt (#32678)
Try to react to https://github.com/protocolbuffers/protobuf/issues/12263
and https://github.com/protocolbuffers/protobuf/pull/12295

Protobuf's /cmake/CMakeLists.txt is now deprecated if favor of
/CMakeLists.txt


58ecf38aa5/cmake/CMakeLists.txt (L3)

In this PR:
- Adjust `cmake/protobuf.cmake` to use the right CMakeLists.txt
- adjust the C++ distribtests accordingly
2023-03-22 09:14:04 -07:00
Eugene Ostroukhov d43e35738a
Examples: unify command line flags (#32456)
1. All greeter servers now support flag `--port` to customize the listen
port.
2. All client implementation now have `--target` flag to specify the
server location.
3. ABSL is used to parse the flags to reduce the amount of boilerplate
code in the examples.

Fixes: #26989
2023-02-27 10:39:21 -08:00
Esun Kim b64d623f24
CMake's better handling c++14 requirement (#31916)
* Bumped the cmake version version to 3.8

* Switch to target_compile_features for cxx_std_14

* Regen
2023-01-27 09:51:31 -08:00
Ilya Lukin 06faf44d0b
Fix missed override specifier (#31489) 2023-01-06 18:07:04 -08:00
Andres Beltran 2904ee8fd3
Add support for systemd socket activation (#31667)
* Revert "Revert "Add support for systemd socket activation (#30485)" (#31617)"

This reverts commit 867dc6cae2.

* Add checks to unix tests

* Ran generate_projects.sh and fixed styling in test

* Fix variable in unit test

* Use reinterpret_cast in test

* Rebase and fix sanity failures
2023-01-05 14:53:33 -08:00
Esun Kim 5fb4c2364d
Clean-up pkgconfig (#31660)
* Clean-up pkgconfig

* Removed run_distrib_test_cmake_module_install_pkgconfig.sh

* Proper re2

* Clean up pkgconfig.sh test script
2022-11-22 10:51:17 -08:00
Craig Tiller 867dc6cae2
Revert "Add support for systemd socket activation (#30485)" (#31617)
This reverts commit a638c407bb.
2022-11-10 16:24:30 -08:00
Andres Beltran a638c407bb
Add support for systemd socket activation (#30485)
* Add socket-activated functionality

* Fix GRPC_ERROR_NONE in tcp_server_posix_test and sanity checks

* Fix epoll1 error, sanity checks

* Use AF_INET6 in tcp_server_posix_test

Co-authored-by: Vignesh Babu <vigneshbabu@google.com>
2022-11-10 11:05:14 -08:00
Mark D. Roth 447a058837
xDS: remove deprecated C++ APIs in the experimental namespace (#31451) 2022-10-26 14:53:57 -07:00
h-vetinari a562807108
patch cpp example to use passed CMAKE_CXX_STANDARD (#30835) 2022-09-13 12:36:34 -07:00
AJ Heller 24bc7c455f
Match the greeter async example to the tutorial (#30731)
The "Prepare" bit is unnecessary for the basic async example. It's used
more meaningfully in the v2 async greeter implementations.
2022-08-24 11:45:32 -07:00
Esun Kim 03e9ac6f1f
Requiring C++14 (#29589) 2022-05-12 21:17:32 -07:00
Nicolas Noble eb2ae7a0cc
Fixing RouteGuide's C++ Reactor example. (#29404)
* Fixing RouteGuide's C++ Reactor example.

The current method involves locking and unlocking a mutex from different
threads, which isn't allowed. Changing the strategy a bit to address
this.

* Automated change: Fix sanity tests

* Switching to absl::Mutex to annotate usage properly.

* Actually, let's not cover the examples with sanity checks.
2022-04-21 10:03:28 -07:00
Yash Tibrewal 7fb4998029
RouteGuide example: Abort if database file not found (#29398) 2022-04-14 15:13:33 -07:00
AJ Heller 1f03bbab39
Small cleanup (#29125)
The std::moves of temporaries prevented copy elision, and the functions
were unused (one with a TODO to re-enable later)
2022-03-16 18:26:41 -07:00
Esun Kim 192928c997
Use gRPC_BUILD_MSVC_MP_COUNT for windows cmake distrib tests (#28202) 2021-11-29 11:22:07 -08:00
AJ Heller c5f1d29b76
Add feature examples with continuous integration (#27917)
* Add failing end2end test for inconsistent percent-decoding of URIs

* Add passing h2_local_abstract_uds end2end tests

* Add basic abstract UDS example

* add test runner

* add proper bazel build path

* first attempt at CI configuration

* cleanup

* rename CI files for better readability
2021-11-11 14:00:10 -08:00
Craig Tiller d1e01ac139
Add a test for a (now-illegal) build file construct (#27602)
* Add a test for a (now-illegal) build file construct

* add to test suite!

* fix

* fix

* fix syntax
2021-10-06 07:43:59 -07:00