mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-02 13:34:59 +00:00
## Pull Request This PR bumps collector version to `0.144.0` by upgrading upstream contrib components. The breaking change involves change in `ServerConfig` struct which adds `NetAddr` to streamline Endpoint string and Transport type, which is new OTel convention. This change affects all the Signoz components which were using ServerConfig to adapt to new convention, and thats why affects the respective test cases. Bug fix: #773 for more info. Component Initialisation had duplicate factory registration bug in case any components had deprecated alias. Which is also fixed in this PR. ### Related Issues <!-- Reference any related issues (e.g. Fixes #123, Closes #456) --> Closes #773 ### Resource Impact **Will this change affect the application's resource usage?** - [ ] Yes - [ ] No If **Yes**, describe: - **Resources impacted:** (CPU, Memory, Disk, Network, etc.) - **Expected change:** (e.g., +10% CPU, -150MB RAM) - **Benchmarks:** Provide before/after results and how they were measured. <!-- Ideally the test should be done where you keep ingestion rate and configuration same and observe the changes in CPU, Memory, Ingestion Rate and the Lag on Kafka>
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package httplogreceiver
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"net"
|
|
"strconv"
|
|
|
|
"go.opentelemetry.io/collector/config/confighttp"
|
|
)
|
|
|
|
const (
|
|
heroku = "heroku"
|
|
google = "google"
|
|
json = "json"
|
|
)
|
|
|
|
// Config defines configuration for the https receiver.
|
|
type Config struct {
|
|
confighttp.ServerConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
|
|
|
|
Source string `mapstructure:"source"` // ex:- heroku, google etc
|
|
}
|
|
|
|
// Validate verifies that the endpoint is valid and the configured port is not 0
|
|
func (rCfg *Config) Validate() error {
|
|
if rCfg.ServerConfig.NetAddr.Endpoint == "" {
|
|
return errors.New("must specify an endpoint for the httplogreceiver")
|
|
}
|
|
|
|
// validate port
|
|
_, portStr, err := net.SplitHostPort(rCfg.ServerConfig.NetAddr.Endpoint)
|
|
if err != nil {
|
|
return fmt.Errorf("endpoint is not formatted correctly: %w", err)
|
|
}
|
|
port, err := strconv.ParseInt(portStr, 10, 0)
|
|
if err != nil {
|
|
return fmt.Errorf("endpoint port is not a number: %w", err)
|
|
}
|
|
if port < 1 || port > 65535 {
|
|
return fmt.Errorf("port number must be between 1 and 65535")
|
|
}
|
|
|
|
// validate source
|
|
if rCfg.Source != heroku && rCfg.Source != google && rCfg.Source != json && rCfg.Source != "" {
|
|
return fmt.Errorf("source must be one of %s or %s or empty", heroku, google)
|
|
}
|
|
|
|
return nil
|
|
}
|