-
Notifications
You must be signed in to change notification settings - Fork 1.5k
skip source init exp #3079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
skip source init exp #3079
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -89,6 +89,14 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( | |||||
| // initialize and validate the sources from configs | ||||||
| sourcesMap := make(map[string]sources.Source) | ||||||
| for name, sc := range cfg.SourceConfigs { | ||||||
| if cfg.SkipSourceInitialization { | ||||||
| sourcesMap[name] = &sources.UninitializedSource{ | ||||||
| Name: name, | ||||||
| Config: sc, | ||||||
| } | ||||||
| continue | ||||||
| } | ||||||
|
|
||||||
| s, err := func() (sources.Source, error) { | ||||||
| childCtx, span := instrumentation.Tracer.Start( | ||||||
| ctx, | ||||||
|
|
@@ -183,14 +191,20 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( | |||||
| defer span.End() | ||||||
| t, err := tc.Initialize(sourcesMap) | ||||||
| if err != nil { | ||||||
| if cfg.SkipSourceInitialization { | ||||||
| l.WarnContext(ctx, fmt.Sprintf("unable to initialize tool %q (source skip enabled): %v", name, err)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leveraging structured logging by passing the tool name and error as separate attributes is preferred over Additionally, consider wrapping the
Suggested change
|
||||||
| return nil, nil | ||||||
| } | ||||||
| return nil, fmt.Errorf("unable to initialize tool %q: %w", name, err) | ||||||
| } | ||||||
| return t, nil | ||||||
| }() | ||||||
| if err != nil { | ||||||
| return nil, nil, nil, nil, nil, nil, nil, err | ||||||
| } | ||||||
| toolsMap[name] = t | ||||||
| if t != nil { | ||||||
| toolsMap[name] = t | ||||||
| } | ||||||
| } | ||||||
| toolNames := make([]string, 0, len(toolsMap)) | ||||||
| for name := range toolsMap { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request title and description do not adhere to the repository's style guide.
feat(server): add skip source initialization option). Currently:skip source init exp.References