Files
zeekay 087e487107 feat: rebrand signoz-otel-collector → Hanzo OTEL Collector
- 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
2026-03-12 00:21:24 -07:00

49 lines
1.2 KiB
Go

// Mostly Brought in as is from opentelemetry-collector-contrib
// Maintaining our own copy/version of Config allows us to use our own
// registry of stanza operators used in Config.Unmarshal in this file
package o11ylogspipelinestanzaoperator
import (
"fmt"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator"
"go.opentelemetry.io/collector/confmap"
)
// Config is the configuration of an operator
type Config struct {
operator.Builder
}
// NewConfig wraps the builder interface in a concrete struct
func NewConfig(b operator.Builder) Config {
return Config{Builder: b}
}
func (c *Config) Unmarshal(component *confmap.Conf) error {
if !component.IsSet("type") {
return fmt.Errorf("missing required field 'type'")
}
typeInterface := component.Get("type")
typeString, ok := typeInterface.(string)
if !ok {
return fmt.Errorf("non-string type %T for field 'type'", typeInterface)
}
builderFunc, ok := O11yStanzaOperatorsRegistry.Lookup(typeString)
if !ok {
return fmt.Errorf("unsupported type '%s'", typeString)
}
builder := builderFunc()
if err := component.Unmarshal(builder, confmap.WithIgnoreUnused()); err != nil {
return fmt.Errorf("unmarshal to %s: %w", typeString, err)
}
c.Builder = builder
return nil
}