Skip to content

The public graphql API of the Hypertrace platform

License

Notifications You must be signed in to change notification settings

suddendust/hypertrace-graphql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hypertrace GraphQL

Hypertrace GraphQL service serves the GraphQL API which will be used by Hypertrace UI.

Description

space-1.jpg
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.

Queries

Here are some of the important GraphQL queries:

1. Verify trace exists

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
  }
}'

2. Get all service names

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
  }
}'

3. Get all backend names

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
  }
}'

4. Get all API names

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
  }
}'

5. Get service and backend dependency graph

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")
          }
        }
      }
    }
  }
}'

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.
  • Go to hypertrace-service and checkout the above branch in the submodule.
cd hypertrace-graphql && git checkout graphql-service-test && cd ..
  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 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"

Docker Image Source:

About

The public graphql API of the Hypertrace platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.3%
  • Kotlin 2.7%