Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Add some logging for modelconfig problems #64310

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/frontend/internal/modelconfig/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func (m *manager) applyNewSiteConfig(latestSiteConfig schema.SiteConfiguration)
m.builder.siteConfigData = latestSiteModelConfiguration
updatedConfig, err := m.builder.build()
if err != nil {
m.logger.Error("error calculating modelconfig", log.Error(err))
return nil, err
}

Expand Down
5 changes: 5 additions & 0 deletions cmd/frontend/internal/modelconfig/siteconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func maybeGetSiteModelConfiguration(logger log.Logger, siteConfig schema.SiteCon
logger.Info("converting completions configuration data", log.String("apiProvider", string(compConfig.Provider)))
return convertCompletionsConfig(compConfig)
}

// There are some situations where conf.GetCompletionsConfig will return nil, even though there
// is some configuration data put in the site config. e.g. if Cody isn't enabled on the Sourcegraph
// license, or there are some validation errors such as a required endpoint not being set.
logger.Warn("no site model configuration found")
return nil, nil
}

Expand Down
Loading