-
Notifications
You must be signed in to change notification settings - Fork 98
Explicit forward proxy support for HTTP with Basic Auth #1201
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?
Conversation
proxyURL := proxy.URL | ||
u, err := url.Parse(proxyURL) | ||
if err != nil { | ||
slog.ErrorContext(ctx, "Malformed proxy URL; skipping Proxy setup", "url", proxyURL, "error", err) |
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.
slog.ErrorContext(ctx, "Malformed proxy URL; skipping Proxy setup", "url", proxyURL, "error", err) | |
slog.ErrorContext(ctx, "Malformed proxy URL, unable to configure proxy for OTLP exporter", "url", proxyURL, "error", err) |
@@ -409,6 +418,14 @@ func (oc *Collector) restartCollector(ctx context.Context) { | |||
} | |||
} | |||
|
|||
func (oc *Collector) setProxyIfNeeded(ctx context.Context) { |
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.
Could this be renamed to just setProxy ?
func (oc *Collector) setProxyIfNeeded(ctx context.Context) { | |
func (oc *Collector) setProxy(ctx context.Context) { |
return http.ReadResponse(bufio.NewReader(conn), nil) | ||
} | ||
|
||
func wrapProxyError(ctx context.Context, msg string, err error, proxyURL string) error { |
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.
Why do we need to wrap the proxy error ?
slog.ErrorContext(ctx, "Unknown auth type for proxy, unable to configure proxy for OTLP exporter", | ||
"auth", auth, "url", proxyURL) |
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.
slog.ErrorContext(ctx, "Unknown auth type for proxy, unable to configure proxy for OTLP exporter", | |
"auth", auth, "url", proxyURL) | |
slog.ErrorContext(ctx, "Unknown auth type for proxy, unable to configure proxy for OTLP exporter", | |
"url", proxyURL) |
internal/config/types.go
Outdated
@@ -459,6 +472,14 @@ func (c *Config) NewContextWithLabels(ctx context.Context) context.Context { | |||
return metadata.NewOutgoingContext(ctx, md) | |||
} | |||
|
|||
func (c *Config) IsCommandServerProxyConfigured() bool { | |||
if c.Command.Server.Proxy == nil { |
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.
can you add nil check for c.Command and c.Command.Server as well?
@@ -338,6 +339,18 @@ type ( | |||
ExcludeFiles []string `yaml:"exclude_files" mapstructure:"exclude_files"` | |||
MonitoringFrequency time.Duration `yaml:"monitoring_frequency" mapstructure:"monitoring_frequency"` | |||
} | |||
|
|||
//nolint:govet // Tried different sequences but not able to fix the lint issue. |
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.
I think @sean-breen had a tool to help fix these I cant remember it though
Proposed changes
Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue using one of the supported keywords here in this description (not in the title of the PR).
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)