ClickStack & HyperDX HOLs
GitHub

CH2OTEL - ClickHouse System Metrics to OpenTelemetry Converter


Automatically convert ClickHouse Cloud system metrics and logs into OpenTelemetry standard format using Refreshable Materialized Views (RMV).

🎯 Purpose

CH2OTEL provides seamless integration between ClickHouse Cloud and OTEL-compatible observability tools: - Automatic Conversion - Transform system metrics to OTEL format - Standards Compliant - Full OpenTelemetry Logs, Traces, Metrics support - Self-Service - No collector required, runs entirely within CHC - Secure - Sensitive information managed separately

📁 File Structure

ch2otel/
├── README.md                      # This file
├── setup-ch2otel.sh              # Interactive setup script
├── .credentials                   # Auth info (Git excluded, auto-generated)
├── ch2otel.conf                  # Configuration (Git excluded, auto-generated)
├── scripts/
│   ├── status.sh                 # Check RMV and table status
│   └── refresh.sh                # Manually refresh all RMVs
└── sql/
    └── ch2otel-template.sql      # SQL template for deployment

🚀 Quick Start

cd /path/to/ch2otel
./setup-ch2otel.sh

The interactive setup will guide you through: 1. ClickHouse Cloud connection (host, password) 2. Database configuration (default: ch2otel) 3. Collection settings (refresh interval: 10 min) 4. Data retention (default: 30 days)

📖 Key Features

1. System Log Collection

Collects logs from ClickHouse system tables and converts to OTEL format:

2. OTEL Standard Tables

3. Automatic Data Management

🔍 Usage

Check Status

./scripts/status.sh

Manual Refresh

./scripts/refresh.sh

Query Data

-- Check recent logs
SELECT * FROM ch2otel.otel_logs
ORDER BY Timestamp DESC
LIMIT 10;

-- Check error logs only
SELECT * FROM ch2otel.otel_logs
WHERE SeverityText = 'ERROR'
ORDER BY Timestamp DESC
LIMIT 10;

⚙️ Configuration Changes

Change Refresh Interval

Edit ch2otel.conf:

REFRESH_INTERVAL_MINUTES=5  # Change from 10 to 5 minutes

Then regenerate and execute:

./setup-ch2otel.sh

🛠️ Troubleshooting

RMVs Not Running

SELECT view, status, exception
FROM system.view_refreshes
WHERE database = 'ch2otel';

Connection Error

source .credentials
clickhouse-client --host=$CH_HOST --user=$CH_USER --password=$CH_PASSWORD --secure --query="SELECT version()"

⚠️ Limitations

🗺️ Roadmap

v1.1 (Planned)

v2.0 (Planned)

📚 References


Refreshable Materialized View (RMV)를 사용하여 ClickHouse Cloud 시스템 메트릭과 로그를 OpenTelemetry 표준 형식으로 자동 변환합니다.

🎯 목적

CH2OTEL은 ClickHouse Cloud와 OTEL 호환 관측성 도구 간의 원활한 통합을 제공합니다: - 자동 변환 - 시스템 메트릭을 OTEL 형식으로 변환 - 표준 준수 - OpenTelemetry Logs, Traces, Metrics 완전 지원 - 자기 서비스 - Collector 불필요, CHC 내부에서 완전 동작 - 안전 - 민감 정보 분리 관리

📁 파일 구조

ch2otel/
├── README.md                      # 이 파일
├── setup-ch2otel.sh              # 대화형 설치 스크립트
├── .credentials                   # 인증 정보 (Git 제외, 자동 생성)
├── ch2otel.conf                  # 설정 파일 (Git 제외, 자동 생성)
├── scripts/
│   ├── status.sh                 # RMV 및 테이블 상태 확인
│   └── refresh.sh                # 모든 RMV 수동 갱신
└── sql/
    └── ch2otel-template.sql      # 배포용 SQL 템플릿

🚀 빠른 시작

cd /path/to/ch2otel
./setup-ch2otel.sh

대화형 설치가 다음을 안내합니다: 1. ClickHouse Cloud 연결 (호스트, 비밀번호) 2. Database 설정 (기본값: ch2otel) 3. 수집 설정 (갱신 주기: 10분) 4. 데이터 보관 (기본값: 30일)

📖 주요 기능

1. 시스템 로그 수집

ClickHouse 시스템 테이블에서 로그를 수집하고 OTEL 형식으로 변환:

2. OTEL 표준 테이블

3. 자동 데이터 관리

🔍 사용법

상태 확인

./scripts/status.sh

수동 갱신

./scripts/refresh.sh

데이터 조회

-- 최근 로그 확인
SELECT * FROM ch2otel.otel_logs
ORDER BY Timestamp DESC
LIMIT 10;

-- 에러 로그만 확인
SELECT * FROM ch2otel.otel_logs
WHERE SeverityText = 'ERROR'
ORDER BY Timestamp DESC
LIMIT 10;

⚙️ 설정 변경

Refresh 주기 변경

ch2otel.conf 파일 수정:

REFRESH_INTERVAL_MINUTES=5  # 10분에서 5분으로 변경

그 다음 재생성 및 실행:

./setup-ch2otel.sh

🛠️ 문제 해결

RMV가 실행되지 않을 때

SELECT view, status, exception
FROM system.view_refreshes
WHERE database = 'ch2otel';

연결 오류

source .credentials
clickhouse-client --host=$CH_HOST --user=$CH_USER --password=$CH_PASSWORD --secure --query="SELECT version()"

⚠️ 제한사항

🗺️ 로드맵

v1.1 (계획)

v2.0 (계획)

📚 참고 자료


Version: 1.0.0 | Last Updated: 2025-12-08 | License: MIT

License

MIT — same as the rest of the repository.

라이선스

MIT — 저장소 전체와 동일합니다.

Open this lab on GitHub →GitHub에서 이 실습 열기 →