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
50 lines
1.5 KiB
Go
50 lines
1.5 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/pmetric"
|
|
|
|
"github.com/hanzoai/otel-collector/receiver/o11yawsfirehosereceiver/internal/unmarshaler"
|
|
)
|
|
|
|
const typeStr = "nop"
|
|
|
|
// NopMetricsUnmarshaler is a MetricsUnmarshaler that doesn't do anything
|
|
// with the inputs and just returns the metrics and error passed in.
|
|
type NopMetricsUnmarshaler struct {
|
|
metrics pmetric.Metrics
|
|
err error
|
|
}
|
|
|
|
var _ unmarshaler.MetricsUnmarshaler = (*NopMetricsUnmarshaler)(nil)
|
|
|
|
// NewNopMetrics provides a nop metrics unmarshaler with the default
|
|
// pmetric.Metrics and no error.
|
|
func NewNopMetrics() *NopMetricsUnmarshaler {
|
|
return &NopMetricsUnmarshaler{}
|
|
}
|
|
|
|
// NewWithMetrics provides a nop metrics unmarshaler with the passed
|
|
// in metrics as the result of the Unmarshal and no error.
|
|
func NewWithMetrics(metrics pmetric.Metrics) *NopMetricsUnmarshaler {
|
|
return &NopMetricsUnmarshaler{metrics: metrics}
|
|
}
|
|
|
|
// NewErrMetrics provides a nop metrics unmarshaler with the passed
|
|
// in error as the Unmarshal error.
|
|
func NewErrMetrics(err error) *NopMetricsUnmarshaler {
|
|
return &NopMetricsUnmarshaler{err: err}
|
|
}
|
|
|
|
// Unmarshal deserializes the records into metrics.
|
|
func (u *NopMetricsUnmarshaler) Unmarshal([][]byte) (pmetric.Metrics, error) {
|
|
return u.metrics, u.err
|
|
}
|
|
|
|
// Type of the serialized messages.
|
|
func (u *NopMetricsUnmarshaler) Type() string {
|
|
return typeStr
|
|
}
|