@@ -492,11 +492,16 @@ func setupMetricsV1(setupLog logr.Logger) (datalayer.EndpointFactory, error) {
492492 return pmf , nil
493493}
494494
495+ // This function serves two (independent) purposes:
496+ // - creating data sources and configuring their extractors.
497+ // - configuring endpoint factory with the provided source.
498+ // In the future, data sources and extractors might be configured via
499+ // a file. Once done, this (and registering the sources with the
500+ // endpoint factory) should be moved accordingly.
501+ // Regardless, registration of all sources (e.g., if additional sources
502+ // are to be configured), must be done before the EndpointFactory is initialized.
495503func setupDatalayer (logger logr.Logger ) (datalayer.EndpointFactory , error ) {
496- // create and register a metrics data source and extractor. In the future,
497- // data sources and extractors might be configured via a file. Once done,
498- // this (and registering the sources with the endpoint factory) should
499- // be moved accordingly.
504+ // create and register a metrics data source and extractor.
500505 source := dlmetrics .NewDataSource (* modelServerMetricsScheme ,
501506 * modelServerMetricsPath ,
502507 * modelServerMetricsHttpsInsecureSkipVerify ,
@@ -515,6 +520,7 @@ func setupDatalayer(logger logr.Logger) (datalayer.EndpointFactory, error) {
515520 return nil , err
516521 }
517522
523+ // TODO: this could be moved to the configuration loading functions once ported over.
518524 sources := datalayer .GetSources ()
519525 for _ , src := range sources {
520526 logger .Info ("data layer configuration" , "source" , src .Name (), "extractors" , src .Extractors ())
0 commit comments