raw_unmarshaler.go 659 B

123456789101112131415161718192021222324
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package kafkareceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver"
  4. import (
  5. "go.opentelemetry.io/collector/pdata/plog"
  6. )
  7. type rawLogsUnmarshaler struct{}
  8. func newRawLogsUnmarshaler() LogsUnmarshaler {
  9. return rawLogsUnmarshaler{}
  10. }
  11. func (r rawLogsUnmarshaler) Unmarshal(buf []byte) (plog.Logs, error) {
  12. l := plog.NewLogs()
  13. l.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty().Body().SetEmptyBytes().FromRaw(buf)
  14. return l, nil
  15. }
  16. func (r rawLogsUnmarshaler) Encoding() string {
  17. return "raw"
  18. }