From f3511d36a0622999bc9984278174f16f6fd11843 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 23 May 2023 09:37:27 +0300 Subject: [PATCH] chore: update opentelemetry example --- example/opentelemetry/config/alertmanager.yml | 53 ------ example/opentelemetry/config/vector.toml | 4 - example/opentelemetry/docker-compose.yml | 39 ++--- example/opentelemetry/uptrace.yml | 163 ++++++------------ 4 files changed, 70 insertions(+), 189 deletions(-) delete mode 100644 example/opentelemetry/config/alertmanager.yml diff --git a/example/opentelemetry/config/alertmanager.yml b/example/opentelemetry/config/alertmanager.yml deleted file mode 100644 index 9ea790dbd..000000000 --- a/example/opentelemetry/config/alertmanager.yml +++ /dev/null @@ -1,53 +0,0 @@ -# See https://prometheus.io/docs/alerting/latest/configuration/ for details. - -global: - # The smarthost and SMTP sender used for mail notifications. - smtp_smarthost: 'mailhog:1025' - smtp_from: 'alertmanager@example.com' - smtp_require_tls: false - -receivers: - - name: 'team-X' - email_configs: - - to: 'some-receiver@example.com' - send_resolved: true - -# The root route on which each incoming alert enters. -route: - # The labels by which incoming alerts are grouped together. For example, - # multiple alerts coming in for cluster=A and alertname=LatencyHigh would - # be batched into a single group. - group_by: ['alertname', 'cluster', 'service'] - - # When a new group of alerts is created by an incoming alert, wait at - # least 'group_wait' to send the initial notification. - # This way ensures that you get multiple alerts for the same group that start - # firing shortly after another are batched together on the first - # notification. - group_wait: 30s - - # When the first notification was sent, wait 'group_interval' to send a batch - # of new alerts that started firing for that group. - group_interval: 5m - - # If an alert has successfully been sent, wait 'repeat_interval' to - # resend them. - repeat_interval: 3h - - # A default receiver - receiver: team-X - - # All the above attributes are inherited by all child routes and can - # overwritten on each. - - # The child route trees. - routes: - # This route matches error alerts created from spans or logs. - - matchers: - - alert_kind="error" - group_interval: 24h - receiver: team-X - -# The directory from which notification templates are read. -templates: - - '/etc/alertmanager/template/*.tmpl' diff --git a/example/opentelemetry/config/vector.toml b/example/opentelemetry/config/vector.toml index 10db91dd2..3e6aa9e5f 100644 --- a/example/opentelemetry/config/vector.toml +++ b/example/opentelemetry/config/vector.toml @@ -1,22 +1,18 @@ [sources.syslog_logs] type = "demo_logs" format = "syslog" -interval = 0.1 [sources.apache_common_logs] type = "demo_logs" format = "apache_common" -interval = 0.1 [sources.apache_error_logs] type = "demo_logs" format = "apache_error" -interval = 0.1 [sources.json_logs] type = "demo_logs" format = "json" -interval = 0.1 # Parse Syslog logs # See the Vector Remap Language reference for more info: https://vrl.dev diff --git a/example/opentelemetry/docker-compose.yml b/example/opentelemetry/docker-compose.yml index feed4c180..d22f3e3f9 100644 --- a/example/opentelemetry/docker-compose.yml +++ b/example/opentelemetry/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: clickhouse: - image: clickhouse/clickhouse-server:22.7 + image: clickhouse/clickhouse-server:22.10 restart: on-failure environment: CLICKHOUSE_DB: uptrace @@ -12,29 +12,34 @@ services: timeout: 1s retries: 30 volumes: - - ch_data:/var/lib/clickhouse + - ch_data1:/var/lib/clickhouse ports: - '8123:8123' - '9000:9000' postgres: - image: postgres:14.2-alpine + image: postgres:15-alpine restart: on-failure environment: PGDATA: /var/lib/postgresql/data/pgdata POSTGRES_USER: uptrace POSTGRES_PASSWORD: uptrace + POSTGRES_DB: uptrace + healthcheck: + test: ['CMD-SHELL', 'pg_isready'] + interval: 1s + timeout: 1s + retries: 30 volumes: - - 'pg_data:/var/lib/postgresql/data/pgdata' + - 'pg_data4:/var/lib/postgresql/data/pgdata' ports: - '5432:5432' uptrace: - image: 'uptrace/uptrace:1.3.0' + image: 'uptrace/uptrace:1.4.7' #image: 'uptrace/uptrace-dev:latest' restart: on-failure volumes: - - uptrace_data:/var/lib/uptrace - ./uptrace.yml:/etc/uptrace/uptrace.yml #environment: # - DEBUG=2 @@ -45,7 +50,7 @@ services: clickhouse: condition: service_healthy - otel-collector: + otelcol: image: otel/opentelemetry-collector-contrib:0.58.0 restart: on-failure volumes: @@ -55,22 +60,10 @@ services: - '4318:4318' vector: - image: timberio/vector:0.24.X-alpine + image: timberio/vector:0.28.X-alpine volumes: - ./config/vector.toml:/etc/vector/vector.toml:ro - alertmanager: - image: prom/alertmanager:v0.24.0 - restart: on-failure - volumes: - - ./config/alertmanager.yml:/etc/alertmanager/config.yml - - alertmanager_data:/alertmanager - ports: - - 9093:9093 - command: - - '--config.file=/etc/alertmanager/config.yml' - - '--storage.path=/alertmanager' - mailhog: image: mailhog/mailhog:v1.0.1 restart: on-failure @@ -78,7 +71,5 @@ services: - '8025:8025' volumes: - uptrace_data: - ch_data: - pg_data: - alertmanager_data: + ch_data1: + pg_data4: diff --git a/example/opentelemetry/uptrace.yml b/example/opentelemetry/uptrace.yml index 0fe71953c..3f5b7834d 100644 --- a/example/opentelemetry/uptrace.yml +++ b/example/opentelemetry/uptrace.yml @@ -29,6 +29,20 @@ ch: # Maximum query execution time. max_execution_time: 30s +## +## PostgreSQL db that is used to store metadata such us metric names, dashboards, alerts, +## and so on. +## +pg: + addr: postgres:5432 + user: uptrace + password: uptrace + database: uptrace + + # TLS configuration. Uncomment to enable. + # tls: + # insecure_skip_verify: true # only for self-signed certificates + ## ## A list of pre-configured projects. Each project is fully isolated. ## @@ -95,82 +109,17 @@ metrics_from_spans: where: span.is_event ## -## Alerting rules for monitoring metrics. -## -## See https://uptrace.dev/get/alerting.html for details. -## -alerting: - rules: - - name: Network errors - metrics: - - system.network.errors as $net_errors - query: - - $net_errors > 0 group by host.name - # for the last 5 minutes - for: 5m - annotations: - summary: '{{ $labels.host_name }} has high number of net errors: {{ $values.net_errors }}' - - - name: Filesystem usage >= 90% - metrics: - - system.filesystem.usage as $fs_usage - query: - - group by host.name - - group by device - - where device !~ "loop" - - $fs_usage{state="used"} / $fs_usage >= 0.9 - for: 5m - annotations: - summary: '{{ $labels.host_name }} has high FS usage: {{ $values.fs_usage }}' - - - name: Uptrace is dropping spans - metrics: - - uptrace.projects.spans as $spans - query: - - $spans{type=dropped} > 0 - for: 1m - annotations: - summary: 'Uptrace has dropped {{ $values.spans }} spans' - - - name: Always firing (for fun and testing) - metrics: - - process.runtime.go.goroutines as $goroutines - query: - - $goroutines >= 0 group by host.name - for: 1m - annotations: - summary: '{{ $labels.host_name }} has high number of goroutines: {{ $values.goroutines }}' - - # Create alerts from error logs and span events. - create_alerts_from_spans: - enabled: true - labels: - alert_kind: error - -## -## AlertManager client configuration. -## See https://uptrace.dev/get/alerting.html for details. -## -## Note that this is NOT an AlertManager config and you need to configure AlertManager separately. -## See https://prometheus.io/docs/alerting/latest/configuration/ for details. -## -alertmanager_client: - # AlertManager API endpoints that Uptrace uses to manage alerts. - urls: - - 'http://alertmanager:9093/api/v2/alerts' - -## -## To require authentication, uncomment the following section. +## To require authentication, uncomment one of the following sections. ## auth: - # users: - # - username: uptrace - # password: uptrace - # - username: admin - # password: admin - - # # Cloudflare user provider: uses Cloudflare Zero Trust Access (Identity) - # # See https://developers.cloudflare.com/cloudflare-one/identity/ for more info. + users: + - name: Anonymous + email: uptrace@localhost + password: uptrace + notify_by_email: true + + # Cloudflare Zero Trust Access (Identity) + # See https://developers.cloudflare.com/cloudflare-one/identity/ for more info. # cloudflare: # # The base URL of the Cloudflare Zero Trust team. # - team_url: https://myteam.cloudflareaccess.com @@ -178,27 +127,24 @@ auth: # # You can retrieve this from the Cloudflare Zero Trust 'Access' Dashboard. # audience: bea6df23b944e4a0cd178609ba1bb64dc98dfe1f66ae7b918e563f6cf28b37e0 - # # OpenID Connect (Single Sign-On) - # oidc: - # # The ID is used in API endpoints, for example, in redirect URL - # # `http:///api/v1/sso//callback`. - # - id: keycloak - # # Display name for the button in the login form. - # # Default to 'OpenID Connect' - # display_name: Keycloak - # # The base URL for the OIDC provider. - # issuer_url: http://localhost:8080/realms/uptrace - # # The OAuth 2.0 Client ID - # client_id: uptrace - # # The OAuth 2.0 Client Secret - # client_secret: ogbhd8Q0X0e5AZFGSG3m9oirPvnetqkA - # # Additional OAuth 2.0 scopes to request from the OIDC provider. - # # Defaults to 'profile'. 'openid' is requested by default and need not be specified. - # scopes: - # - profile - # # The OIDC UserInfo claim to use as the user's username. - # # Defaults to 'preferred_username'. - # claim: preferred_username + # OpenID Connect (Single Sign-On) + oidc: + # # The ID is used in API endpoints, for example, in redirect URL + # # `http:///api/v1/sso//callback`. + # - id: keycloak + # # Display name for the button in the login form. + # # Default to 'OpenID Connect' + # display_name: Keycloak + # # The base URL for the OIDC provider. + # issuer_url: http://localhost:8080/realms/uptrace + # # The OAuth 2.0 Client ID + # client_id: uptrace + # # The OAuth 2.0 Client Secret + # client_secret: ogbhd8Q0X0e5AZFGSG3m9oirPvnetqkA + # # Additional OAuth 2.0 scopes to request from the OIDC provider. + # # Defaults to 'profile'. 'openid' is requested by default and need not be specified. + # scopes: + # - profile ## ## Various options to tweak ClickHouse schema. @@ -248,6 +194,8 @@ listen: site: # Overrides public URL for Vue-powered UI in case you put Uptrace behind a proxy. #addr: 'https://uptrace.mydomain.com' + # The base path for the Vue-powered UI in case you serve Uptrace UI behind a sub path. + path: '/' ## ## Spans processing options. @@ -277,19 +225,6 @@ metrics: # The number of measures to insert in a single query. #batch_size: 10000 -## -## SQLite/PostgreSQL db that is used to store metadata such us metric names, dashboards, alerts, -## and so on. -## -db: - # Either sqlite or postgres. - driver: postgres - # Connection string for PostgreSQL database. For example: - # postgres://:@:/?sslmode=disable - # - # See https://bun.uptrace.dev/postgres/ - dsn: postgres://uptrace:uptrace@postgres:5432/uptrace?sslmode=disable - ## ## uptrace-go client configuration. ## Uptrace sends internal telemetry here. Defaults to listen.grpc.addr. @@ -301,6 +236,18 @@ uptrace_go: # key_file: config/tls/uptrace.key # insecure_skip_verify: true +## +## SMTP settings to send emails. +## https://uptrace.dev/get/alerting.html +## +smtp_mailer: + enabled: true + host: mailhog + port: 1025 + username: mailhog + password: mailhog + from: 'uptrace@localhost' + ## ## Logging configuration. ##