Hypertrace GraphQL service serves the GraphQL API which will be used by Hypertrace UI.
Hypertrace Query Architecture |
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, entity-service, gateway-service and config-service.
Here are some of the important GraphQL queries:
test
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
'{
traces(
type: API_TRACE
between: {
startTime: "2015-01-01T00:00:00.000Z"
endTime: "2025-01-01T00:00:00.000Z"
}
filterBy: [
{
operator: EQUALS
value: "348bae39282251a5"
type: ID
idType: API_TRACE
}
]
) {
total
}
}'
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
'{
entities(
type: SERVICE
between: {
startTime: "2015-01-01T00:00:00Z"
endTime: "2025-01-01T00:00:00Z"
}
) {
results {
name: attribute(key: "name")
}
total
}
}'
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
'{
entities(
type: BACKEND
between: {
startTime: "2015-01-01T00:00:00Z"
endTime: "2025-01-01T00:00:00Z"
}
) {
results {
name: attribute(key: "name")
}
total
}
}'
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
'{
entities(
type: API
between: {
startTime: "2015-01-01T00:00:00Z"
endTime: "2025-01-01T00:00:00Z"
}
) {
results {
name: attribute(key: "name")
}
total
}
}'
curl -s localhost:2020/graphql -H 'Content-Type: application/graphql' -d \
'{
entities(
type: SERVICE
between: {
startTime: "2015-01-01T00:00:00.000Z"
endTime: "2025-01-01T00:00:00.000Z"
}
) {
results {
id
name: attribute(key: "name")
outgoingEdges_SERVICE: outgoingEdges(neighborType: SERVICE) {
results {
neighbor {
name: attribute(key: "name")
}
}
}
outgoingEdges_BACKEND: outgoingEdges(neighborType: BACKEND) {
results {
neighbor {
name: attribute(key: "name")
}
}
}
incomingEdges_SERVICE: incomingEdges(neighborType: SERVICE) {
results {
neighbor {
name: attribute(key: "name")
}
}
}
}
}
}'
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
Run ./gradlew test
to execute unit tests.
To test your image using the docker-compose setup follow the steps:
- Commit you changes to a branch say
graphql-service-test
. - Go to 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 like this.
hypertrace-service:
image: hypertrace/hypertrace-service:test
container_name: hypertrace-service
...
- and then run
docker-compose up
to test the setup.
Add image repository and tag in values.yaml file here like below and then run ./hypertrace.sh install
again and you can test your image!
hypertrace-graphql-service:
image:
repository: "hypertrace/hypertrace-graphql-service"
tagOverride: "test"