mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
- Go module: github.com/SigNoz/signoz-otel-collector → github.com/hanzoai/otel-collector - All signoz-prefixed packages → o11y-prefixed - Docker: signoz/* → ghcr.io/hanzoai/otel-collector - ClickHouse exporter → Hanzo Datastore - Env vars: SIGNOZ_* → HANZO_* - Directory renames for all processor/receiver/exporter packages
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package unmarshalertest // import "github.com/hanzoai/otel-collector/receiver/o11yawsfirehosereceiver/internal/unmarshaler/unmarshalertest"
|
|
|
|
import (
|
|
"go.opentelemetry.io/collector/pdata/plog"
|
|
|
|
"github.com/hanzoai/otel-collector/receiver/o11yawsfirehosereceiver/internal/unmarshaler"
|
|
)
|
|
|
|
// NopLogsUnmarshaler is a LogsUnmarshaler that doesn't do anything
|
|
// with the inputs and just returns the logs and error passed in.
|
|
type NopLogsUnmarshaler struct {
|
|
logs plog.Logs
|
|
err error
|
|
}
|
|
|
|
var _ unmarshaler.LogsUnmarshaler = (*NopLogsUnmarshaler)(nil)
|
|
|
|
// NewNopLogs provides a nop logs unmarshaler with the default
|
|
// plog.Logs and no error.
|
|
func NewNopLogs() *NopLogsUnmarshaler {
|
|
return &NopLogsUnmarshaler{}
|
|
}
|
|
|
|
// NewWithLogs provides a nop logs unmarshaler with the passed
|
|
// in logs as the result of the Unmarshal and no error.
|
|
func NewWithLogs(logs plog.Logs) *NopLogsUnmarshaler {
|
|
return &NopLogsUnmarshaler{logs: logs}
|
|
}
|
|
|
|
// NewErrLogs provides a nop logs unmarshaler with the passed
|
|
// in error as the Unmarshal error.
|
|
func NewErrLogs(err error) *NopLogsUnmarshaler {
|
|
return &NopLogsUnmarshaler{err: err}
|
|
}
|
|
|
|
// Unmarshal deserializes the records into logs.
|
|
func (u *NopLogsUnmarshaler) Unmarshal([][]byte) (plog.Logs, error) {
|
|
return u.logs, u.err
|
|
}
|
|
|
|
// Type of the serialized messages.
|
|
func (u *NopLogsUnmarshaler) Type() string {
|
|
return typeStr
|
|
}
|