-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Processor component provider (#6623)
- Loading branch information
Showing
8 changed files
with
200 additions
and
26 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
47 changes: 47 additions & 0 deletions
47
...try/sdk/extension/incubator/fileconfig/component/LogRecordProcessorComponentProvider.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,47 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.extension.incubator.fileconfig.component; | ||
|
||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; | ||
import io.opentelemetry.sdk.common.CompletableResultCode; | ||
import io.opentelemetry.sdk.logs.LogRecordProcessor; | ||
import io.opentelemetry.sdk.logs.ReadWriteLogRecord; | ||
|
||
public class LogRecordProcessorComponentProvider implements ComponentProvider<LogRecordProcessor> { | ||
@Override | ||
public Class<LogRecordProcessor> getType() { | ||
return LogRecordProcessor.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "test"; | ||
} | ||
|
||
@Override | ||
public LogRecordProcessor create(StructuredConfigProperties config) { | ||
return new TestLogRecordProcessor(config); | ||
} | ||
|
||
public static class TestLogRecordProcessor implements LogRecordProcessor { | ||
|
||
public final StructuredConfigProperties config; | ||
|
||
private TestLogRecordProcessor(StructuredConfigProperties config) { | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public void onEmit(Context context, ReadWriteLogRecord logRecord) {} | ||
|
||
@Override | ||
public CompletableResultCode shutdown() { | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...elemetry/sdk/extension/incubator/fileconfig/component/SpanProcessorComponentProvider.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,61 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.extension.incubator.fileconfig.component; | ||
|
||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; | ||
import io.opentelemetry.sdk.common.CompletableResultCode; | ||
import io.opentelemetry.sdk.trace.ReadWriteSpan; | ||
import io.opentelemetry.sdk.trace.ReadableSpan; | ||
import io.opentelemetry.sdk.trace.SpanProcessor; | ||
|
||
public class SpanProcessorComponentProvider implements ComponentProvider<SpanProcessor> { | ||
@Override | ||
public Class<SpanProcessor> getType() { | ||
return SpanProcessor.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "test"; | ||
} | ||
|
||
@Override | ||
public SpanProcessor create(StructuredConfigProperties config) { | ||
return new TestSpanProcessor(config); | ||
} | ||
|
||
public static class TestSpanProcessor implements SpanProcessor { | ||
|
||
public final StructuredConfigProperties config; | ||
|
||
private TestSpanProcessor(StructuredConfigProperties config) { | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public void onStart(Context parentContext, ReadWriteSpan span) {} | ||
|
||
@Override | ||
public boolean isStartRequired() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void onEnd(ReadableSpan span) {} | ||
|
||
@Override | ||
public boolean isEndRequired() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public CompletableResultCode shutdown() { | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...urces/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider
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,6 +1,8 @@ | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.MetricExporterComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.SpanExporterComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.LogRecordExporterComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.SpanProcessorComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.LogRecordProcessorComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.ResourceComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.ResourceOrderedFirstComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.ResourceOrderedSecondComponentProvider |