forked from open-telemetry/opentelemetry-java-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[disk-buffering] Split serializer (open-telemetry#1167)
- Loading branch information
1 parent
aaf0446
commit 5000adf
Showing
21 changed files
with
176 additions
and
87 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
31 changes: 31 additions & 0 deletions
31
...ontrib/disk/buffering/internal/serialization/deserializers/LogRecordDataDeserializer.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,31 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers; | ||
|
||
import io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.ProtoLogsDataMapper; | ||
import io.opentelemetry.proto.logs.v1.LogsData; | ||
import io.opentelemetry.sdk.logs.data.LogRecordData; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public final class LogRecordDataDeserializer implements SignalDeserializer<LogRecordData> { | ||
private static final LogRecordDataDeserializer INSTANCE = new LogRecordDataDeserializer(); | ||
|
||
private LogRecordDataDeserializer() {} | ||
|
||
static LogRecordDataDeserializer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public List<LogRecordData> deserialize(byte[] source) { | ||
try { | ||
return ProtoLogsDataMapper.getInstance().fromProto(LogsData.ADAPTER.decode(source)); | ||
} catch (IOException e) { | ||
throw new IllegalArgumentException(e); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...y/contrib/disk/buffering/internal/serialization/deserializers/MetricDataDeserializer.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,31 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers; | ||
|
||
import io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.metrics.ProtoMetricsDataMapper; | ||
import io.opentelemetry.proto.metrics.v1.MetricsData; | ||
import io.opentelemetry.sdk.metrics.data.MetricData; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public final class MetricDataDeserializer implements SignalDeserializer<MetricData> { | ||
private static final MetricDataDeserializer INSTANCE = new MetricDataDeserializer(); | ||
|
||
private MetricDataDeserializer() {} | ||
|
||
static MetricDataDeserializer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public List<MetricData> deserialize(byte[] source) { | ||
try { | ||
return ProtoMetricsDataMapper.getInstance().fromProto(MetricsData.ADAPTER.decode(source)); | ||
} catch (IOException e) { | ||
throw new IllegalArgumentException(e); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...metry/contrib/disk/buffering/internal/serialization/deserializers/SignalDeserializer.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,28 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers; | ||
|
||
import io.opentelemetry.sdk.logs.data.LogRecordData; | ||
import io.opentelemetry.sdk.metrics.data.MetricData; | ||
import io.opentelemetry.sdk.trace.data.SpanData; | ||
import java.util.List; | ||
|
||
public interface SignalDeserializer<SDK_ITEM> { | ||
|
||
static SignalDeserializer<SpanData> ofSpans() { | ||
return SpanDataDeserializer.getInstance(); | ||
} | ||
|
||
static SignalDeserializer<MetricData> ofMetrics() { | ||
return MetricDataDeserializer.getInstance(); | ||
} | ||
|
||
static SignalDeserializer<LogRecordData> ofLogs() { | ||
return LogRecordDataDeserializer.getInstance(); | ||
} | ||
|
||
List<SDK_ITEM> deserialize(byte[] source); | ||
} |
31 changes: 31 additions & 0 deletions
31
...try/contrib/disk/buffering/internal/serialization/deserializers/SpanDataDeserializer.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,31 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers; | ||
|
||
import io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.spans.ProtoSpansDataMapper; | ||
import io.opentelemetry.proto.trace.v1.TracesData; | ||
import io.opentelemetry.sdk.trace.data.SpanData; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public final class SpanDataDeserializer implements SignalDeserializer<SpanData> { | ||
private static final SpanDataDeserializer INSTANCE = new SpanDataDeserializer(); | ||
|
||
private SpanDataDeserializer() {} | ||
|
||
static SpanDataDeserializer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public List<SpanData> deserialize(byte[] source) { | ||
try { | ||
return ProtoSpansDataMapper.getInstance().fromProto(TracesData.ADAPTER.decode(source)); | ||
} catch (IOException e) { | ||
throw new IllegalArgumentException(e); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.