Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 59 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Hypertrace GraphQL
Hypertrace GraphQL service serves the GraphQL API which will be used by Hypertrace UI.

## Testing
## Description

`./gradlew test`
| ![space-1.jpg](https://hypertrace-docs.s3.amazonaws.com/arch/ht-query.png) |
|:--:|
| *Hypertrace Query Architecture* |

## Running
[Hypertrace-UI](https://github.com/hypertrace/hypertrace-ui) talks to hypertrace-GraphQL service which serves the GraphQL API which queries data from downstream services. GraphQL services talks to different grpc services to form the response including [attribute-service](https://github.com/hypertrace/attribute-service), [entity-service](https://github.com/hypertrace/entity-service), [gateway-service](https://github.com/hypertrace/gateway-service) and [config-service](https://github.com/hypertrace/config-service).

`./gradlew run`

## Queries
### Queries
Here are some of the important GraphQL queries:


### 1. Verify trace exists
#### 1. Verify trace exists

```graphql
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
Expand All @@ -39,7 +40,7 @@ curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
```


### 2. Get all service names
#### 2. Get all service names

```graphql
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
Expand All @@ -59,7 +60,7 @@ curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
}'
```

### 3. Get all backend names
#### 3. Get all backend names

```graphql
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
Expand All @@ -79,7 +80,7 @@ curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
}'
```

### 4. Get all API names
#### 4. Get all API names

```graphql
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
Expand All @@ -99,7 +100,7 @@ curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
}'
```

### 5. Get service and backend dependency graph
#### 5. Get service and backend dependency graph

```graphql
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
Expand Down Expand Up @@ -138,4 +139,51 @@ curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
}
}
}'
```
```


## Building locally
The Hypertrace GraphQl service uses gradle to compile/install/distribute. Gradle wrapper is already part of the source code. To build Hypertrace GraphQL image, run:

```
./gradlew dockerBuildImages
```

## Testing

### Running unit tests
Run `./gradlew test` to execute unit tests.

### Testing image

#### With docker-compose

To test your image using the docker-compose setup follow the steps:

- Commit you changes to a branch say `graphql-service-test`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We describe how to test via docker compose in a section called "Testing image" and via helm in one called "Helm setup". I think It would make more sense to break it down into two sections under "Testing image" like "With docker-compose" and "With helm"

- Go to [hypertrace-service](https://github.com/hypertrace/hypertrace-service) and checkout the above branch in the submodule.
```
cd hypertrace-graphql && git checkout graphql-service-test && cd ..
```
- Change tag for `hypertrace-service` from `:main` to `:test` in [docker-compose file](https://github.com/hypertrace/hypertrace/blob/main/docker/docker-compose.yml) like this.

```yaml
hypertrace-service:
image: hypertrace/hypertrace-service:test
container_name: hypertrace-service
...
```
- and then run `docker-compose up` to test the setup.

#### With Helm setup
Add image repository and tag in values.yaml file [here](https://github.com/hypertrace/hypertrace/blob/main/kubernetes/platform-services/values.yaml) like below and then run `./hypertrace.sh install` again and you can test your image!

```yaml
hypertrace-graphql-service:
image:
repository: "hypertrace/hypertrace-graphql-service"
tagOverride: "test"
```

## Docker Image Source:
- [DockerHub > Hypertrace GraphQL](https://hub.docker.com/r/hypertrace/hypertrace-graphql-service/)