Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Heitor Tashiro Sergent <heitortsergent@gmail.com>
  • Loading branch information
olegbespalov and heitortsergent committed Jan 22, 2024
1 parent 932b5b9 commit f2be224
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ weight: 02

The `k6/experimental/grpc` module is an extension of the [`k6/net/grpc`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc). It provides a [gRPC](https://grpc.io/) client for Remote Procedure Calls (RPC) over HTTP/2.

Prior k6 `v0.49` the key-difference between the two modules was streaming support, but it has been added to the `k6/net/grpc` module as well. We recommend using the `k6/net/grpc` module.
Starting on k6 v0.49, the `k6/net/grpc` module provides streaming support. We recommend using the `k6/net/grpc` module instead of `k6/experimental/grpc`.

| Class/Method | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
6 changes: 3 additions & 3 deletions docs/sources/next/javascript-api/k6-net-grpc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ weight: 11

# k6/net/grpc

The `k6/net/grpc` module provides a [gRPC](https://grpc.io/) client for Remote Procedure Calls (RPC) over HTTP/2. It supports unary and streaming (starting [v0.49](https://github.com/grafana/k6/releases/tag/v0.49.0)) RPCs.
The `k6/net/grpc` module provides a [gRPC](https://grpc.io/) client for Remote Procedure Calls (RPC) over HTTP/2. It supports unary and streaming (starting on [v0.49](https://github.com/grafana/k6/releases/tag/v0.49.0)) RPCs.

| Class/Method | Description |
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -19,9 +19,9 @@ The `k6/net/grpc` module provides a [gRPC](https://grpc.io/) client for Remote P
| [Response](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/response) | Returned by RPC requests. |
| [Constants](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/constants) | Define constants to distinguish between [gRPC Response](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/response) statuses. |
| [Stream](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream) | Creates a new GRPC stream. |
| [Stream.on(event, handler)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-on) | Adds a new listener to one of the possible stream event's. |
| [Stream.on(event, handler)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-on) | Adds a new listener to one of the possible stream events. |
| [Stream.write(message)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-write) | Writes a message to the stream. |
| [Stream.end()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-end) | Signals to server that client finished sending. |
| [Stream.end()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-end) | Signals to the server that the client has finished sending. |

## gRPC metrics

Expand Down
8 changes: 4 additions & 4 deletions docs/sources/next/javascript-api/k6-net-grpc/stream/_index.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
title: Stream
excerpt: 'GRPC Streams'
description: gRPC Streams
weight: 30
---

# Stream

Using a GRPC client creates a stream. An important note that the client should be already connected (client.connect called) to the server before creating a stream.
Using a gRPC client creates a stream. The client should be connected to the server (`client.connect` called) before creating a stream.

| Method | Description |
| ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [Stream(client, url, [,params])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream) | Using a GRPC client creates a stream. |
Using a gRPC client creates a stream.
| [Stream.write(message)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-write) | Writes a message to the stream. |
| [Stream.on(event, handler)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-on) | Set up handler functions for various events on the GRPC stream. |
| [Stream.on(event, handler)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-on) | Sets up handler functions for various events on the gRPC stream. |
| [Stream.end()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/stream/stream-end) | Signals to the server that the client has finished sending. |

### Examples
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Stream.end()'
excerpt: 'Signals to the server that the client has finished sending.'
description: 'Signals to the server that the client has finished sending.'
weight: 40
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'Error'
head_title: 'gRPC.Error'
excerpt: 'The error object of a gRPC stream.'
description: 'The error object of a gRPC stream.'
weight: 15
---

Expand All @@ -12,5 +12,5 @@ The error object is the object that is passed to the `error` event handler funct
| Name | Type | Description |
| --------------- | ------ | ------------------------------------- |
| `Error.code` | number | A gRPC error code. |
| `Error.details` | array | A list details attached to the error. |
| `Error.details` | array | A list of details attached to the error. |
| `Error.message` | string | An original error message. |
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: 'Stream.on()'
excerpt: 'Set up handler functions for various events on the GRPC stream.'
description: 'Set up handler functions for various events on the GRPC stream.'
weight: 10
---

# Stream.on()

Set up handler functions for various events on the GRPC stream.
Set up handler functions for various events on the gRPC stream.

| Parameter | Type | Description |
| --------- | -------- | -------------------------------------------- |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Stream.write()'
excerpt: 'Writes a message to the stream.'
description: 'Writes a message to the stream.'
weight: 40
---

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/next/shared/experimental-grpc-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Experimental grpc module admonition

{{% admonition type="caution" %}}

Staring `k6` version `v0.49` the experimental module `k6/experimental/grpc` has been graduated, and its functionality is available in [the `k6/net/grpc` module](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/). The `k6/experimental/grpc` is deprecated and will be removed in `v0.51.0`.
Starting on k6 `v0.49`, the experimental module `k6/experimental/grpc` has been graduated, and its functionality is now available in the [`k6/net/grpc` module](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/). The `k6/experimental/grpc` is deprecated and will be removed in `v0.51.0`.

To migrate your scripts, replace all `k6/experimental/grpc` imports with `k6/net/grpc`.

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/next/using-k6/metrics/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ k6 emits the following metrics when it interacts with a service through the [`gR

{{% admonition type="note" %}}

Steams-related metrics (`grpc_streams*`) are available only on `k6` version `0.49.0` or higher or when using the `k6/experimental/grpc` module which is available on `k6` version `0.45.0`.
Steams-related metrics (`grpc_streams*`) are available only on `k6` version `0.49.0` or higher or when using the `k6/experimental/grpc` module, which is available on `k6` version `0.45.0`.

{{% /admonition %}}

0 comments on commit f2be224

Please sign in to comment.