https://github.com/blaugold/apollo-engine-reporter
A reporter which sends GraphQL query traces to Apollo Studio, written in kotlin for the JVM.
https://github.com/blaugold/apollo-engine-reporter
apollo engine graphql java kotlin reporter studio trace
Last synced: 27 days ago
JSON representation
A reporter which sends GraphQL query traces to Apollo Studio, written in kotlin for the JVM.
- Host: GitHub
- URL: https://github.com/blaugold/apollo-engine-reporter
- Owner: blaugold
- License: mit
- Created: 2019-11-19T13:28:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-06T16:59:59.000Z (over 5 years ago)
- Last Synced: 2025-02-02T16:20:44.021Z (over 1 year ago)
- Topics: apollo, engine, graphql, java, kotlin, reporter, studio, trace
- Language: Kotlin
- Homepage:
- Size: 363 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[ ](https://bintray.com/gabriel-terwesten-oss/maven/graphql-kotlin-support/_latestVersion)
# Apollo Engine Reporter
This is a reporter which sends GraphQL query traces to an Apollo Studio server (formerly Apollo Engine), written in
kotlin for the JVM.
## Install
The module is available through `jcenter`.
With maven:
```xml
com.gabrielterwesten
apollo-engine-reporter
1.2.1
```
With gradle:
```kotlin
implementation("com.gabrielterwesten:apollo-engine-reporter:1.2.1")
```
## Usage
The code snippet below demonstrates the basic usage of the reporter.
```kotlin
val apiKey = "..."
val schema =
"""
type Query {
hello: String
}
""".trimIndent()
val typeDefinitionRegistry = SchemaParser().parse(schema)
val runtimeWiring =
RuntimeWiring.newRuntimeWiring()
.type("Query") {
it.dataFetcher("hello", StaticDataFetcher("World"))
}
.build()
val reporter =
ApolloEngineReporter(
traceShipper = DefaultTraceShipper(apiKey = apiKey),
querySignatureStrategy = DefaultQuerySignatureStrategy,
reportGenerator = DefaultReportGenerator(),
)
reporter.start()
val instrumentation =
ChainedInstrumentation(listOf(
TracingInstrumentation(),
TraceReporterInstrumentation(reporter),
))
val graphQLSchema =
SchemaGenerator().makeExecutableSchema(typeDefinitionRegistry, runtimeWiring)
val execution = GraphQL.newGraphQL(graphQLSchema).instrumentation(instrumentation).build()
val result = execution.execute("query { hello }")
println(result.getData().toString())
reporter.stop()
```
### License
apollo-engine-reporter is licensed under the MIT License. See [LICENSE](./LICENSE) for details.