Skip to content

Commit d79ccf3

Browse files
committed
Update READMEs
GitOrigin-RevId: c83b97b2681a975e0565d830aa8ffe81edf1b258
1 parent 897a5ca commit d79ccf3

File tree

4 files changed

+176
-55
lines changed

4 files changed

+176
-55
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ application itself, so that sensitive data is stripped before ever reaching the
1616

1717
- **Explore**: Enter a query to let the targeted (production) system start capturing HTTP requests immediately.
1818
- **(Stored) Queries**: Store queries so that you can run them in the background.
19-
- **Extended Tracing**: Trace the results with their bodies, so you can see what happens in your [entire stack](screenshot_3.png).
19+
- **Extended Tracing**: Trace the results with their bodies, so you can see what happens in
20+
your [entire stack](screenshot_3.png).
2021
- **Sessions**: Allow non-technical users to start multiple queries at the same time.
21-
- **Full-Stack Recording**: Record the frontend [like a video](screenshot_2.png) while capturing the related backend requests.
22+
- **Full-Stack Recording**: Record the frontend [like a video](screenshot_2.png) while capturing the related backend
23+
requests.
2224
- **Masking**: Easily mask confidential information, so you can query with peace of mind.
23-
25+
2426
## Get Started
2527

2628
- You can follow the Installation Guide [here](docs/installation.md).
@@ -30,11 +32,12 @@ application itself, so that sensitive data is stripped before ever reaching the
3032

3133
WireQuery's SDKs are offered in the following variants:
3234

33-
| Technology | Description |
34-
|-----------------------------|-------------------------------------------------------------------|
35-
| [JVM](/sdk/jvm) | Library for vanilla Java, Spring Boot 2 and 3 |
36-
| [JS (Browser)](/sdk/js) | Integration with Javascript in the Browser for frontend recording |
37-
| [Universal](/sdk/universal) | Universal SDK for every other programming language | |
35+
| Technology | Description | Notes | Resources |
36+
|-----------------------------|-------------------------------------------------------------------|--------------------------------------------------------------|------------------------------------------------------|
37+
| [JVM](/sdk/jvm) | Library for vanilla Java, Spring Boot 2 and 3 | | [Docs](https://www.wirequery.io/docs/sdks/jvm) |
38+
| [JS (Browser)](/sdk/js) | Integration with Javascript in the Browser for frontend recording | Not a library, but integration guide and examples | [Docs](https://www.wirequery.io/docs/sdks/js) |
39+
| [Go](/sdk/go) | Library for Go. | Highly experimental and masking not built-in yet | [Docs](https://www.wirequery.io/docsdks/js) |
40+
| [Universal](/sdk/universal) | Universal SDK for every other programming language. | Highly experimental and masking should be done by the client | [Docs](https://www.wirequery.io/docs/sdks/universal) |
3841

3942
More SDKs will be added over time.
4043

sdk/js/README.md

Lines changed: 81 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,90 @@
1-
Currently, there is no SDK available for the frontend. Nevertheless, it
2-
is still easy to start a new screen capture
1+
# JavaScript (Browser)
32

4-
# Frontend Integration
3+
Whenever you want to start a Session from the frontend, you need to have a Template with
4+
"Allow User Initiation" checked. Read more in the [Templates](https://wirequery.io/docs/features/templates) Feature Chapter.
55

6-
In order to start a frontend recording, you need to install
7-
`rrweb` and `rrweb-snapshot`.
6+
When you want the user to be able to record a session, you basically want to call WireQuery twice:
7+
8+
- Start the recording (and, more specifically, all queries in the template)
9+
- Stop the recording
10+
11+
In order to be able to start a frontend recording, you need to install `rrweb` and `rrweb-snapshot`.
12+
13+
Currently, there is no SDK available for the frontend. Nevertheless, it is very easy to integrate the frontend
14+
with WireQuery using a few simple `fetch` commands and using `rrweb`.
15+
16+
## Start Recording
17+
18+
A recording can be started by calling the `recordings` endpoint from WireQuery.
19+
```
20+
const res = await fetch("<WireQuery Host>/api/v1/recordings", {
21+
method: "POST",
22+
headers: {
23+
"Content-Type": "application/json",
24+
},
25+
body: JSON.stringify({
26+
templateId: <templateId>,
27+
args: {
28+
<template args>
29+
},
30+
}),
31+
})
32+
33+
const recording = await res.json()
34+
35+
```
36+
Here, the `<templateId>` has to be set to the Template id mentioned earlier. The args need to container
37+
the parameters of that template, such as the `accountId`. For example:
838

9-
A recording can be started by:
1039
```
11-
fetch("https://demo.wirequery.io/api/v1/recordings", {
12-
method: "POST",
13-
headers: {
14-
"Content-Type": "application/json",
15-
},
16-
body: JSON.stringify({
17-
templateId: ...templateId...,
18-
args: {
19-
...template args...
20-
},
21-
lookbackSecs: 0,
22-
timeoutSecs: 30,
23-
}),
24-
})
40+
const res = fetch("https://demo.wirequery.io/api/v1/recordings", {
41+
method: "POST",
42+
headers: {
43+
"Content-Type": "application/json",
44+
},
45+
body: JSON.stringify({
46+
templateId: 1,
47+
args: {
48+
accountId
49+
},
50+
}),
51+
})
52+
53+
const recording = await res.json()
2554
```
55+
56+
## Recording
57+
58+
The actual recording needs to be taken care by `rrweb`. A guide on `rrweb` can be found on
59+
[GitHub](https://github.com/rrweb-io/rrweb/blob/master/guide.md), and an example can be found
60+
in the [Transactions](https://github.com/wirequery/wirequery/tree/main/sdk/js/examples/transactions) example.
61+
62+
## Finish Recording
63+
64+
Similarly, when a recording is finished, a call to WireQuery needs to be made as well to send and finalize the recording.
65+
2666
When the recording is finished, the following call needs to be made:
2767
```
28-
fetch(`https://demo.wirequery.io/api/v1/recordings/${recording.id}/finish`, {
29-
method: "POST",
30-
headers: {
31-
"Content-Type": "application/json",
32-
},
33-
body: JSON.stringify({
34-
secret: recording.secret,
35-
recording: JSON.stringify(events),
36-
context: {},
37-
}),
38-
});
68+
fetch(`<WireQuery Host>/api/v1/recordings/${recording.id}/finish`, {
69+
method: "POST",
70+
headers: {
71+
"Content-Type": "application/json",
72+
},
73+
body: JSON.stringify({
74+
secret: recording.secret,
75+
recording: JSON.stringify(events),
76+
context: {},
77+
}),
78+
});
3979
```
40-
Where `events` represent `rrweb` events.
80+
Where `events` represent `rrweb` events and `<WireQuery Host>` is the host of WireQuery, such as `https://demo.wirequery.io`.
81+
82+
An example of how `rrweb` can be used, can be found in the `sdk/js/examples/transactions` in the [WireQuery](https://github.com/wirequery/wirequery) repository.
83+
84+
## Examples
85+
86+
The following examples demonstrate how WireQuery can be used within a Frontend application:
4187

42-
An example of how `rrweb` can be used, can be found in the `sdk/js/examples/transactions`.
88+
- [Transactions](https://github.com/wirequery/wirequery/tree/main/sdk/js/examples/transactions) - simulates a financial system that can create and retrieve transactions. Requires two backends to function properly:
89+
- [Transaction Service](https://github.com/wirequery/wirequery/tree/main/sdk/jvm/examples/spring-boot/transactions) - simulates a financial system that can create and retrieve transactions.
90+
- [Balance Calculator](https://github.com/wirequery/wirequery/tree/main/sdk/jvm/examples/spring-boot/balance-calculator) - calculates a user's balance based on the transactions from the `transactions` service. Exemplifies how to use `extensions`.

sdk/jvm/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Getting Started
1+
# Java Virtual Machine
22

33
## Adding Dependencies
44

@@ -56,9 +56,9 @@ public class User {
5656
}
5757
```
5858

59-
# Additional Configuration
59+
## Additional Configuration
6060

61-
## Masking using Application Config
61+
### Masking using Application Config
6262

6363
Besides `@Mask` and `@Unmask`, you can also mask and unmask fields using the `wirequery.maskSettings.classes` property.
6464
This property takes a list of objects containing:
@@ -67,9 +67,9 @@ This property takes a list of objects containing:
6767
- `unmask` - Whether or not to unmask (unless overridden by field settings) all fields in this class
6868
- `name` - The fully qualified name of the class
6969
- `fields` - A list of fields to set masking rules
70-
- `mask` - Whether or not to mask this field
71-
- `unmask` - Whether or not to unmask this field
72-
- `name` - The name of the field
70+
- `mask` - Whether or not to mask this field
71+
- `unmask` - Whether or not to unmask this field
72+
- `name` - The name of the field
7373

7474
Here, `mask` and `unmask` cannot be used at the same time.
7575

@@ -87,7 +87,7 @@ wirequery:
8787
mask: true
8888
```
8989

90-
## Limiting Access
90+
### Limiting Access
9191

9292
Access to resources can be limited using either the `allowedResources` or `unallowedResources` properties. These
9393
properties cannot be used at the same time. Both properties take a list of objects containing the path and a list of
@@ -110,7 +110,7 @@ wirequery:
110110
- POST
111111
```
112112

113-
## Extending WireQuery
113+
### Extending WireQuery
114114

115115
WireQuery can be extended to provide more information than only the incoming request and response using extensions.
116116
You can extend WireQuery by using the `RequestData` object, which can be injected into a bean. The `RequestData` object,
@@ -134,7 +134,7 @@ var maskedResponseHeaders = headersMasker.maskResponseHeaders(myResponseHeaders)
134134
var maskedObject = objectMasker.mask(myObject);
135135
```
136136

137-
# Configuration Properties
137+
## Configuration Properties
138138

139139
The following settings can be used to configure WireQuery in your `application.yml` file:
140140

@@ -147,15 +147,15 @@ The following settings can be used to configure WireQuery in your `application.y
147147
| wirequery.allowedResources | path, methods | null | Determines which resources are allowed to be accessed. |
148148
| wirequery.unallowedResources | path, methods | null | Determines which resources are allowed to be accessed. |
149149

150-
# Limitations
150+
## Limitations
151151

152152
Current limitations include:
153153

154154
- If the request body is malformed, it cannot be parsed and therefore not intercepted. As such, it will end up as `null` in the `context`.
155155

156-
# Examples
156+
## Examples
157157

158-
Two examples may exemplify how WireQuery can be used in a Spring Boot project.
158+
The following examples demonstrate how WireQuery can be used within a Spring Boot application:
159159

160-
- [Transaction Service](examples/spring-boot/transactions) - simulates a financial system that can create and retrieve transactions.
161-
- [Balance Calculator](examples/spring-boot/balance-calculator) - calculates a user's balance based on the transactions from the `transactions` service. Exemplifies how to use `extensions`.
160+
- [Transaction Service](https://github.com/wirequery/wirequery/tree/main/sdk/jvm/examples/spring-boot/transactions) - simulates a financial system that can create and retrieve transactions.
161+
- [Balance Calculator](https://github.com/wirequery/wirequery/tree/main/sdk/jvm/examples/spring-boot/balance-calculator) - calculates a user's balance based on the transactions from the `transactions` service. Exemplifies how to use `extensions`.

sdk/universal/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Universal
2+
3+
!!IMPORTANT: this SDK is highly experimental. There is no built-in masking!!
4+
5+
WireQuery Universal Daemon is a program that allows any application to easily connect to WireQuery.
6+
7+
## How It Works
8+
9+
WireQuery Universal Daemon connects to WireQuery to fetch the queries for the specified applications. Whenever queries are sent from
10+
WireQuery to WireQuery Universal Daemon, the list of queries that run over every request is updated.
11+
12+
In the meanwhile, applications can send a so-called Context object to WireQuery Universal Daemon. Whenever a context object is received,
13+
WireQuery Universal Daemon will run all queries against that object and send the results back to WireQuery.
14+
15+
## Installation
16+
17+
Make sure you have Go 1.19 or later installed and run:
18+
```
19+
go install github.com/wirequery/wirequery/sdk/go/cmd/universal
20+
```
21+
22+
## Running WireQuery Universal Daemon
23+
24+
WireQuery Universal Daemon should be run on the same machine as your application.
25+
```
26+
wirequery --appName <appName> --apiKey <apiKey> --port <port> --host <host>
27+
```
28+
For example:
29+
```
30+
wirequery --appName dummy --apiKey 123-456-789 --port 8091 --host grpc.wirequery.io
31+
```
32+
33+
## Usage
34+
35+
Applications wanting to connect to WireQuery should send the following information to WireQuery Universal Daemon with
36+
each request, whereas the request's sensitive data is masked before sending the data to WireQuery Universal Daemon.
37+
Masked data should be replaced by the term "MASKED".
38+
```
39+
POST api/v1/events
40+
41+
Content-Type: application/json
42+
43+
{
44+
"method": "<method>",
45+
"path": "<path>",
46+
"statusCode": <statusCode>,
47+
"queryParameters": <queryParameters>,
48+
"requestBody": <requestBody>,
49+
"responseBody": <responseBody>,
50+
"requestHeaders": <requestHeaders>,
51+
"responseHeaders": <responseHeaders>,
52+
"extensions": <extensions>,
53+
"startTime": <startTime>,
54+
"endTime": <endTime>,
55+
"traceId": <traceId>
56+
}
57+
```
58+
59+
Here:
60+
- `<method>` is the method of the HTTP call, e.g. `POST`
61+
- `<path>` is the path of the HTTP call, e.g. `/api/users/1`
62+
- `<statusCode>` is the status code of the HTTP call, e.g. `200`
63+
- `<queryParamters>` is an object of query parameters, e.g. `{ "searchTerms": [ "some", "term"], "something": "else" }`
64+
- `<requestBody>` is an object containing the request body, e.g. `{ "username": "wouter" }`
65+
- `<responseBody>` is an object containing the response body, e.g. `{ "username": "wouter" }`
66+
- `<extensions>` is an object containing custom extensions, e.g. `{ "upstreamCalls": [], "logs": [] }`
67+
- `<startTime>` is the start timestamp of the request in milliseconds
68+
- `<endTime>` is the end timestamp of the request in milliseconds
69+
- `<traceId>` is the trace id of the request, which is needed for Extended Tracing
70+

0 commit comments

Comments
 (0)