mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-20 06:24:25 +00:00
# Which Problems Are Solved Zitadel did not provide easy correlation between errors, logs, traces and metrics. The configuration for those instrumentations was also not consistent, with some supporting different exporters then others. Implementation and parsing of config was also spaghettified over multiple packages, with awkward parsing and inconsistent naming of options. # How the Problems Are Solved All telemetry is now merged under the name "instrumentation". Why? 1. We thought it was a good idea in the past to call the milestone exporter `Telemtry` in the runtime config. Calling this `TelemetryV2` looks weird. 2. Not everything is a meter and not everything is sent (tele...). 3. It's also [defined](https://opentelemetry.io/docs/concepts/instrumentation/) as such by the OTEL documentation. ## New features - Adds structured, context based logging with trace-ID awareness - Static log fields are added to the context, such as service and request path - Static log fields are injected in each logline emitted by the application - Structured logs can also be send to an otel exporter - Structured logs can be printed to StdErr in text and JSON format - Error sinks make sure every error is logged at the correct level: - Warnings for client side errors (HTTP 400 range, Invalid request etc) - Error for server side errors (Internal server errors) - Metrics can now also be send to a OTEL collector. (previously they could only be scraped from `/debug/metrics` with prometheus) ## Exporters This change adds all the exporters supported by OTEL upstream and some google specific exporters for our cloud deployment. - StdOut / StdErr: all instrumentations - OTEL gRPC / HTTP: all instrumentations - Google: all instrumentations except logging - Prometheus (pull-based): only metrics The exception is profiling, which only supports the google exporting due to lack of support by OTEL upstream. ## Configuration and structure - All instrumentation is moved into the new `backend/v3/instrumentation` package. It reuses configuration types, so both code and runtime configuration are easier to understand. - The `internal/telemetry` packages are removed. - Instrumentation is started with a single function and a proper shutdown function is now provided. - Legacy configuration is still parsed from the runtime config, as long as the new configuration is disabled. This allows backporting this feature to v4 without breaking existing configurations. # Additional Changes - Devcontainer: set `$PATH` variable so installed go binaries can be run individually, without NX. - NX: install GCI tool to fix imports # Additional Context - Closes https://github.com/zitadel/zitadel/issues/8408 - Closes https://github.com/zitadel/zitadel/issues/6664 - Backport to v4
173 lines
8.0 KiB
YAML
173 lines
8.0 KiB
YAML
Instrumentation:
|
|
ServiceName: "zitadel-mirror" # ZITADEL_INSTRUMENTATION_SERVICENAME
|
|
Trace:
|
|
Fraction: 1.0 # ZITADEL_INSTRUMENTATION_TRACE_FRACTION
|
|
Exporter:
|
|
# The following exporter types are supported:
|
|
# "none": Disables trace exporting
|
|
# "stdOut": Exports traces to standard output
|
|
# "stdErr": Exports traces to standard error
|
|
# "grpc": Exports traces using the OTEL gRPC exporter (recommended)
|
|
# "http": Exports traces using the OTEL HTTP exporter
|
|
# "google": Exports traces to Google Cloud. Need to configure GoogleProjectID below!
|
|
Type: "none" # ZITADEL_INSTRUMENTATION_TRACE_EXPORTER_TYPE
|
|
# Endpoint of the OTEL collector for grpc and http exporters
|
|
Endpoint: "" # ZITADEL_INSTRUMENTATION_TRACE_EXPORTER_ENDPOINT
|
|
# Disable TLS for grpc and http exporters
|
|
Insecure: false # ZITADEL_INSTRUMENTATION_TRACE_EXPORTER_INSECURE
|
|
# Interval for batching traces before export
|
|
BatchDuration: 1s # ZITADEL_INSTRUMENTATION_TRACE_EXPORTER_BATCHDURATION
|
|
# Project ID for Google Cloud Trace exporter
|
|
GoogleProjectID: "" # ZITADEL_INSTRUMENTATION_TRACE_EXPORTER_GOOGLEPROJECTID
|
|
Metric:
|
|
Exporter:
|
|
# The following exporter types are supported:
|
|
# "none": Disables metric exporting
|
|
# "stdOut": Exports metrics to standard output
|
|
# "stdErr": Exports metrics to standard error
|
|
# "grpc": Exports metrics using the OTEL gRPC exporter (recommended)
|
|
# "http": Exports metrics using the OTEL HTTP exporter
|
|
# "google": Exports metrics to Google Cloud. Need to configure GoogleProjectID below!
|
|
# "prometheus": Exposes metrics via an HTTP endpoint for Prometheus to scrape
|
|
Type: "none" # ZITADEL_INSTRUMENTATION_METRIC_EXPORTER_TYPE
|
|
# Endpoint of the OTEL collector for grpc and http exporters
|
|
Endpoint: "" # ZITADEL_INSTRUMENTATION_METRIC_EXPORTER_ENDPOINT
|
|
# Disable TLS for grpc and http exporters
|
|
Insecure: false # ZITADEL_INSTRUMENTATION_METRIC_EXPORTER_INSECURE
|
|
# Interval at which metrics are exported
|
|
BatchDuration: 1m # ZITADEL_INSTRUMENTATION_METRIC_EXPORTER_BATCHDURATION
|
|
# Project ID for Google Cloud Trace exporter
|
|
GoogleProjectID: "" # ZITADEL_INSTRUMENTATION_METRIC_EXPORTER_GOOGLEPROJECTID
|
|
|
|
# Structured logging can print logs on standard error and/or export them using OTEL.
|
|
Log:
|
|
# Log lines lower than this level are not emitted.
|
|
Level: "INFO" # ZITADEL_INSTRUMENTATION_LOG_LEVEL
|
|
# Enable printing structured logs to standard error in the specified format.
|
|
# The following formats are supported:
|
|
# - "disabled": Disables logging
|
|
# - "text": Logs are printed on StdErr as human-readable text
|
|
# - "json": Logs are printed on StdErr as JSON objects
|
|
# - "gcp": JSON formatted logs compatible with Google Cloud Platform logging. Need to configure GoogleProjectID below!
|
|
Format: "text" # ZITADEL_INSTRUMENTATION_LOG_STDERR
|
|
# Adds the source file and line number where the log line was emitted.
|
|
# Not to be confused with the source of an error.
|
|
AddSource: true # ZITADEL_INSTRUMENTATION_LOG_ADDSOURCE
|
|
Exporter:
|
|
# The following exporter types are supported:
|
|
# - "none": Disables OTEL log exporter
|
|
# - "stdOut": Exports OTEL logs to standard output
|
|
# - "stdErr": Exports OTEL logs to standard error
|
|
# - "grpc": Exports OTEL logs using the OTEL gRPC exporter (recommended)
|
|
# - "http": Exports OTEL logs using the OTEL HTTP exporter
|
|
Type: "none" # ZITADEL_INSTRUMENTATION_LOG_EXPORTER_TYPE
|
|
# Endpoint of the OTEL collector for grpc and http exporters
|
|
Endpoint: "" # ZITADEL_INSTRUMENTATION_LOG_EXPORTER_ENDPOINT
|
|
# Disable TLS for grpc and http exporters
|
|
Insecure: false # ZITADEL_INSTRUMENTATION_LOG_EXPORTER_INSECURE
|
|
# Interval at which metrics are exported
|
|
BatchDuration: 1s # ZITADEL_INSTRUMENTATION_LOG_EXPORTER_BATCHDURATION
|
|
Profile:
|
|
Exporter:
|
|
# The following profiler types are supported:
|
|
# "none": Disables profiling
|
|
# "google": Exports profiling data to Google Cloud Profiler
|
|
Type: "none" # ZITADEL_INSTRUMENTATION_PROFILE_TYPE
|
|
# Project ID for Google Cloud Profiler
|
|
GoogleProjectID: "" # ZITADEL_INSTRUMENTATION_PROFILE_GOOGLEPROJECTID
|
|
|
|
Source:
|
|
cockroach:
|
|
Host: localhost # ZITADEL_SOURCE_COCKROACH_HOST
|
|
Port: 26257 # ZITADEL_SOURCE_COCKROACH_PORT
|
|
Database: zitadel # ZITADEL_SOURCE_COCKROACH_DATABASE
|
|
MaxOpenConns: 6 # ZITADEL_SOURCE_COCKROACH_MAXOPENCONNS
|
|
MaxIdleConns: 6 # ZITADEL_SOURCE_COCKROACH_MAXIDLECONNS
|
|
MaxConnLifetime: 30m # ZITADEL_SOURCE_COCKROACH_MAXCONNLIFETIME
|
|
MaxConnIdleTime: 5m # ZITADEL_SOURCE_COCKROACH_MAXCONNIDLETIME
|
|
Options: "" # ZITADEL_SOURCE_COCKROACH_OPTIONS
|
|
User:
|
|
Username: zitadel # ZITADEL_SOURCE_COCKROACH_USER_USERNAME
|
|
Password: "" # ZITADEL_SOURCE_COCKROACH_USER_PASSWORD
|
|
SSL:
|
|
Mode: disable # ZITADEL_SOURCE_COCKROACH_USER_SSL_MODE
|
|
RootCert: "" # ZITADEL_SOURCE_COCKROACH_USER_SSL_ROOTCERT
|
|
Cert: "" # ZITADEL_SOURCE_COCKROACH_USER_SSL_CERT
|
|
Key: "" # ZITADEL_SOURCE_COCKROACH_USER_SSL_KEY
|
|
# Postgres is used as soon as a value is set
|
|
# The values describe the possible fields to set values
|
|
postgres:
|
|
Host: # ZITADEL_SOURCE_POSTGRES_HOST
|
|
Port: # ZITADEL_SOURCE_POSTGRES_PORT
|
|
Database: # ZITADEL_SOURCE_POSTGRES_DATABASE
|
|
MaxOpenConns: # ZITADEL_SOURCE_POSTGRES_MAXOPENCONNS
|
|
MaxIdleConns: # ZITADEL_SOURCE_POSTGRES_MAXIDLECONNS
|
|
MaxConnLifetime: # ZITADEL_SOURCE_POSTGRES_MAXCONNLIFETIME
|
|
MaxConnIdleTime: # ZITADEL_SOURCE_POSTGRES_MAXCONNIDLETIME
|
|
Options: # ZITADEL_SOURCE_POSTGRES_OPTIONS
|
|
User:
|
|
Username: # ZITADEL_SOURCE_POSTGRES_USER_USERNAME
|
|
Password: # ZITADEL_SOURCE_POSTGRES_USER_PASSWORD
|
|
SSL:
|
|
Mode: # ZITADEL_SOURCE_POSTGRES_USER_SSL_MODE
|
|
RootCert: # ZITADEL_SOURCE_POSTGRES_USER_SSL_ROOTCERT
|
|
Cert: # ZITADEL_SOURCE_POSTGRES_USER_SSL_CERT
|
|
Key: # ZITADEL_SOURCE_POSTGRES_USER_SSL_KEY
|
|
|
|
Destination:
|
|
postgres:
|
|
Host: localhost # ZITADEL_DESTINATION_POSTGRES_HOST
|
|
Port: 5432 # ZITADEL_DESTINATION_POSTGRES_PORT
|
|
Database: zitadel # ZITADEL_DESTINATION_POSTGRES_DATABASE
|
|
MaxOpenConns: 5 # ZITADEL_DESTINATION_POSTGRES_MAXOPENCONNS
|
|
MaxIdleConns: 2 # ZITADEL_DESTINATION_POSTGRES_MAXIDLECONNS
|
|
MaxConnLifetime: 30m # ZITADEL_DESTINATION_POSTGRES_MAXCONNLIFETIME
|
|
MaxConnIdleTime: 5m # ZITADEL_DESTINATION_POSTGRES_MAXCONNIDLETIME
|
|
Options: "" # ZITADEL_DESTINATION_POSTGRES_OPTIONS
|
|
User:
|
|
Username: zitadel # ZITADEL_DESTINATION_POSTGRES_USER_USERNAME
|
|
Password: "" # ZITADEL_DESTINATION_POSTGRES_USER_PASSWORD
|
|
SSL:
|
|
Mode: disable # ZITADEL_DESTINATION_POSTGRES_USER_SSL_MODE
|
|
RootCert: "" # ZITADEL_DESTINATION_POSTGRES_USER_SSL_ROOTCERT
|
|
Cert: "" # ZITADEL_DESTINATION_POSTGRES_USER_SSL_CERT
|
|
Key: "" # ZITADEL_DESTINATION_POSTGRES_USER_SSL_KEY
|
|
|
|
EventBulkSize: 10000 # ZITADEL_EVENTBULKSIZE
|
|
# The maximum duration an auth request was last updated before it gets ignored.
|
|
# Default is 30 days
|
|
MaxAuthRequestAge: 720h # ZITADEL_MAXAUTHREQUESTAGE
|
|
|
|
Projections:
|
|
# The maximum duration a transaction remains open
|
|
# before it spots left folding additional events
|
|
# and updates the table.
|
|
TransactionDuration: 0s # ZITADEL_PROJECTIONS_TRANSACTIONDURATION
|
|
# turn off scheduler during operation
|
|
RequeueEvery: 0s
|
|
ConcurrentInstances: 7 # ZITADEL_PROJECTIONS_CONCURRENTINSTANCES
|
|
EventBulkLimit: 1000 # ZITADEL_PROJECTIONS_EVENTBULKLIMIT
|
|
Customizations:
|
|
notifications:
|
|
MaxFailureCount: 1
|
|
|
|
Eventstore:
|
|
MaxRetries: 3 # ZITADEL_EVENTSTORE_MAXRETRIES
|
|
|
|
Auth:
|
|
Spooler:
|
|
TransactionDuration: 0s #ZITADEL_AUTH_SPOOLER_TRANSACTIONDURATION
|
|
BulkLimit: 1000 #ZITADEL_AUTH_SPOOLER_BULKLIMIT
|
|
|
|
Admin:
|
|
Spooler:
|
|
TransactionDuration: 0s #ZITADEL_AUTH_SPOOLER_TRANSACTIONDURATION
|
|
BulkLimit: 10 #ZITADEL_AUTH_SPOOLER_BULKLIMIT
|
|
|
|
FirstInstance:
|
|
# We only need to create an empty zitadel database so this step must be skipped
|
|
Skip: true
|
|
|
|
Log:
|
|
Level: info
|