-
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.
Initial Observability extension - devservices, devresources, LGTM
- Loading branch information
Showing
57 changed files
with
2,081 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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
69 changes: 69 additions & 0 deletions
69
core/runtime/src/main/java/io/quarkus/runtime/util/EnumerationUtil.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,69 @@ | ||
package io.quarkus.runtime.util; | ||
|
||
import java.util.Enumeration; | ||
import java.util.Iterator; | ||
import java.util.NoSuchElementException; | ||
import java.util.Objects; | ||
import java.util.Spliterator; | ||
import java.util.function.Consumer; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Transform to "old school" Enumeration from Iterator/Spliterator/Stream | ||
*/ | ||
public class EnumerationUtil { | ||
public static <T> Enumeration<T> from(Iterator<T> iterator) { | ||
Objects.requireNonNull(iterator); | ||
|
||
return new Enumeration<T>() { | ||
@Override | ||
public boolean hasMoreElements() { | ||
return iterator.hasNext(); | ||
} | ||
|
||
@Override | ||
public T nextElement() { | ||
return iterator.next(); | ||
} | ||
}; | ||
} | ||
|
||
public static <T> Enumeration<T> from(Spliterator<T> spliterator) { | ||
Objects.requireNonNull(spliterator); | ||
|
||
class Adapter implements Enumeration<T>, Consumer<T> { | ||
boolean valueReady; | ||
T nextElement; | ||
|
||
public void accept(T t) { | ||
this.valueReady = true; | ||
this.nextElement = t; | ||
} | ||
|
||
public boolean hasMoreElements() { | ||
if (!this.valueReady) { | ||
spliterator.tryAdvance(this); | ||
} | ||
|
||
return this.valueReady; | ||
} | ||
|
||
public T nextElement() { | ||
if (!this.valueReady && !this.hasMoreElements()) { | ||
throw new NoSuchElementException(); | ||
} else { | ||
this.valueReady = false; | ||
T t = this.nextElement; | ||
this.nextElement = null; | ||
return t; | ||
} | ||
} | ||
} | ||
|
||
return new Adapter(); | ||
} | ||
|
||
public static <T> Enumeration<T> from(Stream<T> stream) { | ||
return from(stream.spliterator()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>quarkus-observability-devservices-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-observability-devservices-common</artifactId> | ||
<name>Quarkus - Observability Devservices - Common</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.smallrye.config</groupId> | ||
<artifactId>smallrye-config-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
15 changes: 15 additions & 0 deletions
15
...-devservices/common/src/main/java/io/quarkus/observability/common/ContainerConstants.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,15 @@ | ||
package io.quarkus.observability.common; | ||
|
||
public final class ContainerConstants { | ||
|
||
// Images | ||
|
||
public static final String LGTM = "grafana/otel-lgtm:0.2.0"; | ||
|
||
// Ports | ||
|
||
public static final int GRAFANA_PORT = 3000; | ||
|
||
public static final int OTEL_GRPC_EXPORTER_PORT = 4317; | ||
public static final int OTEL_HTTP_EXPORTER_PORT = 4318; | ||
} |
51 changes: 51 additions & 0 deletions
51
.../common/src/main/java/io/quarkus/observability/common/config/AbstractContainerConfig.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,51 @@ | ||
package io.quarkus.observability.common.config; | ||
|
||
import java.util.Locale; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
public abstract class AbstractContainerConfig implements ContainerConfig { | ||
|
||
private final String imageName; | ||
private final boolean shared; | ||
|
||
public AbstractContainerConfig(String imageName) { | ||
this(imageName, true); | ||
} | ||
|
||
public AbstractContainerConfig(String imageName, boolean shared) { | ||
this.imageName = imageName; | ||
this.shared = shared; | ||
} | ||
|
||
@Override | ||
public boolean enabled() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String imageName() { | ||
return imageName; | ||
} | ||
|
||
@Override | ||
public boolean shared() { | ||
return shared; | ||
} | ||
|
||
@Override | ||
public Optional<Set<String>> networkAliases() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public String label() { | ||
String sn = getClass().getSimpleName().toLowerCase(Locale.ROOT); | ||
return "quarkus-dev-resource-" + sn; | ||
} | ||
|
||
@Override | ||
public String serviceName() { | ||
return "quarkus"; | ||
} | ||
} |
Oops, something went wrong.