forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
a1b4e8a
commit 4510ec9
Showing
27 changed files
with
736 additions
and
14 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
17 changes: 17 additions & 0 deletions
17
...oyment/src/main/java/io/quarkus/opentelemetry/deployment/logging/LogHandlerProcessor.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,17 @@ | ||
package io.quarkus.opentelemetry.deployment.logging; | ||
|
||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.ExecutionTime; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.LogHandlerBuildItem; | ||
import io.quarkus.opentelemetry.runtime.logs.OpenTelemetryLogConfig; | ||
import io.quarkus.opentelemetry.runtime.logs.OpenTelemetryLogRecorder; | ||
|
||
class LogHandlerProcessor { | ||
|
||
@BuildStep | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
LogHandlerBuildItem build(OpenTelemetryLogRecorder recorder, OpenTelemetryLogConfig config) { | ||
return new LogHandlerBuildItem(recorder.initializeHandler(config)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.../runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/build/LogsBuildConfig.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,27 @@ | ||
package io.quarkus.opentelemetry.runtime.config.build; | ||
|
||
import static io.quarkus.opentelemetry.runtime.config.build.ExporterType.Constants.CDI_VALUE; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import io.smallrye.config.WithDefault; | ||
|
||
public interface LogsBuildConfig { | ||
/** | ||
* Enable logs with OpenTelemetry. | ||
* <p> | ||
* This property is not available in the Open Telemetry SDK. It's Quarkus specific. | ||
* <p> | ||
* Support for logs will be enabled if OpenTelemetry support is enabled | ||
* and either this value is true, or this value is unset. | ||
*/ | ||
@WithDefault("false") | ||
Optional<Boolean> enabled(); | ||
|
||
/** | ||
* The Logs exporter to use. | ||
*/ | ||
@WithDefault(CDI_VALUE) | ||
List<String> exporter(); | ||
} |
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
7 changes: 7 additions & 0 deletions
7
...java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterLogsConfig.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,7 @@ | ||
package io.quarkus.opentelemetry.runtime.config.runtime.exporter; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
|
||
@ConfigGroup | ||
public interface OtlpExporterLogsConfig extends OtlpExporterConfig { | ||
} |
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
29 changes: 29 additions & 0 deletions
29
.../main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/logs/NoopLogRecordExporter.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,29 @@ | ||
package io.quarkus.opentelemetry.runtime.exporter.otlp.logs; | ||
|
||
import java.util.Collection; | ||
|
||
import io.opentelemetry.sdk.common.CompletableResultCode; | ||
import io.opentelemetry.sdk.logs.data.LogRecordData; | ||
import io.opentelemetry.sdk.logs.export.LogRecordExporter; | ||
|
||
public class NoopLogRecordExporter implements LogRecordExporter { | ||
public static final NoopLogRecordExporter INSTANCE = new NoopLogRecordExporter(); | ||
|
||
private NoopLogRecordExporter() { | ||
} | ||
|
||
@Override | ||
public CompletableResultCode export(Collection<LogRecordData> collection) { | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
|
||
@Override | ||
public CompletableResultCode flush() { | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
|
||
@Override | ||
public CompletableResultCode shutdown() { | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../java/io/quarkus/opentelemetry/runtime/exporter/otlp/logs/VertxGrpcLogRecordExporter.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,32 @@ | ||
package io.quarkus.opentelemetry.runtime.exporter.otlp.logs; | ||
|
||
import java.util.Collection; | ||
|
||
import io.opentelemetry.exporter.internal.grpc.GrpcExporter; | ||
import io.opentelemetry.exporter.internal.otlp.logs.LogsRequestMarshaler; | ||
import io.opentelemetry.sdk.common.CompletableResultCode; | ||
import io.opentelemetry.sdk.logs.data.LogRecordData; | ||
import io.opentelemetry.sdk.logs.export.LogRecordExporter; | ||
|
||
public class VertxGrpcLogRecordExporter implements LogRecordExporter { | ||
private final GrpcExporter<LogsRequestMarshaler> delegate; | ||
|
||
public VertxGrpcLogRecordExporter(GrpcExporter<LogsRequestMarshaler> delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public CompletableResultCode export(Collection<LogRecordData> collection) { | ||
return delegate.export(LogsRequestMarshaler.create(collection), collection.size()); | ||
} | ||
|
||
@Override | ||
public CompletableResultCode flush() { | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
|
||
@Override | ||
public CompletableResultCode shutdown() { | ||
return delegate.shutdown(); | ||
} | ||
} |
Oops, something went wrong.