diff --git a/.github/workflows/push-docker-arm64.yaml b/.github/workflows/push-docker-arm64.yaml index 8c4fc03da..23f696a57 100644 --- a/.github/workflows/push-docker-arm64.yaml +++ b/.github/workflows/push-docker-arm64.yaml @@ -15,6 +15,7 @@ on: jobs: arm64: + if: false uses: ./.github/workflows/push-docker-image.yaml secrets: inherit with: diff --git a/.golangci.yaml b/.golangci.yaml index a164e7019..d8280bb9b 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -2,6 +2,8 @@ linters: enable-all: true disable: # Work on fixing this + - nakedret + - depguard - reassign - interfacebloat - maintidx diff --git a/cmd/consistency/workload/document.go b/cmd/consistency/workload/document.go index 7836d5823..725a88ea5 100644 --- a/cmd/consistency/workload/document.go +++ b/cmd/consistency/workload/document.go @@ -30,7 +30,7 @@ type IDocument interface { type Document struct { Id int64 `json:"id"` - F2 string `json:"F2" fake:"{sentence:50}"` + F2 string `fake:"{sentence:50}" json:"F2"` F3 []byte F4 uuid.UUID F5 time.Time @@ -65,40 +65,40 @@ func Deserialize(raw []byte, doc any) error { } type Address struct { - City string `json:"city" fake:"{city}"` - State string `json:"state" fake:"{state}"` - Country string `json:"country" fake:"{country}"` + City string `fake:"{city}" json:"city"` + State string `fake:"{state}" json:"state"` + Country string `fake:"{country}" json:"country"` } type Nested struct { - Timestamp int64 `json:"timestamp" fake:"{nanosecond}"` - Random string `json:"random" fake:"{paragraph:10,10,50}"` - Random1 string `json:"random1" fake:"{paragraph:10,10,50}"` - Random2 string `json:"random2" fake:"{paragraph:10,10,50}"` - Random3 string `json:"random3" fake:"{paragraph:10,10,50}"` - Random4 string `json:"random4" fake:"{paragraph:10,10,50}"` - Random5 string `json:"random5" fake:"{paragraph:10,10,50}"` - Random6 string `json:"random6" fake:"{paragraph:10,10,50}"` - Random7 string `json:"random7" fake:"{paragraph:10,10,50}"` - Random8 string `json:"random8" fake:"{paragraph:10,10,50}"` - Random9 string `json:"random9" fake:"{paragraph:10,10,50}"` - Random10 string `json:"random10" fake:"{paragraph:10,10,50}"` - Name string `json:"name" fake:"{paragraph:10,10,50}"` - URL string `json:"url" fake:"{paragraph:10,10,50}"` - Domain string `json:"domain" fake:"{sentence:50}"` - Sentence string `json:"sentence" fake:"{paragraph:10,10,50}"` - Company string `json:"company" fake:"{paragraph:10,10,50}"` - Labels []string `json:"labels" fakesize:"20000"` + Timestamp int64 `fake:"{nanosecond}" json:"timestamp"` + Random string `fake:"{paragraph:10,10,50}" json:"random"` + Random1 string `fake:"{paragraph:10,10,50}" json:"random1"` + Random2 string `fake:"{paragraph:10,10,50}" json:"random2"` + Random3 string `fake:"{paragraph:10,10,50}" json:"random3"` + Random4 string `fake:"{paragraph:10,10,50}" json:"random4"` + Random5 string `fake:"{paragraph:10,10,50}" json:"random5"` + Random6 string `fake:"{paragraph:10,10,50}" json:"random6"` + Random7 string `fake:"{paragraph:10,10,50}" json:"random7"` + Random8 string `fake:"{paragraph:10,10,50}" json:"random8"` + Random9 string `fake:"{paragraph:10,10,50}" json:"random9"` + Random10 string `fake:"{paragraph:10,10,50}" json:"random10"` + Name string `fake:"{paragraph:10,10,50}" json:"name"` + URL string `fake:"{paragraph:10,10,50}" json:"url"` + Domain string `fake:"{sentence:50}" json:"domain"` + Sentence string `fake:"{paragraph:10,10,50}" json:"sentence"` + Company string `fake:"{paragraph:10,10,50}" json:"company"` + Labels []string `fakesize:"20000" json:"labels"` Address Address `json:"address"` - NestedId string `json:"nested_id" fake:"{uuid}"` + NestedId string `fake:"{uuid}" json:"nested_id"` } type DocumentV1 struct { Id int64 `json:"id"` - Cars []string `json:"cars" fake:"{carmaker}" fakesize:"20000"` - Food []string `json:"food" fake:"{food}" fakesize:"20000"` - CreatedAt time.Time `json:"created_at" fake:"{date}"` - UpdatedAt time.Time `json:"updated_at" fake:"{date}"` + Cars []string `fake:"{carmaker}" fakesize:"20000" json:"cars"` + Food []string `fake:"{food}" fakesize:"20000" json:"food"` + CreatedAt time.Time `fake:"{date}" json:"created_at"` + UpdatedAt time.Time `fake:"{date}" json:"updated_at"` Nested *Nested `json:"nested"` } diff --git a/server/config/options.go b/server/config/options.go index 727b516d2..4c0df5498 100644 --- a/server/config/options.go +++ b/server/config/options.go @@ -29,279 +29,279 @@ const ( type ServerConfig struct { Host string Port int16 - Type string `mapstructure:"type" yaml:"type" json:"type"` - FDBHardDrop bool `mapstructure:"fdb_hard_drop" yaml:"fdb_hard_drop" json:"fdb_hard_drop"` - RealtimePort int16 `mapstructure:"realtime_port" yaml:"realtime_port" json:"realtime_port"` + Type string `json:"type" mapstructure:"type" yaml:"type"` + FDBHardDrop bool `json:"fdb_hard_drop" mapstructure:"fdb_hard_drop" yaml:"fdb_hard_drop"` + RealtimePort int16 `json:"realtime_port" mapstructure:"realtime_port" yaml:"realtime_port"` } type Config struct { Log log.LogConfig - Server ServerConfig `yaml:"server" json:"server"` - Auth AuthConfig `yaml:"auth" json:"auth"` - MetadataCluster ClusterConfig `mapstructure:"metadata_cluster" yaml:"metadata_cluster" json:"metadata_cluster"` - Billing Billing `yaml:"billing" json:"billing"` - Cdc CdcConfig `yaml:"cdc" json:"cdc"` - Search SearchConfig `yaml:"search" json:"search"` - KV KVConfig `yaml:"kv" json:"kv"` - SecondaryIndex SecondaryIndexConfig `mapstructure:"secondary_index" yaml:"secondary_index" json:"secondary_index"` - Workers WorkersConfig `yaml:"workers" json:"workers"` - Cache CacheConfig `yaml:"cache" json:"cache"` - Tracing TracingConfig `yaml:"tracing" json:"tracing"` - Metrics MetricsConfig `yaml:"metrics" json:"metrics"` - Profiling ProfilingConfig `yaml:"profiling" json:"profiling"` + Server ServerConfig `json:"server" yaml:"server"` + Auth AuthConfig `json:"auth" yaml:"auth"` + MetadataCluster ClusterConfig `json:"metadata_cluster" mapstructure:"metadata_cluster" yaml:"metadata_cluster"` + Billing Billing `json:"billing" yaml:"billing"` + Cdc CdcConfig `json:"cdc" yaml:"cdc"` + Search SearchConfig `json:"search" yaml:"search"` + KV KVConfig `json:"kv" yaml:"kv"` + SecondaryIndex SecondaryIndexConfig `json:"secondary_index" mapstructure:"secondary_index" yaml:"secondary_index"` + Workers WorkersConfig `json:"workers" yaml:"workers"` + Cache CacheConfig `json:"cache" yaml:"cache"` + Tracing TracingConfig `json:"tracing" yaml:"tracing"` + Metrics MetricsConfig `json:"metrics" yaml:"metrics"` + Profiling ProfilingConfig `json:"profiling" yaml:"profiling"` FoundationDB FoundationDBConfig Quota QuotaConfig - Observability ObservabilityConfig `yaml:"observability" json:"observability"` - Management ManagementConfig `yaml:"management" json:"management"` - GlobalStatus GlobalStatusConfig `yaml:"global_status" json:"global_status"` + Observability ObservabilityConfig `json:"observability" yaml:"observability"` + Management ManagementConfig `json:"management" yaml:"management"` + GlobalStatus GlobalStatusConfig `json:"global_status" yaml:"global_status"` Schema SchemaConfig } type Gotrue struct { - URL string `mapstructure:"url" yaml:"url" json:"url"` - UsernameSuffix string `mapstructure:"username_suffix" yaml:"username_suffix" json:"username_suffix"` - AdminUsername string `mapstructure:"admin_username" yaml:"admin_username" json:"admin_username"` - AdminPassword string `mapstructure:"admin_password" yaml:"admin_password" json:"admin_password"` - ClientIdLength int `mapstructure:"client_id_length" yaml:"client_id_length" json:"client_id_length"` - ClientSecretLength int `mapstructure:"client_secret_length" yaml:"client_secret_length" json:"client_secret_length"` + URL string `json:"url" mapstructure:"url" yaml:"url"` + UsernameSuffix string `json:"username_suffix" mapstructure:"username_suffix" yaml:"username_suffix"` + AdminUsername string `json:"admin_username" mapstructure:"admin_username" yaml:"admin_username"` + AdminPassword string `json:"admin_password" mapstructure:"admin_password" yaml:"admin_password"` + ClientIdLength int `json:"client_id_length" mapstructure:"client_id_length" yaml:"client_id_length"` + ClientSecretLength int `json:"client_secret_length" mapstructure:"client_secret_length" yaml:"client_secret_length"` // this is used to sign tokens with symmetric key signature algorithm - SharedSecret string `mapstructure:"shared_secret" yaml:"shared_secret" json:"shared_secret"` + SharedSecret string `json:"shared_secret" mapstructure:"shared_secret" yaml:"shared_secret"` } type AuthzConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - LogOnly bool `mapstructure:"log_only" yaml:"log_only" json:"log_only"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + LogOnly bool `json:"log_only" mapstructure:"log_only" yaml:"log_only"` } type AuthConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Validators []ValidatorConfig `mapstructure:"validators" yaml:"validators" json:"validators"` - ApiKeys ApiKeysConfig `mapstructure:"api_keys" yaml:"api_keys" json:"api_keys"` - PrimaryAudience string `mapstructure:"primary_audience" yaml:"primary_audience" json:"primary_audience"` - JWKSCacheTimeout time.Duration `mapstructure:"jwks_cache_timeout" yaml:"jwks_cache_timeout" json:"jwks_cache_timeout"` - LogOnly bool `mapstructure:"log_only" yaml:"log_only" json:"log_only"` - EnableNamespaceIsolation bool `mapstructure:"enable_namespace_isolation" yaml:"enable_namespace_isolation" json:"enable_namespace_isolation"` - AdminNamespaces []string `mapstructure:"admin_namespaces" yaml:"admin_namespaces" json:"admin_namespaces"` - OAuthProvider string `mapstructure:"oauth_provider" yaml:"oauth_provider" json:"oauth_provider"` - ClientId string `mapstructure:"client_id" yaml:"client_id" json:"client_id"` - ExternalTokenURL string `mapstructure:"external_token_url" yaml:"external_token_url" json:"external_token_url"` - EnableOauth bool `mapstructure:"enable_oauth" yaml:"enable_oauth" json:"enable_oauth"` - TokenValidationCacheSize int `mapstructure:"token_cache_size" yaml:"token_cache_size" json:"token_cache_size"` - TokenValidationCacheTTLSec int `mapstructure:"token_cache_ttl_sec" yaml:"token_cache_ttl_sec" json:"token_cache_ttl_sec"` - ExternalDomain string `mapstructure:"external_domain" yaml:"external_domain" json:"external_domain"` - ManagementClientId string `mapstructure:"management_client_id" yaml:"management_client_id" json:"management_client_id"` - ManagementClientSecret string `mapstructure:"management_client_secret" yaml:"management_client_secret" json:"management_client_secret"` - TokenClockSkewDurationSec int `mapstructure:"token_clock_skew_duration_sec" yaml:"token_clock_skew_duration_sec" json:"token_clock_skew_duration_sec"` - Gotrue Gotrue `mapstructure:"gotrue" yaml:"gotrue" json:"gotrue"` - NamespaceLocalization NamespaceLocalization `mapstructure:"namespace_localization" yaml:"namespace_localization" json:"namespace_localization"` - EnableNamespaceDeletion bool `mapstructure:"enable_namespace_deletion" yaml:"enable_namespace_deletion" json:"enable_namespace_deletion"` - EnableNamespaceCreation bool `mapstructure:"enable_namespace_creation" yaml:"enable_namespace_creation" json:"enable_namespace_creation"` - UserInvitations Invitation `mapstructure:"user_invitations" yaml:"user_invitations" json:"user_invitations"` - Authz AuthzConfig `mapstructure:"authz" yaml:"authz" json:"authz"` - EnableErrorLog bool `mapstructure:"enable_error_log" yaml:"enable_error_log" json:"enable_error_log"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Validators []ValidatorConfig `json:"validators" mapstructure:"validators" yaml:"validators"` + ApiKeys ApiKeysConfig `json:"api_keys" mapstructure:"api_keys" yaml:"api_keys"` + PrimaryAudience string `json:"primary_audience" mapstructure:"primary_audience" yaml:"primary_audience"` + JWKSCacheTimeout time.Duration `json:"jwks_cache_timeout" mapstructure:"jwks_cache_timeout" yaml:"jwks_cache_timeout"` + LogOnly bool `json:"log_only" mapstructure:"log_only" yaml:"log_only"` + EnableNamespaceIsolation bool `json:"enable_namespace_isolation" mapstructure:"enable_namespace_isolation" yaml:"enable_namespace_isolation"` + AdminNamespaces []string `json:"admin_namespaces" mapstructure:"admin_namespaces" yaml:"admin_namespaces"` + OAuthProvider string `json:"oauth_provider" mapstructure:"oauth_provider" yaml:"oauth_provider"` + ClientId string `json:"client_id" mapstructure:"client_id" yaml:"client_id"` + ExternalTokenURL string `json:"external_token_url" mapstructure:"external_token_url" yaml:"external_token_url"` + EnableOauth bool `json:"enable_oauth" mapstructure:"enable_oauth" yaml:"enable_oauth"` + TokenValidationCacheSize int `json:"token_cache_size" mapstructure:"token_cache_size" yaml:"token_cache_size"` + TokenValidationCacheTTLSec int `json:"token_cache_ttl_sec" mapstructure:"token_cache_ttl_sec" yaml:"token_cache_ttl_sec"` + ExternalDomain string `json:"external_domain" mapstructure:"external_domain" yaml:"external_domain"` + ManagementClientId string `json:"management_client_id" mapstructure:"management_client_id" yaml:"management_client_id"` + ManagementClientSecret string `json:"management_client_secret" mapstructure:"management_client_secret" yaml:"management_client_secret"` + TokenClockSkewDurationSec int `json:"token_clock_skew_duration_sec" mapstructure:"token_clock_skew_duration_sec" yaml:"token_clock_skew_duration_sec"` + Gotrue Gotrue `json:"gotrue" mapstructure:"gotrue" yaml:"gotrue"` + NamespaceLocalization NamespaceLocalization `json:"namespace_localization" mapstructure:"namespace_localization" yaml:"namespace_localization"` + EnableNamespaceDeletion bool `json:"enable_namespace_deletion" mapstructure:"enable_namespace_deletion" yaml:"enable_namespace_deletion"` + EnableNamespaceCreation bool `json:"enable_namespace_creation" mapstructure:"enable_namespace_creation" yaml:"enable_namespace_creation"` + UserInvitations Invitation `json:"user_invitations" mapstructure:"user_invitations" yaml:"user_invitations"` + Authz AuthzConfig `json:"authz" mapstructure:"authz" yaml:"authz"` + EnableErrorLog bool `json:"enable_error_log" mapstructure:"enable_error_log" yaml:"enable_error_log"` } type Invitation struct { - ExpireAfterSec int64 `mapstructure:"expire_after_sec" yaml:"expire_after_sec" json:"expire_after_sec"` + ExpireAfterSec int64 `json:"expire_after_sec" mapstructure:"expire_after_sec" yaml:"expire_after_sec"` } type ClusterConfig struct { - Url string `mapstructure:"url" yaml:"url" json:"url"` - Token string `mapstructure:"token" yaml:"token" json:"token"` + Url string `json:"url" mapstructure:"url" yaml:"url"` + Token string `json:"token" mapstructure:"token" yaml:"token"` } type NamespaceLocalization struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` } type ValidatorConfig struct { - Issuer string `mapstructure:"issuer" yaml:"issuer" json:"issuer"` - Algorithm validator.SignatureAlgorithm `mapstructure:"algorithm" yaml:"algorithm" json:"algorithm"` - Audience string `mapstructure:"audience" yaml:"audience" json:"audience"` + Issuer string `json:"issuer" mapstructure:"issuer" yaml:"issuer"` + Algorithm validator.SignatureAlgorithm `json:"algorithm" mapstructure:"algorithm" yaml:"algorithm"` + Audience string `json:"audience" mapstructure:"audience" yaml:"audience"` } type ApiKeysConfig struct { - Auds []string `mapstructure:"auds" yaml:"auds" json:"auds"` - Length int `mapstructure:"length" yaml:"length" json:"length"` - EmailSuffix string `mapstructure:"email_suffix" yaml:"email_suffix" json:"email_suffix"` - UserPassword string `mapstructure:"user_password" yaml:"user_password" json:"user_password"` + Auds []string `json:"auds" mapstructure:"auds" yaml:"auds"` + Length int `json:"length" mapstructure:"length" yaml:"length"` + EmailSuffix string `json:"email_suffix" mapstructure:"email_suffix" yaml:"email_suffix"` + UserPassword string `json:"user_password" mapstructure:"user_password" yaml:"user_password"` } type CdcConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` StreamInterval time.Duration StreamBatch int StreamBuffer int } type TracingConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Datadog DatadogTracingConfig `mapstructure:"datadog" yaml:"datadog" json:"datadog"` - Jaeger JaegerTracingConfig `mapstructure:"jaeger" yaml:"jaeger" json:"jaeger"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Datadog DatadogTracingConfig `json:"datadog" mapstructure:"datadog" yaml:"datadog"` + Jaeger JaegerTracingConfig `json:"jaeger" mapstructure:"jaeger" yaml:"jaeger"` } type DatadogTracingConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - SampleRate float64 `mapstructure:"sample_rate" yaml:"sample_rate" json:"sample_rate"` - CodeHotspotsEnabled bool `mapstructure:"codehotspots_enabled" yaml:"codehotspots_enabled" json:"codehotspots_enabled"` - EndpointsEnabled bool `mapstructure:"endpoints_enabled" yaml:"endpoints_enabled" json:"endpoints_enabled"` - WithUDS string `mapstructure:"agent_socket" yaml:"agent_socket" json:"agent_socket"` - WithAgentAddr string `mapstructure:"agent_addr" yaml:"agent_addr" json:"agent_addr"` - WithDogStatsdAddr string `mapstructure:"dogstatsd_addr" yaml:"dogstatsd_addr" json:"dogstatsd_addr"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + SampleRate float64 `json:"sample_rate" mapstructure:"sample_rate" yaml:"sample_rate"` + CodeHotspotsEnabled bool `json:"codehotspots_enabled" mapstructure:"codehotspots_enabled" yaml:"codehotspots_enabled"` + EndpointsEnabled bool `json:"endpoints_enabled" mapstructure:"endpoints_enabled" yaml:"endpoints_enabled"` + WithUDS string `json:"agent_socket" mapstructure:"agent_socket" yaml:"agent_socket"` + WithAgentAddr string `json:"agent_addr" mapstructure:"agent_addr" yaml:"agent_addr"` + WithDogStatsdAddr string `json:"dogstatsd_addr" mapstructure:"dogstatsd_addr" yaml:"dogstatsd_addr"` } type JaegerTracingConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Url string `mapstructure:"url" yaml:"url" json:"url"` - SampleRate float64 `mapstructure:"sample_rate" yaml:"sample_rate" json:"sample_rate"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Url string `json:"url" mapstructure:"url" yaml:"url"` + SampleRate float64 `json:"sample_rate" mapstructure:"sample_rate" yaml:"sample_rate"` } type MetricsConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - DebugMessages bool `mapstructure:"debug_messages" yaml:"debug_messages" json:"debug_messages"` - TimerQuantiles []float64 `mapstructure:"quantiles" yaml:"quantiles" json:"quantiles"` - LogLongMethodTime time.Duration `mapstructure:"log_long_method_time" yaml:"log_long_method_time" json:"log_long_method_time"` - LongRequestConfig LongRequestConfig `mapstructure:"long_request_config" yaml:"long_request_config" json:"long_request_config"` - Requests RequestsMetricGroupConfig `mapstructure:"requests" yaml:"requests" json:"requests"` - Fdb FdbMetricGroupConfig `mapstructure:"fdb" yaml:"fdb" json:"fdb"` - Search SearchMetricGroupConfig `mapstructure:"search" yaml:"search" json:"search"` - Session SessionMetricGroupConfig `mapstructure:"session" yaml:"session" json:"session"` - Size SizeMetricGroupConfig `mapstructure:"size" yaml:"size" json:"size"` - Network NetworkMetricGroupConfig `mapstructure:"network" yaml:"network" json:"network"` - Auth AuthMetricsConfig `mapstructure:"auth" yaml:"auth" json:"auth"` - SecondaryIndex SecondaryIndexMetricsConfig `mapstructure:"secondary_index" yaml:"secondary_index" json:"secondary_index"` - Queue QueueMetricsConfig `mapstructure:"queue" yaml:"queue" json:"queue"` - Metronome MetronomeMetricsConfig `mapstructure:"metronome" yaml:"metronome" json:"metronome"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + DebugMessages bool `json:"debug_messages" mapstructure:"debug_messages" yaml:"debug_messages"` + TimerQuantiles []float64 `json:"quantiles" mapstructure:"quantiles" yaml:"quantiles"` + LogLongMethodTime time.Duration `json:"log_long_method_time" mapstructure:"log_long_method_time" yaml:"log_long_method_time"` + LongRequestConfig LongRequestConfig `json:"long_request_config" mapstructure:"long_request_config" yaml:"long_request_config"` + Requests RequestsMetricGroupConfig `json:"requests" mapstructure:"requests" yaml:"requests"` + Fdb FdbMetricGroupConfig `json:"fdb" mapstructure:"fdb" yaml:"fdb"` + Search SearchMetricGroupConfig `json:"search" mapstructure:"search" yaml:"search"` + Session SessionMetricGroupConfig `json:"session" mapstructure:"session" yaml:"session"` + Size SizeMetricGroupConfig `json:"size" mapstructure:"size" yaml:"size"` + Network NetworkMetricGroupConfig `json:"network" mapstructure:"network" yaml:"network"` + Auth AuthMetricsConfig `json:"auth" mapstructure:"auth" yaml:"auth"` + SecondaryIndex SecondaryIndexMetricsConfig `json:"secondary_index" mapstructure:"secondary_index" yaml:"secondary_index"` + Queue QueueMetricsConfig `json:"queue" mapstructure:"queue" yaml:"queue"` + Metronome MetronomeMetricsConfig `json:"metronome" mapstructure:"metronome" yaml:"metronome"` } type LongRequestConfig struct { - FilteredMethods []string `mapstructure:"filtered_methods" yaml:"filtered_methods" json:"filtered_methods"` + FilteredMethods []string `json:"filtered_methods" mapstructure:"filtered_methods" yaml:"filtered_methods"` } type TimerConfig struct { - TimerEnabled bool `mapstructure:"timer_enabled" yaml:"timer_enabled" json:"timer_enabled"` - HistogramEnabled bool `mapstructure:"histogram_enabled" yaml:"histogram_enabled" json:"histogram_enabled"` + TimerEnabled bool `json:"timer_enabled" mapstructure:"timer_enabled" yaml:"timer_enabled"` + HistogramEnabled bool `json:"histogram_enabled" mapstructure:"histogram_enabled" yaml:"histogram_enabled"` } type CounterConfig struct { - OkEnabled bool `mapstructure:"ok_enabled" yaml:"ok_enabled" json:"ok_enabled"` - ErrorEnabled bool `mapstructure:"error_enabled" yaml:"error_enabled" json:"error_enabled"` + OkEnabled bool `json:"ok_enabled" mapstructure:"ok_enabled" yaml:"ok_enabled"` + ErrorEnabled bool `json:"error_enabled" mapstructure:"error_enabled" yaml:"error_enabled"` } type RequestsMetricGroupConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Counter CounterConfig `mapstructure:"counter" yaml:"counter" json:"counter"` - Timer TimerConfig `mapstructure:"timer" yaml:"timer" json:"timer"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Counter CounterConfig `json:"counter" mapstructure:"counter" yaml:"counter"` + Timer TimerConfig `json:"timer" mapstructure:"timer" yaml:"timer"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type FdbMetricGroupConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Counter CounterConfig `mapstructure:"counter" yaml:"counter" json:"counter"` - Timer TimerConfig `mapstructure:"timer" yaml:"timer" json:"timer"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Counter CounterConfig `json:"counter" mapstructure:"counter" yaml:"counter"` + Timer TimerConfig `json:"timer" mapstructure:"timer" yaml:"timer"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type SearchMetricGroupConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Counter CounterConfig `mapstructure:"counter" yaml:"counter" json:"counter"` - Timer TimerConfig `mapstructure:"timer" yaml:"timer" json:"timer"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Counter CounterConfig `json:"counter" mapstructure:"counter" yaml:"counter"` + Timer TimerConfig `json:"timer" mapstructure:"timer" yaml:"timer"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type SessionMetricGroupConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Counter CounterConfig `mapstructure:"counter" yaml:"counter" json:"counter"` - Timer TimerConfig `mapstructure:"timer" yaml:"timer" json:"timer"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Counter CounterConfig `json:"counter" mapstructure:"counter" yaml:"counter"` + Timer TimerConfig `json:"timer" mapstructure:"timer" yaml:"timer"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type SizeMetricGroupConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Namespace bool `mapstructure:"namespace" yaml:"namespace" json:"namespace"` - Project bool `mapstructure:"project" yaml:"project" json:"project"` - Collection bool `mapstructure:"collection" yaml:"collection" json:"collection"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Namespace bool `json:"namespace" mapstructure:"namespace" yaml:"namespace"` + Project bool `json:"project" mapstructure:"project" yaml:"project"` + Collection bool `json:"collection" mapstructure:"collection" yaml:"collection"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type NetworkMetricGroupConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type AuthMetricsConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type SecondaryIndexMetricsConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Counter CounterConfig `mapstructure:"counter" yaml:"counter" json:"counter"` - Timer TimerConfig `mapstructure:"timer" yaml:"timer" json:"timer"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Counter CounterConfig `json:"counter" mapstructure:"counter" yaml:"counter"` + Timer TimerConfig `json:"timer" mapstructure:"timer" yaml:"timer"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type MetronomeMetricsConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Counter CounterConfig `mapstructure:"counter" yaml:"counter" json:"counter"` - Timer TimerConfig `mapstructure:"timer" yaml:"timer" json:"timer"` - FilteredTags []string `mapstructure:"filtered_tags" yaml:"filtered_tags" json:"filtered_tags"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Counter CounterConfig `json:"counter" mapstructure:"counter" yaml:"counter"` + Timer TimerConfig `json:"timer" mapstructure:"timer" yaml:"timer"` + FilteredTags []string `json:"filtered_tags" mapstructure:"filtered_tags" yaml:"filtered_tags"` } type QueueMetricsConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` } type WorkersConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - Count uint `mapstructure:"count" yaml:"count" json:"count"` - SearchEnabled bool `mapstructure:"search_enabled" yaml:"search_enabled" json:"search_enabled"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + Count uint `json:"count" mapstructure:"count" yaml:"count"` + SearchEnabled bool `json:"search_enabled" mapstructure:"search_enabled" yaml:"search_enabled"` } type ProfilingConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - EnableCPU bool `mapstructure:"enable_cpu" yaml:"enable_cpu" json:"enable_cpu"` - EnableHeap bool `mapstructure:"enable_heap" yaml:"enable_heap" json:"enable_heap"` - EnableBlock bool `mapstructure:"enable_block" yaml:"enable_block" json:"enable_block"` - EnableMutex bool `mapstructure:"enable_mutex" yaml:"enable_mutex" json:"enable_mutex"` - EnableGoroutine bool `mapstructure:"enable_goroutine" yaml:"enable_goroutine" json:"enable_goroutine"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + EnableCPU bool `json:"enable_cpu" mapstructure:"enable_cpu" yaml:"enable_cpu"` + EnableHeap bool `json:"enable_heap" mapstructure:"enable_heap" yaml:"enable_heap"` + EnableBlock bool `json:"enable_block" mapstructure:"enable_block" yaml:"enable_block"` + EnableMutex bool `json:"enable_mutex" mapstructure:"enable_mutex" yaml:"enable_mutex"` + EnableGoroutine bool `json:"enable_goroutine" mapstructure:"enable_goroutine" yaml:"enable_goroutine"` } type ManagementConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` } type ObservabilityConfig struct { - Provider string `mapstructure:"provider" yaml:"provider" json:"provider"` - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - ApiKey string `mapstructure:"api_key" yaml:"api_key" json:"api_key"` - AppKey string `mapstructure:"app_key" yaml:"app_key" json:"app_key"` - ProviderUrl string `mapstructure:"provider_url" yaml:"provider_url" json:"provider_url"` + Provider string `json:"provider" mapstructure:"provider" yaml:"provider"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + ApiKey string `json:"api_key" mapstructure:"api_key" yaml:"api_key"` + AppKey string `json:"app_key" mapstructure:"app_key" yaml:"app_key"` + ProviderUrl string `json:"provider_url" mapstructure:"provider_url" yaml:"provider_url"` } type GlobalStatusConfig struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - EmitMetrics bool `mapstructure:"emit_metrics" yaml:"emit_metrics" json:"emit_metrics"` - DebugMessages bool `mapstructure:"debug_messages" yaml:"debug_messages" json:"debug_messages"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + EmitMetrics bool `json:"emit_metrics" mapstructure:"emit_metrics" yaml:"emit_metrics"` + DebugMessages bool `json:"debug_messages" mapstructure:"debug_messages" yaml:"debug_messages"` } type Billing struct { - Metronome Metronome `mapstructure:"metronome" yaml:"metronome" json:"metronome"` - Reporter BillingReporter `mapstructure:"reporter" yaml:"reporter" json:"reporter"` + Metronome Metronome `json:"metronome" mapstructure:"metronome" yaml:"metronome"` + Reporter BillingReporter `json:"reporter" mapstructure:"reporter" yaml:"reporter"` } type Metronome struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - URL string `mapstructure:"url" yaml:"url" json:"url"` - ApiKey string `mapstructure:"api_key" yaml:"api_key" json:"api_key"` - DefaultPlan string `mapstructure:"default_plan" yaml:"default_plan" json:"default_plan"` - BilledMetrics BilledMetrics `mapstructure:"billed_metrics" yaml:"billed_metrics" json:"billed_metrics"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + URL string `json:"url" mapstructure:"url" yaml:"url"` + ApiKey string `json:"api_key" mapstructure:"api_key" yaml:"api_key"` + DefaultPlan string `json:"default_plan" mapstructure:"default_plan" yaml:"default_plan"` + BilledMetrics BilledMetrics `json:"billed_metrics" mapstructure:"billed_metrics" yaml:"billed_metrics"` } type BilledMetrics = map[string]string type BillingReporter struct { - Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` - RefreshInterval time.Duration `mapstructure:"refresh_interval" yaml:"refresh_interval" json:"refresh_interval"` + Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"` + RefreshInterval time.Duration `json:"refresh_interval" mapstructure:"refresh_interval" yaml:"refresh_interval"` } var ( @@ -589,56 +589,56 @@ type SchemaConfig struct { // * changing field type // * reducing max_length of the string fields // * setting "required" property - AllowIncompatible bool `mapstructure:"allow_incompatible" json:"allow_incompatible" yaml:"allow_incompatible"` + AllowIncompatible bool `json:"allow_incompatible" mapstructure:"allow_incompatible" yaml:"allow_incompatible"` } // KVConfig keeps KV store configuration parameters. type KVConfig struct { // Chunking allows us to persist bigger payload in storage. - Chunking bool `mapstructure:"chunking" yaml:"chunking" json:"chunking"` + Chunking bool `json:"chunking" mapstructure:"chunking" yaml:"chunking"` // Compression allows us to compress payload before storing in storage. - Compression bool `mapstructure:"compression" yaml:"compression" json:"compression"` - MinCompressThreshold int32 `mapstructure:"min_compression_threshold" yaml:"min_compression_threshold" json:"min_compression_threshold"` + Compression bool `json:"compression" mapstructure:"compression" yaml:"compression"` + MinCompressThreshold int32 `json:"min_compression_threshold" mapstructure:"min_compression_threshold" yaml:"min_compression_threshold"` } // FoundationDBConfig keeps FoundationDB configuration parameters. type FoundationDBConfig struct { - ClusterFile string `mapstructure:"cluster_file" json:"cluster_file" yaml:"cluster_file"` + ClusterFile string `json:"cluster_file" mapstructure:"cluster_file" yaml:"cluster_file"` } type SearchConfig struct { - Host string `mapstructure:"host" json:"host" yaml:"host"` - Port int16 `mapstructure:"port" json:"port" yaml:"port"` - AuthKey string `mapstructure:"auth_key" json:"auth_key" yaml:"auth_key"` - ReadEnabled bool `mapstructure:"read_enabled" yaml:"read_enabled" json:"read_enabled"` - WriteEnabled bool `mapstructure:"write_enabled" yaml:"write_enabled" json:"write_enabled"` + Host string `json:"host" mapstructure:"host" yaml:"host"` + Port int16 `json:"port" mapstructure:"port" yaml:"port"` + AuthKey string `json:"auth_key" mapstructure:"auth_key" yaml:"auth_key"` + ReadEnabled bool `json:"read_enabled" mapstructure:"read_enabled" yaml:"read_enabled"` + WriteEnabled bool `json:"write_enabled" mapstructure:"write_enabled" yaml:"write_enabled"` // StorageEnabled only applies to standalone search indexes. This is to enable persisting search indexes to storage. - StorageEnabled bool `mapstructure:"storage_enabled" yaml:"storage_enabled" json:"storage_enabled"` + StorageEnabled bool `json:"storage_enabled" mapstructure:"storage_enabled" yaml:"storage_enabled"` // Chunking allows us to persist bigger search indexes payload in storage. - Chunking bool `mapstructure:"chunking" yaml:"chunking" json:"chunking"` + Chunking bool `json:"chunking" mapstructure:"chunking" yaml:"chunking"` // Compression allows us to compress payload before storing in storage. - Compression bool `mapstructure:"compression" yaml:"compression" json:"compression"` - IgnoreExtraFields bool `mapstructure:"ignore_extra_fields" yaml:"ignore_extra_fields" json:"ignore_extra_fields"` - LogFilter bool `mapstructure:"log_filter" yaml:"log_filter" json:"log_filter"` + Compression bool `json:"compression" mapstructure:"compression" yaml:"compression"` + IgnoreExtraFields bool `json:"ignore_extra_fields" mapstructure:"ignore_extra_fields" yaml:"ignore_extra_fields"` + LogFilter bool `json:"log_filter" mapstructure:"log_filter" yaml:"log_filter"` } type SecondaryIndexConfig struct { - ReadEnabled bool `mapstructure:"read_enabled" yaml:"read_enabled" json:"read_enabled"` - WriteEnabled bool `mapstructure:"write_enabled" yaml:"write_enabled" json:"write_enabled"` - MutateEnabled bool `mapstructure:"mutate_enabled" yaml:"mutate_iterator" json:"mutate_enabled"` + ReadEnabled bool `json:"read_enabled" mapstructure:"read_enabled" yaml:"read_enabled"` + WriteEnabled bool `json:"write_enabled" mapstructure:"write_enabled" yaml:"write_enabled"` + MutateEnabled bool `json:"mutate_enabled" mapstructure:"mutate_enabled" yaml:"mutate_iterator"` } type CacheConfig struct { - Host string `mapstructure:"host" json:"host" yaml:"host"` - Port int16 `mapstructure:"port" json:"port" yaml:"port"` - MaxScan int64 `mapstructure:"max_scan" json:"max_scan" yaml:"max_scan"` + Host string `json:"host" mapstructure:"host" yaml:"host"` + Port int16 `json:"port" mapstructure:"port" yaml:"port"` + MaxScan int64 `json:"max_scan" mapstructure:"max_scan" yaml:"max_scan"` } type LimitsConfig struct { Enabled bool - ReadUnits int `mapstructure:"read_units" yaml:"read_units" json:"read_units"` - WriteUnits int `mapstructure:"write_units" yaml:"write_units" json:"write_units"` + ReadUnits int `json:"read_units" mapstructure:"read_units" yaml:"read_units"` + WriteUnits int `json:"write_units" mapstructure:"write_units" yaml:"write_units"` } func (l *LimitsConfig) Limit(isWrite bool) int { @@ -655,7 +655,7 @@ type NamespaceLimitsConfig struct { Node LimitsConfig // max per node per namespace limit Namespaces map[string]LimitsConfig // individual namespaces configuration - RefreshInterval time.Duration `mapstructure:"refresh_interval" yaml:"refresh_interval" json:"refresh_interval"` + RefreshInterval time.Duration `json:"refresh_interval" mapstructure:"refresh_interval" yaml:"refresh_interval"` Regulator QuotaRegulator } @@ -673,8 +673,8 @@ type NamespaceStorageLimitsConfig struct { type StorageLimitsConfig struct { Enabled bool - DataSizeLimit int64 `mapstructure:"data_size_limit" yaml:"data_size_limit" json:"data_size_limit"` - RefreshInterval time.Duration `mapstructure:"refresh_interval" yaml:"refresh_interval" json:"refresh_interval"` + DataSizeLimit int64 `json:"data_size_limit" mapstructure:"data_size_limit" yaml:"data_size_limit"` + RefreshInterval time.Duration `json:"refresh_interval" mapstructure:"refresh_interval" yaml:"refresh_interval"` // Per namespace limits Namespaces map[string]NamespaceStorageLimitsConfig @@ -690,12 +690,12 @@ func (n *StorageLimitsConfig) NamespaceLimits(ns string) int64 { type QuotaRegulator struct { // This is a hysteresis band, deviation from ideal value in which regulation is no happening - Hysteresis int `mapstructure:"hysteresis" yaml:"hysteresis" json:"hysteresis"` + Hysteresis int `json:"hysteresis" mapstructure:"hysteresis" yaml:"hysteresis"` // when rate adjustment is needed increment current rate by ± this value // (this is percentage of maximum per node per namespace limit) // Set by config.DefaultConfig.Quota.Namespace.Node.(Read|Write)RateLimit. - Increment int `mapstructure:"increment" yaml:"increment" json:"increment"` + Increment int `json:"increment" mapstructure:"increment" yaml:"increment"` } type QuotaConfig struct { diff --git a/server/services/v1/auth/gotrue.go b/server/services/v1/auth/gotrue.go index 906c7aa4a..c1a94c1b4 100644 --- a/server/services/v1/auth/gotrue.go +++ b/server/services/v1/auth/gotrue.go @@ -112,7 +112,7 @@ type GetUserResp struct { Email string `json:"email"` EncryptedPassword string `json:"encrypted_password"` - AppMetaData *UserAppData `json:"app_metadata" db:"app_metadata"` + AppMetaData *UserAppData `db:"app_metadata" json:"app_metadata"` } // returns currentSub, creationTime, error. diff --git a/server/services/v1/database/query_runner.go b/server/services/v1/database/query_runner.go index 382f925e5..410af3f1d 100644 --- a/server/services/v1/database/query_runner.go +++ b/server/services/v1/database/query_runner.go @@ -935,7 +935,7 @@ func (*StreamingQueryRunner) writeTimestamp(buf *bytes.Buffer, key string, times } // append comma first and write the pair - _, _ = buf.Write([]byte(fmt.Sprintf(`, "%s":%s`, key, ts))) + _, _ = buf.WriteString(fmt.Sprintf(`, "%s":%s`, key, ts)) return nil } diff --git a/util/log/log.go b/util/log/log.go index d734f3294..6b27ce031 100644 --- a/util/log/log.go +++ b/util/log/log.go @@ -28,7 +28,7 @@ import ( type LogConfig struct { Level string Format string - SampleRate float64 `mapstructure:"sample_rate" yaml:"sample_rate" json:"sample_rate"` + SampleRate float64 `json:"sample_rate" mapstructure:"sample_rate" yaml:"sample_rate"` } // trim full path. output in the form directory/file.go.