Skip to content

Commit

Permalink
Add region to sematextexporter config
Browse files Browse the repository at this point in the history
  • Loading branch information
AkhigbeEromo committed Oct 4, 2024
1 parent 56075f9 commit 6cad40b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions exporter/sematextexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type Config struct {
// Sensitive data (app_token) should use configopaque.String for security.
App_token configopaque.String `mapstructure:"app_token"`

// Region specifies the Sematext region the user is operating in, helping route requests to the appropriate data center.
Region string `mapstructure:"region"`

// MetricsSchema indicates the metrics schema to emit to line protocol.
// Options:
// - otel-v1
Expand All @@ -36,5 +39,12 @@ func (cfg *Config) Validate() error {
if cfg.MetricsSchema != "otel-v1" {
return fmt.Errorf("invalid metrics schema: %s", cfg.MetricsSchema)
}
if cfg.Region != "EU" && cfg.Region != "US" {
fmt.Println("Error: Invalid region. Please use either 'EU' or 'US'.")
}
if cfg.App_token.String() == "" {
return fmt.Errorf("app_token is required")
}

return nil
}

2 comments on commit 6cad40b

@otisg
Copy link
Member

@otisg otisg commented on 6cad40b Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eromosele-SM App tokens have a certain fixed length. You could check for that instead of checking for "", which won't work well if one has a hard to see space for the App token, or one missed a character when copy-pasting the App token from somewhere.

@otisg
Copy link
Member

@otisg otisg commented on 6cad40b Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off the top of my head - 32. But you will see it in the SC UI - look at any App's screen for sending data, it should be listed there.

Please sign in to comment.