main.go
main.go - Overview
This file is the entry point for the query service application. It initializes and starts the application, including configurations, logging, authentication, and the server itself. It also handles graceful shutdown.
Detailed Documentation
initZapLog
- Purpose: Initializes a zap logger with production configurations.
- Parameters: None
- Returns:
*zap.Logger
- A configured zap logger instance.
main
- Purpose: The main function of the query service. It parses command-line flags, initializes the configuration, sets up logging, creates and starts the server, initializes the authentication cache, and handles graceful shutdown.
- Parameters: None
- Returns: None
Flag Variables
promConfigPath
: Path to the Prometheus configuration file.skipTopLvlOpsPath
: Path to the configuration file to skip top-level operations.disableRules
: Boolean to disable rule evaluation.useLogsNewSchema
: Boolean to use the logs_v2 schema for logs.useTraceNewSchema
: Boolean to use the new schema for traces.ruleRepoURL
: URL used to build links in alert messages.cacheConfigPath
: Path to the cache configuration file.fluxInterval
: Interval to exclude data from being cached.fluxIntervalForTraceDetail
: Interval to exclude trace data from being cached.cluster
: Cluster name.preferSpanMetrics
: Boolean to prefer span metrics for service-level metrics.maxIdleConns
: Maximum number of idle connections in the connection pool.maxOpenConns
: Maximum number of open connections to the database.dialTimeout
: Maximum time to wait for establishing a database connection.
Local Variables
loggerMgr
: A*zap.Logger
instance, used for application logging.config
: The application configuration loaded usingsignoz.NewConfig
.jwtSecret
: The JWT secret read from the environment variableSIGNOZ_JWT_SECRET
.jwt
: An instance ofauthtypes.JWT
for handling JSON Web Tokens.serverOptions
: A pointer to anapp.ServerOptions
struct, containing the configuration for the server.server
: An instance of theapp.Server
.
Code Examples
None.
Clarity and Accuracy
The documentation is based on the provided code and aims to be accurate and clear.
Include in Getting Started: NO