Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/awskinesisexporter] add raw encode #2

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exporter/awskinesisexporter/internal/batch/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func NewEncoder(named string, batchOptions ...Option) (Encoder, error) {
bm.logsMarshaller = &plog.JSONMarshaler{}
bm.metricsMarshaller = &pmetric.JSONMarshaler{}
bm.tracesMarshaller = &ptrace.JSONMarshaler{}
case "raw":
bm.logsMarshaller = &rawMarshaler{}
case "jaeger_proto":
// Jaeger encoding is a special case
// since the internal libraries offer no means of ptrace.TraceMarshaller.
Expand Down
28 changes: 28 additions & 0 deletions exporter/awskinesisexporter/internal/batch/raw_marshaler.go
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 batch // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awskinesisexporter/internal/batch"

import (
"bytes"

"go.opentelemetry.io/collector/pdata/plog"
)

type rawMarshaler struct{}

// TODO: implement this func, raw all or raw specific attribute
func (*rawMarshaler) MarshalLogs(ld plog.Logs) ([]byte, error) {
buf := bytes.Buffer{}
return buf.Bytes(), nil
}

var _ plog.Unmarshaler = (*rawUnmarshaler)(nil)

type rawUnmarshaler struct{}

// TODO: Implement this func
func (*rawUnmarshaler) UnmarshalLogs(buf []byte) (plog.Logs, error) {
ld := plog.NewLogs()
return ld, nil
}