Skip to content

Commit

Permalink
chore: update opentelemetry example
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed May 23, 2023
1 parent 7317d34 commit f3511d3
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 189 deletions.
53 changes: 0 additions & 53 deletions example/opentelemetry/config/alertmanager.yml

This file was deleted.

4 changes: 0 additions & 4 deletions example/opentelemetry/config/vector.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
39 changes: 15 additions & 24 deletions example/opentelemetry/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -45,7 +50,7 @@ services:
clickhouse:
condition: service_healthy

otel-collector:
otelcol:
image: otel/opentelemetry-collector-contrib:0.58.0
restart: on-failure
volumes:
Expand All @@ -55,30 +60,16 @@ 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
ports:
- '8025:8025'

volumes:
uptrace_data:
ch_data:
pg_data:
alertmanager_data:
ch_data1:
pg_data4:
163 changes: 55 additions & 108 deletions example/opentelemetry/uptrace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
##
Expand Down Expand Up @@ -95,110 +109,42 @@ 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
# # The Application Audience (AUD) Tag for this application.
# # 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://<uptrace-host>/api/v1/sso/<oidc-id>/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://<uptrace-host>/api/v1/sso/<oidc-id>/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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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://<user>:<password>@<host>:<port>/<database>?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.
Expand All @@ -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.
##
Expand Down

0 comments on commit f3511d3

Please sign in to comment.