Skip to content

Commit

Permalink
MF - 1758 - Sync With Benchmark Testing (#1912)
Browse files Browse the repository at this point in the history
* feat(docker): add trace ration and max conn

This adds a new environment variable `MF_JAEGER_TRACE_RATIO` to the `docker/.env` file. The variable is used to set the ratio of requests traced.

Additionally, this commit also adds a new environment variable `MF_POSTGRES_MAX_CONNECTIONS` for configuring the maximum number of connections for the Postgres database.

These changes are made to enhance the configuration and scalability of the core services.

Signed-off-by: Rodney Osodo <[email protected]>

* Remove comment to trace ratio

Signed-off-by: rodneyosodo <[email protected]>

* Reduce postgres max connection to 100

Signed-off-by: rodneyosodo <[email protected]>

---------

Signed-off-by: Rodney Osodo <[email protected]>
Signed-off-by: rodneyosodo <[email protected]>
  • Loading branch information
rodneyosodo authored Oct 24, 2023
1 parent 43a263d commit 8b185d2
Show file tree
Hide file tree
Showing 34 changed files with 189 additions and 145 deletions.
23 changes: 12 additions & 11 deletions cmd/auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,17 @@ const (
)

type config struct {
LogLevel string `env:"MF_AUTH_LOG_LEVEL" envDefault:"info"`
SecretKey string `env:"MF_AUTH_SECRET_KEY" envDefault:"secret"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_AUTH_ADAPTER_INSTANCE_ID" envDefault:""`
AccessDuration string `env:"MF_AUTH_ACCESS_TOKEN_DURATION" envDefault:"30m"`
RefreshDuration string `env:"MF_AUTH_REFRESH_TOKEN_DURATION" envDefault:"24h"`
SpicedbHost string `env:"MF_SPICEDB_HOST" envDefault:"localhost"`
SpicedbPort string `env:"MF_SPICEDB_PORT" envDefault:"50051"`
SpicedbSchemaFile string `env:"MF_SPICEDB_SCHEMA_FILE" envDefault:"./docker/spicedb/schema.zed"`
LogLevel string `env:"MF_AUTH_LOG_LEVEL" envDefault:"info"`
SecretKey string `env:"MF_AUTH_SECRET_KEY" envDefault:"secret"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_AUTH_ADAPTER_INSTANCE_ID" envDefault:""`
AccessDuration string `env:"MF_AUTH_ACCESS_TOKEN_DURATION" envDefault:"30m"`
RefreshDuration string `env:"MF_AUTH_REFRESH_TOKEN_DURATION" envDefault:"24h"`
SpicedbHost string `env:"MF_SPICEDB_HOST" envDefault:"localhost"`
SpicedbPort string `env:"MF_SPICEDB_PORT" envDefault:"50051"`
SpicedbSchemaFile string `env:"MF_SPICEDB_SCHEMA_FILE" envDefault:"./docker/spicedb/schema.zed"`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -102,7 +103,7 @@ func main() {
}
defer db.Close()

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
19 changes: 10 additions & 9 deletions cmd/bootstrap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ const (
)

type config struct {
LogLevel string `env:"MF_BOOTSTRAP_LOG_LEVEL" envDefault:"info"`
EncKey string `env:"MF_BOOTSTRAP_ENCRYPT_KEY" envDefault:"12345678910111213141516171819202"`
ESConsumerName string `env:"MF_BOOTSTRAP_EVENT_CONSUMER" envDefault:"bootstrap"`
ThingsURL string `env:"MF_THINGS_URL" envDefault:"http://localhost:9000"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_BOOTSTRAP_INSTANCE_ID" envDefault:""`
ESURL string `env:"MF_BOOTSTRAP_ES_URL" envDefault:"redis://localhost:6379/0"`
LogLevel string `env:"MF_BOOTSTRAP_LOG_LEVEL" envDefault:"info"`
EncKey string `env:"MF_BOOTSTRAP_ENCRYPT_KEY" envDefault:"12345678910111213141516171819202"`
ESConsumerName string `env:"MF_BOOTSTRAP_EVENT_CONSUMER" envDefault:"bootstrap"`
ThingsURL string `env:"MF_THINGS_URL" envDefault:"http://localhost:9000"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_BOOTSTRAP_INSTANCE_ID" envDefault:""`
ESURL string `env:"MF_BOOTSTRAP_ES_URL" envDefault:"redis://localhost:6379/0"`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -104,7 +105,7 @@ func main() {
defer authHandler.Close()
logger.Info("Successfully connected to auth grpc server " + authHandler.Secure())

tp, err := jaeger.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaeger.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
15 changes: 8 additions & 7 deletions cmd/cassandra-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ const (
)

type config struct {
LogLevel string `env:"MF_CASSANDRA_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_CASSANDRA_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_CASSANDRA_WRITER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_CASSANDRA_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_CASSANDRA_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_CASSANDRA_WRITER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -88,7 +89,7 @@ func main() {
}
defer csdSession.Close()

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
15 changes: 8 additions & 7 deletions cmd/certs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ const (
)

type config struct {
LogLevel string `env:"MF_CERTS_LOG_LEVEL" envDefault:"info"`
CertsURL string `env:"MF_SDK_CERTS_URL" envDefault:"http://localhost"`
ThingsURL string `env:"MF_THINGS_URL" envDefault:"http://things:9000"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_CERTS_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_CERTS_LOG_LEVEL" envDefault:"info"`
CertsURL string `env:"MF_SDK_CERTS_URL" envDefault:"http://localhost"`
ThingsURL string `env:"MF_THINGS_URL" envDefault:"http://things:9000"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_CERTS_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`

// Sign and issue certificates without 3rd party PKI
SignCAPath string `env:"MF_CERTS_SIGN_CA_PATH" envDefault:"ca.crt"`
Expand Down Expand Up @@ -120,7 +121,7 @@ func main() {

logger.Info("Successfully connected to auth grpc server " + authHandler.Secure())

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
13 changes: 7 additions & 6 deletions cmd/coap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ const (
)

type config struct {
LogLevel string `env:"MF_COAP_ADAPTER_LOG_LEVEL" envDefault:"info"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_COAP_ADAPTER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_COAP_ADAPTER_LOG_LEVEL" envDefault:"info"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_COAP_ADAPTER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -94,7 +95,7 @@ func main() {

logger.Info("Successfully connected to things grpc server " + aHandler.Secure())

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
13 changes: 7 additions & 6 deletions cmd/http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ const (
)

type config struct {
LogLevel string `env:"MF_HTTP_ADAPTER_LOG_LEVEL" envDefault:"info"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_HTTP_ADAPTER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_HTTP_ADAPTER_LOG_LEVEL" envDefault:"info"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_HTTP_ADAPTER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -91,7 +92,7 @@ func main() {

logger.Info("Successfully connected to things grpc server " + aHandler.Secure())

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
15 changes: 8 additions & 7 deletions cmd/influxdb-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ const (
)

type config struct {
LogLevel string `env:"MF_INFLUX_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_INFLUX_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_INFLUX_WRITER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_INFLUX_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_INFLUX_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_INFLUX_WRITER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -76,7 +77,7 @@ func main() {
return
}

tp, err := jaeger.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaeger.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
3 changes: 2 additions & 1 deletion cmd/lora/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type config struct {
InstanceID string `env:"MF_LORA_ADAPTER_INSTANCE_ID" envDefault:""`
ESURL string `env:"MF_LORA_ADAPTER_ES_URL" envDefault:"redis://localhost:6379/0"`
RouteMapURL string `env:"MF_LORA_ADAPTER_ROUTE_MAP_URL" envDefault:"redis://localhost:6379/0"`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -101,7 +102,7 @@ func main() {
}
defer rmConn.Close()

tp, err := jaeger.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaeger.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
15 changes: 8 additions & 7 deletions cmd/mongodb-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ const (
)

type config struct {
LogLevel string `env:"MF_MONGO_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_MONGO_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_MONGO_WRITER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_MONGO_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_MONGO_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_MONGO_WRITER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -78,7 +79,7 @@ func main() {
return
}

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
3 changes: 2 additions & 1 deletion cmd/mqtt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type config struct {
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_MQTT_ADAPTER_INSTANCE_ID" envDefault:""`
ESURL string `env:"MF_MQTT_ADAPTER_ES_URL" envDefault:"redis://localhost:6379/0"`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -101,7 +102,7 @@ func main() {
Port: cfg.HTTPTargetPort,
}

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
19 changes: 10 additions & 9 deletions cmd/opcua/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ const (
)

type config struct {
LogLevel string `env:"MF_OPCUA_ADAPTER_LOG_LEVEL" envDefault:"info"`
ESConsumerName string `env:"MF_OPCUA_ADAPTER_EVENT_CONSUMER" envDefault:"opcua-adapter"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_OPCUA_ADAPTER_INSTANCE_ID" envDefault:""`
ESURL string `env:"MF_OPCUA_ADAPTER_ES_URL" envDefault:"redis://localhost:6379/0"`
RouteMapURL string `env:"MF_OPCUA_ADAPTER_ROUTE_MAP_URL" envDefault:"redis://localhost:6379/0"`
LogLevel string `env:"MF_OPCUA_ADAPTER_LOG_LEVEL" envDefault:"info"`
ESConsumerName string `env:"MF_OPCUA_ADAPTER_EVENT_CONSUMER" envDefault:"opcua-adapter"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_OPCUA_ADAPTER_INSTANCE_ID" envDefault:""`
ESURL string `env:"MF_OPCUA_ADAPTER_ES_URL" envDefault:"redis://localhost:6379/0"`
RouteMapURL string `env:"MF_OPCUA_ADAPTER_ROUTE_MAP_URL" envDefault:"redis://localhost:6379/0"`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -104,7 +105,7 @@ func main() {
chanRM := newRouteMapRepositoy(rmConn, channelsRMPrefix, logger)
connRM := newRouteMapRepositoy(rmConn, connectionRMPrefix, logger)

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
15 changes: 8 additions & 7 deletions cmd/postgres-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ const (
)

type config struct {
LogLevel string `env:"MF_POSTGRES_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_POSTGRES_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_POSTGRES_WRITER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_POSTGRES_WRITER_LOG_LEVEL" envDefault:"info"`
ConfigPath string `env:"MF_POSTGRES_WRITER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_POSTGRES_WRITER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -86,7 +87,7 @@ func main() {
}
defer db.Close()

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
17 changes: 9 additions & 8 deletions cmd/smpp-notifier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ const (
)

type config struct {
LogLevel string `env:"MF_SMPP_NOTIFIER_LOG_LEVEL" envDefault:"info"`
From string `env:"MF_SMPP_NOTIFIER_FROM_ADDR" envDefault:""`
ConfigPath string `env:"MF_SMPP_NOTIFIER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_SMPP_NOTIFIER_INSTANCE_ID" envDefault:""`
LogLevel string `env:"MF_SMPP_NOTIFIER_LOG_LEVEL" envDefault:"info"`
From string `env:"MF_SMPP_NOTIFIER_FROM_ADDR" envDefault:""`
ConfigPath string `env:"MF_SMPP_NOTIFIER_CONFIG_PATH" envDefault:"/config.toml"`
BrokerURL string `env:"MF_MESSAGE_BROKER_URL" envDefault:"nats://localhost:4222"`
JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"`
SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MF_SMPP_NOTIFIER_INSTANCE_ID" envDefault:""`
TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"`
}

func main() {
Expand Down Expand Up @@ -99,7 +100,7 @@ func main() {
return
}

tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID)
tp, err := jaegerclient.NewProvider(svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio)
if err != nil {
logger.Error(fmt.Sprintf("Failed to init Jaeger: %s", err))
exitCode = 1
Expand Down
Loading

0 comments on commit 8b185d2

Please sign in to comment.