-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
557 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...allrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/metricresources/TestPojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.quarkus.it.smallrye.graphql.metricresources; | ||
|
||
/** | ||
* Just a test pojo | ||
*/ | ||
public class TestPojo { | ||
private String message; | ||
|
||
public TestPojo() { | ||
super(); | ||
} | ||
|
||
public TestPojo(String message) { | ||
super(); | ||
this.message = message; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...lrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/metricresources/TestRandom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.quarkus.it.smallrye.graphql.metricresources; | ||
|
||
/** | ||
* Just a test pojo that contains a random number | ||
*/ | ||
public class TestRandom { | ||
private double value; | ||
|
||
public TestRandom() { | ||
this(Math.random()); | ||
} | ||
|
||
public TestRandom(double value) { | ||
super(); | ||
this.value = value; | ||
} | ||
|
||
public double getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(double value) { | ||
this.value = value; | ||
} | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
...ye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/metricresources/TestResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package io.quarkus.it.smallrye.graphql.metricresources; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Mutation; | ||
import org.eclipse.microprofile.graphql.Query; | ||
import org.eclipse.microprofile.graphql.Source; | ||
|
||
import io.micrometer.core.instrument.Metrics; | ||
import io.smallrye.mutiny.Uni; | ||
import io.smallrye.mutiny.infrastructure.Infrastructure; | ||
|
||
/** | ||
* Just a test endpoint | ||
*/ | ||
@GraphQLApi | ||
public class TestResource { | ||
|
||
public static final double SLEEP_TIME = 0.15; | ||
|
||
@Query | ||
public TestPojo foo() { | ||
return new TestPojo("bar"); | ||
} | ||
|
||
@Query | ||
public TestPojo[] superMetricFoo() throws InterruptedException { | ||
Thread.sleep(sleepTimeInMilliseconds()); | ||
return new TestPojo[] { foo(), foo(), foo() }; | ||
} | ||
|
||
@Query | ||
public List<TestPojo> batchFoo(@Source List<TestPojo> testPojos) throws InterruptedException { | ||
Thread.sleep(sleepTimeInMilliseconds()); | ||
return List.of(new TestPojo("bar1"), new TestPojo("bar2"), new TestPojo("bar3")); | ||
} | ||
|
||
@Query | ||
public Uni<List<TestPojo>> asyncBatchFoo(@Source List<TestPojo> testPojos) { | ||
return Uni.createFrom().item(() -> { | ||
try { | ||
Thread.sleep(sleepTimeInMilliseconds()); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return List.of(new TestPojo("abar1"), new TestPojo("abar2"), new TestPojo("abar3")); | ||
}); | ||
} | ||
|
||
// <placeholder> | ||
@Query | ||
public Uni<TestPojo[]> asyncSuperMetricFoo() throws InterruptedException { | ||
return Uni.createFrom().item(() -> { | ||
try { | ||
Thread.sleep(sleepTimeInMilliseconds()); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return new TestPojo[] { new TestPojo("async1"), new TestPojo("async2"), new TestPojo("async3") }; | ||
}).runSubscriptionOn(Infrastructure.getDefaultWorkerPool()); | ||
|
||
} | ||
|
||
@Mutation | ||
public void clearMetrics() { | ||
Metrics.globalRegistry.clear(); | ||
} | ||
|
||
public TestRandom getRandomNumber(@Source TestPojo testPojo) throws InterruptedException { | ||
Thread.sleep(sleepTimeInMilliseconds()); | ||
return new TestRandom(123); | ||
} | ||
|
||
public Uni<TestRandom> getRandomNumberAsync(@Source TestPojo testPojo) throws InterruptedException { | ||
return Uni.createFrom().item(() -> { | ||
try { | ||
Thread.sleep(sleepTimeInMilliseconds()); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return new TestRandom(123); | ||
}); | ||
} | ||
|
||
private long sleepTimeInMilliseconds() { | ||
return (long) (SLEEP_TIME * 1000); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
integration-tests/smallrye-graphql/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
message=Production | ||
quarkus.smallrye-graphql.show-runtime-exception-message=org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException | ||
quarkus.smallrye-graphql.show-runtime-exception-message=org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException | ||
quarkus.smallrye-graphql.metrics.enabled=true |
8 changes: 8 additions & 0 deletions
8
...ts/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/MicrometerMetricsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.quarkus.it.smallrye.graphql; | ||
|
||
import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
|
||
@QuarkusIntegrationTest | ||
public class MicrometerMetricsIT extends MicrometerMetricsTest { | ||
|
||
} |
Oops, something went wrong.