Repository: prometheus/prometheus
File: web/api/v1/api.go (Go)

Code before:
	QueryEngine       promql.QueryEngine
	ExemplarQueryable storage.ExemplarQueryable

	scrapePoolsRetriever  func(context.Context) ScrapePoolsRetriever
	targetRetriever       func(context.Context) TargetRetriever
	alertmanagerRetriever func(context.Context) AlertmanagerRetriever
	rulesRetriever        func(context.Context) RulesRetriever
	now                   func() time.Time
	config                func() config.Config
	flagsMap              map[string]string
	ready                 func(http.HandlerFunc) http.HandlerFunc
	globalURLOptions      GlobalURLOptions

	db                    TSDBAdminStats
	dbDir                 string
	enableAdmin           bool
	logger                *slog.Logger
	CORSOrigin            *regexp.Regexp
	buildInfo             *PrometheusVersion
	runtimeInfo           func() (RuntimeInfo, error)
	gatherer              prometheus.Gatherer
	isAgent               bool
	statsRenderer         StatsRenderer
	notificationsGetter   func() []notifications.Notification
	notificationsSub      func() (<-chan notifications.Notification, func(), bool)
	errorTypeToStatusCode ErrorTypeToStatusCode

	remoteWriteHandler http.Handler
	remoteReadHandler  http.Handler
	otlpWriteHandler   http.Handler

	codecs []Codec
}

// NewAPI returns an initialized API type.
func NewAPI(
	qe promql.QueryEngine,
	q storage.SampleAndChunkQueryable,
	ap storage.Appendable,
	eq storage.ExemplarQueryable,
	spsr func(context.Context) ScrapePoolsRetriever,
	tr func(context.Context) TargetRetriever,
	ar func(context.Context) AlertmanagerRetriever,
	configFunc func() config.Config,
	flagsMap map[string]string,
	globalURLOptions GlobalURLOptions,
	readyFunc func(http.HandlerFunc) http.HandlerFunc,
	db TSDBAdminStats,
	dbDir string,
	enableAdmin bool,
	logger *slog.Logger,

Review comment (suggestion):
```suggestion
        // Allows customizing the default mapping
	errorTypeToStatusCode ErrorTypeToStatusCode
```

Code after:
	targetRetriever       func(context.Context) TargetRetriever
	alertmanagerRetriever func(context.Context) AlertmanagerRetriever
	rulesRetriever        func(context.Context) RulesRetriever
	now                   func() time.Time
	config                func() config.Config
	flagsMap              map[string]string
	ready                 func(http.HandlerFunc) http.HandlerFunc
	globalURLOptions      GlobalURLOptions

	db                  TSDBAdminStats
	dbDir               string
	enableAdmin         bool
	logger              *slog.Logger
	CORSOrigin          *regexp.Regexp
	buildInfo           *PrometheusVersion
	runtimeInfo         func() (RuntimeInfo, error)
	gatherer            prometheus.Gatherer
	isAgent             bool
	statsRenderer       StatsRenderer
	notificationsGetter func() []notifications.Notification
	notificationsSub    func() (<-chan notifications.Notification, func(), bool)
	// Allows customizing the default mapping
	overrideErrorCode OverrideErrorCode

	remoteWriteHandler http.Handler
	remoteReadHandler  http.Handler
	otlpWriteHandler   http.Handler

	codecs []Codec
}

// NewAPI returns an initialized API type.
func NewAPI(
	qe promql.QueryEngine,
	q storage.SampleAndChunkQueryable,
	ap storage.Appendable,
	eq storage.ExemplarQueryable,
	spsr func(context.Context) ScrapePoolsRetriever,
	tr func(context.Context) TargetRetriever,
	ar func(context.Context) AlertmanagerRetriever,
	configFunc func() config.Config,
	flagsMap map[string]string,
	globalURLOptions GlobalURLOptions,
	readyFunc func(http.HandlerFunc) http.HandlerFunc,
	db TSDBAdminStats,
	dbDir string,
	enableAdmin bool,
	logger *slog.Logger,
	rr func(context.Context) RulesRetriever,
	remoteReadSampleLimit int,
	remoteReadConcurrencyLimit int,