Skip to content

Commit

Permalink
get metrics flowing to otel collector properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin committed Oct 17, 2023
1 parent d2eaa5f commit ee32445
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ type Config struct {

JWT string `mapstructure:"jwt"`

metricsEnabled bool `mapstructure:"metricsEnabled"`

Check failure on line 29 in config/config.go

View workflow job for this annotation

GitHub Actions / go / Lint

field `metricsEnabled` is unused (unused)
MetricsExporter string `mapstructure:"metricsExporter"`
MetricsEndpoint string `mapstructure:"metricsEndpoint"`
Meter string `mapstructure:"meter"`

// address of light node (ie: for receiving UTIA)
Address string `mapstructure:"address"`
Expand All @@ -42,8 +44,6 @@ type Config struct {
LogInterval time.Duration `mapstructure:"readInterval"`
DisplayInfo bool `mapstructure:"displayInfo"`

Meter string `mapstructure:"meter"`

Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
}
Expand Down Expand Up @@ -74,6 +74,8 @@ func Read() *Config {
viper.SetDefault("readInterval", DefaultReadInterval)
viper.SetDefault("infoInterval", DefaultInfoInterval)
viper.SetDefault("metricsExporter", DefaultExporter)
viper.SetDefault("metricsEndpoint", DefaultMetricsEndpoint)
viper.SetDefault("metricsEnabled", true)

_ = viper.BindEnv("jwt", "JWT")

Expand All @@ -88,6 +90,7 @@ func Read() *Config {
_ = viper.BindEnv("meter", "METER")
_ = viper.BindEnv("displayInfo", "DISPLAY_INFO")
_ = viper.BindEnv("metricsEndpoint", "METRICS_ENDPOINT")
_ = viper.BindEnv("metricsEnabled", "METRICS_ENABLED")

_ = viper.BindEnv("verbosity", "VERBOSITY")
_ = viper.BindEnv("logFormatter", "LOG_FORMATTER")
Expand Down
1 change: 1 addition & 0 deletions config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ const (
DefaultReadInterval = 1 * time.Minute
DefaultInfoInterval = 20 * time.Second
DefaultExporter = "oltphttp"
DefaultMetricsEndpoint = "0.0.0.0:4318"
)

0 comments on commit ee32445

Please sign in to comment.