You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of course, you can use docker in production or install etcd using your favorite package manager.
29
26
Just remember that the example above is for testing purposes!
30
27
31
-
## Usage examples
28
+
## How does it work?
29
+
30
+
All you need to do is give your server a name. When it starts, it will automatically select a free port and run on it (unless you specify otherwise).
31
+
All clients will connect to this server by its name. If there are multiple servers with the same name, load balancing will be performed between them.
32
+
33
+
> In the following code examples, error handling will be removed to improve readability. A pre-built [proto](examples/quickstart/proto) will also be used.
Now let's create a new server named `myServerName`, give it the implementation of our `Sum` service and run it on the localhost (`sumServer` implementation will be omitted):
And finally, we create a client that connects to our `myServerName` (`sumClient` usage will be omitted):
54
+
55
+
```go
56
+
client, err := rpcp.NewClient("myServerName")
57
+
sumClient := proto.NewSumClient(client.Client())
58
+
````
59
+
60
+
This is already enough for everything to work, we can add or remove copies of our server and add new clients — everything will work!
61
+
But to see our **service graph** and get **telemetry for all gRPC methods**, we need to run containers with telemetry services and enable telemetry in `rpcplatform`.
62
+
63
+
Let's run containers with Zipkin and Jaeger:
64
+
65
+
```shell
66
+
docker run -d --name zipkin -p 9411:9411 openzipkin/zipkin
67
+
docker run -d --name jaeger -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one
68
+
```
69
+
70
+
Now let's create the necessary collectors and add `OpenTelemetry` option to the `rpcplatform` instance:
This example is very similar to [QuickStart](../quickstart), but now we will use additional attributes for the server and will receive them on every update in the channel.
25
4
26
5
## Launching this demo
27
6
@@ -42,8 +21,4 @@ go run .
42
21
43
22
## Additional comments
44
23
45
-
Currently there are two servers and one client running. If you launch another server, then one of the three servers will become a backup server, and the client will continue to interact with only two servers.
46
-
47
-
If we want active servers to be selected using priority, we can use the `BalancerPriority` option for server attributes.
48
-
49
-
Each server receives requests based on its weight, so by changing the value of `BalancerWeight` attribute we will distribute load the way we need.
24
+
Currently there are two servers and one client running. If you launch another server, then one of the three servers will become a backup server, and the client will continue to interact with only two servers. If we want active servers to be selected using priority, we can use the `BalancerPriority` option for server attributes. Each server receives requests based on its weight, so by changing the value of `BalancerWeight` attribute we will distribute load the way we need.
0 commit comments