Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

691 B
Raw Blame
package config

import (
	"context"

	"github.com/SigNoz/signoz/pkg/factory"
)

func New(ctx context.Context, resolverConfig ResolverConfig, configFactories []factory.ConfigFactory) (*Conf, error) {
	// Get the config from the resolver
	resolver, err := NewResolver(resolverConfig)
	if err != nil {
		return nil, err
	}

	resolvedConf, err := resolver.Do(ctx)
	if err != nil {
		return nil, err
	}

	conf := NewConf()
	// Set the default configs
	for _, factory := range configFactories {
		c := factory.New()
		if err := conf.Set(factory.Name().String(), c); err != nil {
			return nil, err
		}
	}

	err = conf.Merge(resolvedConf)
	if err != nil {
		return nil, err
	}

	return conf, nil
}