diff --git a/cmd/auth/main.go b/cmd/auth/main.go index ec13547e..7f077220 100644 --- a/cmd/auth/main.go +++ b/cmd/auth/main.go @@ -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() { @@ -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 diff --git a/cmd/bootstrap/main.go b/cmd/bootstrap/main.go index b22e8c5e..cfeb84a0 100644 --- a/cmd/bootstrap/main.go +++ b/cmd/bootstrap/main.go @@ -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() { @@ -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 diff --git a/cmd/cassandra-writer/main.go b/cmd/cassandra-writer/main.go index 51316ea9..2d6fef56 100644 --- a/cmd/cassandra-writer/main.go +++ b/cmd/cassandra-writer/main.go @@ -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() { @@ -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 diff --git a/cmd/certs/main.go b/cmd/certs/main.go index 10130868..a2066b84 100644 --- a/cmd/certs/main.go +++ b/cmd/certs/main.go @@ -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"` @@ -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 diff --git a/cmd/coap/main.go b/cmd/coap/main.go index 0539362c..112ce7c1 100644 --- a/cmd/coap/main.go +++ b/cmd/coap/main.go @@ -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() { @@ -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 diff --git a/cmd/http/main.go b/cmd/http/main.go index 46dc4e18..20d3d60a 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -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() { @@ -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 diff --git a/cmd/influxdb-writer/main.go b/cmd/influxdb-writer/main.go index 36134b55..d2707d8c 100644 --- a/cmd/influxdb-writer/main.go +++ b/cmd/influxdb-writer/main.go @@ -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() { @@ -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 diff --git a/cmd/lora/main.go b/cmd/lora/main.go index 33cf00f2..6383737b 100644 --- a/cmd/lora/main.go +++ b/cmd/lora/main.go @@ -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() { @@ -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 diff --git a/cmd/mongodb-writer/main.go b/cmd/mongodb-writer/main.go index 7097a834..22058c87 100644 --- a/cmd/mongodb-writer/main.go +++ b/cmd/mongodb-writer/main.go @@ -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() { @@ -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 diff --git a/cmd/mqtt/main.go b/cmd/mqtt/main.go index 1f959eed..1559d5db 100644 --- a/cmd/mqtt/main.go +++ b/cmd/mqtt/main.go @@ -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() { @@ -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 diff --git a/cmd/opcua/main.go b/cmd/opcua/main.go index 30a8f87c..d15ea643 100644 --- a/cmd/opcua/main.go +++ b/cmd/opcua/main.go @@ -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() { @@ -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 diff --git a/cmd/postgres-writer/main.go b/cmd/postgres-writer/main.go index 8e2b5f8e..8ed60640 100644 --- a/cmd/postgres-writer/main.go +++ b/cmd/postgres-writer/main.go @@ -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() { @@ -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 diff --git a/cmd/smpp-notifier/main.go b/cmd/smpp-notifier/main.go index 069bc2eb..9359af18 100644 --- a/cmd/smpp-notifier/main.go +++ b/cmd/smpp-notifier/main.go @@ -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() { @@ -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 diff --git a/cmd/smtp-notifier/main.go b/cmd/smtp-notifier/main.go index e28e143b..24e731a3 100644 --- a/cmd/smtp-notifier/main.go +++ b/cmd/smtp-notifier/main.go @@ -45,13 +45,14 @@ const ( ) type config struct { - LogLevel string `env:"MF_SMTP_NOTIFIER_LOG_LEVEL" envDefault:"info"` - ConfigPath string `env:"MF_SMTP_NOTIFIER_CONFIG_PATH" envDefault:"/config.toml"` - From string `env:"MF_SMTP_NOTIFIER_FROM_ADDR" envDefault:""` - 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_SMTP_NOTIFIER_INSTANCE_ID" envDefault:""` + LogLevel string `env:"MF_SMTP_NOTIFIER_LOG_LEVEL" envDefault:"info"` + ConfigPath string `env:"MF_SMTP_NOTIFIER_CONFIG_PATH" envDefault:"/config.toml"` + From string `env:"MF_SMTP_NOTIFIER_FROM_ADDR" envDefault:""` + 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_SMTP_NOTIFIER_INSTANCE_ID" envDefault:""` + TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"` } func main() { @@ -102,7 +103,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 diff --git a/cmd/things/main.go b/cmd/things/main.go index be4c452f..e13e86c6 100644 --- a/cmd/things/main.go +++ b/cmd/things/main.go @@ -59,15 +59,16 @@ const ( ) type config struct { - LogLevel string `env:"MF_THINGS_LOG_LEVEL" envDefault:"info"` - StandaloneID string `env:"MF_THINGS_STANDALONE_ID" envDefault:""` - StandaloneToken string `env:"MF_THINGS_STANDALONE_TOKEN" envDefault:""` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` - CacheKeyDuration string `env:"MF_THINGS_CACHE_KEY_DURATION" envDefault:"10m"` - SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` - InstanceID string `env:"MF_THINGS_INSTANCE_ID" envDefault:""` - ESURL string `env:"MF_THINGS_ES_URL" envDefault:"redis://localhost:6379/0"` - CacheURL string `env:"MF_THINGS_CACHE_URL" envDefault:"redis://localhost:6379/0"` + LogLevel string `env:"MF_THINGS_LOG_LEVEL" envDefault:"info"` + StandaloneID string `env:"MF_THINGS_STANDALONE_ID" envDefault:""` + StandaloneToken string `env:"MF_THINGS_STANDALONE_TOKEN" envDefault:""` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` + CacheKeyDuration string `env:"MF_THINGS_CACHE_KEY_DURATION" envDefault:"10m"` + SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` + InstanceID string `env:"MF_THINGS_INSTANCE_ID" envDefault:""` + ESURL string `env:"MF_THINGS_ES_URL" envDefault:"redis://localhost:6379/0"` + CacheURL string `env:"MF_THINGS_CACHE_URL" envDefault:"redis://localhost:6379/0"` + TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"` } func main() { @@ -113,7 +114,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 diff --git a/cmd/timescale-writer/main.go b/cmd/timescale-writer/main.go index af2163eb..29d75870 100644 --- a/cmd/timescale-writer/main.go +++ b/cmd/timescale-writer/main.go @@ -39,12 +39,13 @@ const ( ) type config struct { - LogLevel string `env:"MF_TIMESCALE_WRITER_LOG_LEVEL" envDefault:"info"` - ConfigPath string `env:"MF_TIMESCALE_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_TIMESCALE_WRITER_INSTANCE_ID" envDefault:""` + LogLevel string `env:"MF_TIMESCALE_WRITER_LOG_LEVEL" envDefault:"info"` + ConfigPath string `env:"MF_TIMESCALE_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_TIMESCALE_WRITER_INSTANCE_ID" envDefault:""` + TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"` } func main() { @@ -88,7 +89,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 diff --git a/cmd/twins/main.go b/cmd/twins/main.go index 4221cba0..ee871b26 100644 --- a/cmd/twins/main.go +++ b/cmd/twins/main.go @@ -46,16 +46,17 @@ const ( ) type config struct { - LogLevel string `env:"MF_TWINS_LOG_LEVEL" envDefault:"info"` - StandaloneID string `env:"MF_TWINS_STANDALONE_ID" envDefault:""` - StandaloneToken string `env:"MF_TWINS_STANDALONE_TOKEN" envDefault:""` - ChannelID string `env:"MF_TWINS_CHANNEL_ID" envDefault:""` - 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_TWINS_INSTANCE_ID" envDefault:""` - ESURL string `env:"MF_TWINS_ES_URL" envDefault:"redis://localhost:6379/0"` - CacheURL string `env:"MF_TWINS_CACHE_URL" envDefault:"redis://localhost:6379/0"` + LogLevel string `env:"MF_TWINS_LOG_LEVEL" envDefault:"info"` + StandaloneID string `env:"MF_TWINS_STANDALONE_ID" envDefault:""` + StandaloneToken string `env:"MF_TWINS_STANDALONE_TOKEN" envDefault:""` + ChannelID string `env:"MF_TWINS_CHANNEL_ID" envDefault:""` + 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_TWINS_INSTANCE_ID" envDefault:""` + ESURL string `env:"MF_TWINS_ES_URL" envDefault:"redis://localhost:6379/0"` + CacheURL string `env:"MF_TWINS_CACHE_URL" envDefault:"redis://localhost:6379/0"` + TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"` } func main() { @@ -105,7 +106,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 diff --git a/cmd/users/main.go b/cmd/users/main.go index 0315e726..74eb8288 100644 --- a/cmd/users/main.go +++ b/cmd/users/main.go @@ -56,18 +56,19 @@ const ( ) type config struct { - LogLevel string `env:"MF_USERS_LOG_LEVEL" envDefault:"info"` - SecretKey string `env:"MF_USERS_SECRET_KEY" envDefault:"secret"` - AdminEmail string `env:"MF_USERS_ADMIN_EMAIL" envDefault:""` - AdminPassword string `env:"MF_USERS_ADMIN_PASSWORD" envDefault:""` - PassRegexText string `env:"MF_USERS_PASS_REGEX" envDefault:"^.{8,}$"` - AccessDuration string `env:"MF_USERS_ACCESS_TOKEN_DURATION" envDefault:"15m"` - RefreshDuration string `env:"MF_USERS_REFRESH_TOKEN_DURATION" envDefault:"24h"` - ResetURL string `env:"MF_TOKEN_RESET_ENDPOINT" envDefault:"/reset-request"` - JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` - SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` - InstanceID string `env:"MF_USERS_INSTANCE_ID" envDefault:""` - ESURL string `env:"MF_USERS_ES_URL" envDefault:"redis://localhost:6379/0"` + LogLevel string `env:"MF_USERS_LOG_LEVEL" envDefault:"info"` + SecretKey string `env:"MF_USERS_SECRET_KEY" envDefault:"secret"` + AdminEmail string `env:"MF_USERS_ADMIN_EMAIL" envDefault:""` + AdminPassword string `env:"MF_USERS_ADMIN_PASSWORD" envDefault:""` + PassRegexText string `env:"MF_USERS_PASS_REGEX" envDefault:"^.{8,}$"` + AccessDuration string `env:"MF_USERS_ACCESS_TOKEN_DURATION" envDefault:"15m"` + RefreshDuration string `env:"MF_USERS_REFRESH_TOKEN_DURATION" envDefault:"24h"` + ResetURL string `env:"MF_TOKEN_RESET_ENDPOINT" envDefault:"/reset-request"` + JaegerURL string `env:"MF_JAEGER_URL" envDefault:"http://jaeger:14268/api/traces"` + SendTelemetry bool `env:"MF_SEND_TELEMETRY" envDefault:"true"` + InstanceID string `env:"MF_USERS_INSTANCE_ID" envDefault:""` + ESURL string `env:"MF_USERS_ES_URL" envDefault:"redis://localhost:6379/0"` + TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"` PassRegex *regexp.Regexp } @@ -126,7 +127,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 diff --git a/cmd/ws/main.go b/cmd/ws/main.go index d2d28049..5cc6c0c6 100644 --- a/cmd/ws/main.go +++ b/cmd/ws/main.go @@ -41,11 +41,12 @@ const ( ) type config struct { - LogLevel string `env:"MF_WS_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_WS_ADAPTER_INSTANCE_ID" envDefault:""` + LogLevel string `env:"MF_WS_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_WS_ADAPTER_INSTANCE_ID" envDefault:""` + TraceRatio float64 `env:"MF_JAEGER_TRACE_RATIO" envDefault:"1.0"` } func main() { @@ -95,7 +96,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 diff --git a/docker/.env b/docker/.env index c1100ec6..f46a1bb7 100644 --- a/docker/.env +++ b/docker/.env @@ -61,10 +61,14 @@ MF_JAEGER_FRONTEND=16686 MF_JAEGER_COLLECTOR=14268 MF_JAEGER_CONFIGS=5778 MF_JAEGER_URL=http://jaeger:14268/api/traces +MF_JAEGER_TRACE_RATIO=1.0 ## Call home MF_SEND_TELEMETRY=true +## Postgres +MF_POSTGRES_MAX_CONNECTIONS=100 + ## Core Services ### Auth diff --git a/docker/addons/bootstrap/docker-compose.yml b/docker/addons/bootstrap/docker-compose.yml index 1383aa91..f6b27c17 100644 --- a/docker/addons/bootstrap/docker-compose.yml +++ b/docker/addons/bootstrap/docker-compose.yml @@ -62,6 +62,7 @@ services: MF_AUTH_GRPC_SERVER_CA_CERTS: ${MF_AUTH_GRPC_SERVER_CA_CERTS:+/users-grpc-server-ca.crt} MF_THINGS_URL: ${MF_THINGS_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_BOOTSTRAP_INSTANCE_ID: ${MF_BOOTSTRAP_INSTANCE_ID} networks: diff --git a/docker/addons/cassandra-writer/docker-compose.yml b/docker/addons/cassandra-writer/docker-compose.yml index ecf2788d..48320e31 100644 --- a/docker/addons/cassandra-writer/docker-compose.yml +++ b/docker/addons/cassandra-writer/docker-compose.yml @@ -57,6 +57,7 @@ services: MF_CASSANDRA_PASS: ${MF_CASSANDRA_PASS} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_CASSANDRA_WRITER_INSANCE_ID: ${MF_CASSANDRA_WRITER_INSANCE_ID} ports: diff --git a/docker/addons/certs/docker-compose.yml b/docker/addons/certs/docker-compose.yml index fd60153f..5dca8258 100644 --- a/docker/addons/certs/docker-compose.yml +++ b/docker/addons/certs/docker-compose.yml @@ -69,6 +69,7 @@ services: MF_AUTH_GRPC_SERVER_CA_CERTS: ${MF_AUTH_GRPC_SERVER_CA_CERTS:+/users-grpc-server-ca.crt} MF_THINGS_URL: ${MF_THINGS_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_CERTS_INSTANCE_ID: ${MF_CERTS_INSTANCE_ID} volumes: diff --git a/docker/addons/influxdb-writer/docker-compose.yml b/docker/addons/influxdb-writer/docker-compose.yml index 9311b072..07d142e6 100644 --- a/docker/addons/influxdb-writer/docker-compose.yml +++ b/docker/addons/influxdb-writer/docker-compose.yml @@ -63,6 +63,7 @@ services: MF_INFLUXDB_INSECURE_SKIP_VERIFY: ${MF_INFLUXDB_INSECURE_SKIP_VERIFY} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_INFLUX_WRITER_INSTANCE_ID: ${MF_INFLUX_WRITER_INSTANCE_ID} ports: diff --git a/docker/addons/lora-adapter/docker-compose.yml b/docker/addons/lora-adapter/docker-compose.yml index 99ab3cc7..84a3865d 100644 --- a/docker/addons/lora-adapter/docker-compose.yml +++ b/docker/addons/lora-adapter/docker-compose.yml @@ -39,6 +39,7 @@ services: MF_LORA_ADAPTER_ES_URL: ${MF_ES_STORE_URL} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_LORA_ADAPTER_INSTANCE_ID: ${MF_LORA_ADAPTER_INSTANCE_ID} ports: diff --git a/docker/addons/mongodb-writer/docker-compose.yml b/docker/addons/mongodb-writer/docker-compose.yml index 3d85d6e1..b409a4b1 100644 --- a/docker/addons/mongodb-writer/docker-compose.yml +++ b/docker/addons/mongodb-writer/docker-compose.yml @@ -50,6 +50,7 @@ services: MF_MONGO_NAME: ${MF_MONGO_NAME} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_MONGO_WRITER_INSTANCE_ID: ${MF_MONGO_WRITER_INSTANCE_ID} ports: diff --git a/docker/addons/opcua-adapter/docker-compose.yml b/docker/addons/opcua-adapter/docker-compose.yml index 7bdfe44b..e79b2859 100644 --- a/docker/addons/opcua-adapter/docker-compose.yml +++ b/docker/addons/opcua-adapter/docker-compose.yml @@ -40,6 +40,7 @@ services: MF_OPCUA_ADAPTER_ROUTE_MAP_URL: ${MF_OPCUA_ADAPTER_ROUTE_MAP_URL} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_OPCUA_ADAPTER_INSTANCE_ID: ${MF_OPCUA_ADAPTER_INSTANCE_ID} ports: diff --git a/docker/addons/postgres-writer/docker-compose.yml b/docker/addons/postgres-writer/docker-compose.yml index 511b9964..a612bbfa 100644 --- a/docker/addons/postgres-writer/docker-compose.yml +++ b/docker/addons/postgres-writer/docker-compose.yml @@ -54,6 +54,7 @@ services: MF_POSTGRES_SSL_ROOT_CERT: ${MF_POSTGRES_SSL_ROOT_CERT} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_POSTGRES_WRITER_INSTANCE_ID: ${MF_POSTGRES_WRITER_INSTANCE_ID} ports: diff --git a/docker/addons/smpp-notifier/docker-compose.yml b/docker/addons/smpp-notifier/docker-compose.yml index 1ee04837..9f37da8f 100644 --- a/docker/addons/smpp-notifier/docker-compose.yml +++ b/docker/addons/smpp-notifier/docker-compose.yml @@ -66,6 +66,7 @@ services: MF_AUTH_GRPC_SERVER_CA_CERTS: ${MF_AUTH_GRPC_SERVER_CA_CERTS:+/users-grpc-server-ca.crt} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_SMPP_NOTIFIER_INSTANCE_ID: ${MF_SMPP_NOTIFIER_INSTANCE_ID} ports: diff --git a/docker/addons/smtp-notifier/docker-compose.yml b/docker/addons/smtp-notifier/docker-compose.yml index c1aa6db3..1fc1a882 100644 --- a/docker/addons/smtp-notifier/docker-compose.yml +++ b/docker/addons/smtp-notifier/docker-compose.yml @@ -65,6 +65,7 @@ services: MF_EMAIL_TEMPLATE: ${MF_SMTP_NOTIFIER_EMAIL_TEMPLATE} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_SMTP_NOTIFIER_INSTANCE_ID: ${MF_SMTP_NOTIFIER_INSTANCE_ID} ports: diff --git a/docker/addons/timescale-writer/docker-compose.yml b/docker/addons/timescale-writer/docker-compose.yml index 77ea573f..6803691f 100644 --- a/docker/addons/timescale-writer/docker-compose.yml +++ b/docker/addons/timescale-writer/docker-compose.yml @@ -54,6 +54,7 @@ services: MF_TIMESCALE_SSL_ROOT_CERT: ${MF_TIMESCALE_SSL_ROOT_CERT} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_TIMESCALE_WRITER_INSTANCE_ID: ${MF_TIMESCALE_WRITER_INSTANCE_ID} ports: diff --git a/docker/addons/twins/docker-compose.yml b/docker/addons/twins/docker-compose.yml index eb93683d..20d37d59 100644 --- a/docker/addons/twins/docker-compose.yml +++ b/docker/addons/twins/docker-compose.yml @@ -64,6 +64,8 @@ services: MF_AUTH_GRPC_CLIENT_KEY: ${MF_AUTH_GRPC_CLIENT_KEY:+/users-grpc-client.key} MF_AUTH_GRPC_SERVER_CA_CERTS: ${MF_AUTH_GRPC_SERVER_CA_CERTS:+/users-grpc-server-ca.crt} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} + MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_TWINS_INSTANCE_ID: ${MF_TWINS_INSTANCE_ID} ports: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 325331c6..1833daa9 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -149,10 +149,12 @@ services: image: postgres:13.3-alpine container_name: mainflux-things-db restart: on-failure + command: postgres -c "max_connections=${MF_POSTGRES_MAX_CONNECTIONS}" environment: POSTGRES_USER: ${MF_THINGS_DB_USER} POSTGRES_PASSWORD: ${MF_THINGS_DB_PASS} POSTGRES_DB: ${MF_THINGS_DB_NAME} + MF_POSTGRES_MAX_CONNECTIONS: ${MF_POSTGRES_MAX_CONNECTIONS} networks: - mainflux-base-net ports: @@ -209,6 +211,7 @@ services: MF_AUTH_GRPC_CLIENT_KEY: ${MF_AUTH_GRPC_CLIENT_KEY:+/users-grpc-client.key} MF_AUTH_GRPC_SERVER_CA_CERTS: ${MF_AUTH_GRPC_SERVER_CA_CERTS:+/users-grpc-server-ca.crt} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} ports: - ${MF_THINGS_HTTP_PORT}:${MF_THINGS_HTTP_PORT} @@ -258,12 +261,12 @@ services: image: postgres:15.1-alpine container_name: mainflux-users-db restart: on-failure + command: postgres -c "max_connections=${MF_POSTGRES_MAX_CONNECTIONS}" environment: POSTGRES_USER: ${MF_USERS_DB_USER} POSTGRES_PASSWORD: ${MF_USERS_DB_PASS} POSTGRES_DB: ${MF_USERS_DB_NAME} - ports: - - 6005:5432 + MF_POSTGRES_MAX_CONNECTIONS: ${MF_POSTGRES_MAX_CONNECTIONS} networks: - mainflux-base-net volumes: @@ -312,6 +315,7 @@ services: MF_EMAIL_TEMPLATE: ${MF_EMAIL_TEMPLATE} MF_USERS_ES_URL: ${MF_ES_STORE_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_AUTH_GRPC_URL: ${MF_AUTH_GRPC_URL} MF_AUTH_GRPC_TIMEOUT: ${MF_AUTH_GRPC_TIMEOUT} @@ -383,6 +387,7 @@ services: MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS: ${MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS:+/things-grpc-server-ca.crt} MF_JAEGER_URL: ${MF_JAEGER_URL} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} networks: - mainflux-base-net @@ -424,6 +429,7 @@ services: MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS: ${MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS:+/things-grpc-server-ca.crt} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_HTTP_ADAPTER_INSTANCE_ID: ${MF_HTTP_ADAPTER_INSTANCE_ID} ports: @@ -472,6 +478,7 @@ services: MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS: ${MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS:+/things-grpc-server-ca.crt} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_COAP_ADAPTER_INSTANCE_ID: ${MF_COAP_ADAPTER_INSTANCE_ID} ports: @@ -517,6 +524,7 @@ services: MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS: ${MF_THINGS_AUTH_GRPC_SERVER_CA_CERTS:+/things-grpc-server-ca.crt} MF_MESSAGE_BROKER_URL: ${MF_MESSAGE_BROKER_URL} MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_JAEGER_TRACE_RATIO: ${MF_JAEGER_TRACE_RATIO} MF_SEND_TELEMETRY: ${MF_SEND_TELEMETRY} MF_WS_ADAPTER_INSTANCE_ID: ${MF_WS_ADAPTER_INSTANCE_ID} ports: diff --git a/internal/clients/jaeger/provider.go b/internal/clients/jaeger/provider.go index 691ea6c9..2bcf72dc 100644 --- a/internal/clients/jaeger/provider.go +++ b/internal/clients/jaeger/provider.go @@ -21,7 +21,7 @@ var ( ) // NewProvider initializes Jaeger TraceProvider. -func NewProvider(svcName, url, instanceID string) (*tracesdk.TracerProvider, error) { +func NewProvider(svcName, url, instanceID string, fraction float64) (*tracesdk.TracerProvider, error) { if url == "" { return nil, errNoURL } @@ -47,7 +47,7 @@ func NewProvider(svcName, url, instanceID string) (*tracesdk.TracerProvider, err attributes = append(attributes, hostAttr.Attributes()...) tp := tracesdk.NewTracerProvider( - tracesdk.WithSampler(tracesdk.AlwaysSample()), + tracesdk.WithSampler(tracesdk.TraceIDRatioBased(fraction)), tracesdk.WithBatcher(exporter), tracesdk.WithResource(resource.NewWithAttributes( semconv.SchemaURL,