kohaku

package module
v0.0.0-...-bf0a844 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

README

WebRTC Stats Collector Kohaku (レガシー版)

[!IMPORTANT]
このライブラリはメンテナンスモードで、バグフィックスのみ対応します

新しい Kohaku の公開までは 2023.1.1 をご利用ください。

https://github.com/shiguredo/kohaku/tree/2023.1.1

新しい Kohaku について

現在、新しい Kohaku を開発中です。新しい Kohaku はレガシー版の Kohaku とは互換性がありません。

新しい Kohaku は WebRTC Stats Analyzer Kohaku として、 複数の OSS を組み合わせたソリューションを提供予定です。

  • Grafana
  • Grafana DuckDB DataSource Plugin
  • DuckDB
  • Fluent Bit
  • MinIO
    • S3 または S3 互換オブジェクトストレージサービスを利用可能

今までの Sora は TimescaleDB にデータを保存していましたが、統計やログの情報は膨大なためスケールが難しいという課題がありました。また、Kohaku を運用するコストもかかります。

その課題を解決するため、統計エクスポーターや統計ウェブフックなどを利用せず、Sora が出力するログをオブジェクトストレージに転送し、それを DuckDB で解析するという仕組みを採用しました。

スケールさせやすいオブジェクトストレージを軸とし、DuckDB での解析と Grafana での可視化を行う仕組みを提供予定です。

2025 年の春までには公開予定です。

WebRTC Stats Collector Kohaku

GitHub tag (latest SemVer) License

About Shiguredo's open source software

We will not respond to PRs or issues that have not been discussed on Discord. Also, Discord is only available in Japanese.

Please read https://github.com/shiguredo/oss/blob/master/README.en.md before use.

時雨堂のオープンソースソフトウェアについて

利用前に https://github.com/shiguredo/oss をお読みください。

ライセンス

Apache License 2.0

Copyright 2021-2025, Hiroshi Yoshida (Original Author)
Copyright 2021-2025, Shiguredo Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

記事

Documentation

Index

Constants

View Source
const (
	DefaultStatsWebhookPath = "/stats"

	DefaultLogDir  = "."
	DefaultLogName = "kohaku.jsonl"

	// megabytes
	DefaultLogRotateMaxSize    = 200
	DefaultLogRotateMaxBackups = 7
	// days
	DefaultLogRotateMaxAge = 30

	DefaultExporterListenAddr = "0.0.0.0"
	DefaultExporterListenPort = 5891
)

Variables

View Source
var Version string

Functions

func InitLogger

func InitLogger(config *Config) error

InitLogger ロガーを初期化する

func NewConnect

func NewConnect(config *Config) (driver.Conn, error)

func ShowConfig

func ShowConfig(config *Config)

Types

type Config

type Config struct {
	Debug bool `ini:"debug"`

	LogDir    string `ini:"log_dir"`
	LogName   string `ini:"log_name"`
	LogStdout bool   `ini:"log_stdout"`

	// MB
	LogRotateMaxSize    int `ini:"log_rotate_max_size"`
	LogRotateMaxBackups int `ini:"log_rotate_max_backups"`
	// Days
	LogRotateMaxAge int `ini:"log_rotate_max_age"`

	StatsWebhookPath string `ini:"stats_webhook_path"`

	ClickHouseAddr string `ini:"clickhouse_addr"`
	ClickHousePort int    `ini:"clickhouse_port"`

	ClickHouseDatabase string `ini:"clickhouse_database"`
	ClickHouseUsername string `ini:"clickhouse_username"`
	ClickHousePassword string `ini:"clickhouse_password"`

	ClickHouseDebug bool `ini:"click_house_debug"`

	HTTPS      bool   `ini:"https"`
	ListenAddr string `ini:"listen_addr"`
	ListenPort int    `ini:"listen_port"`

	// exporter で https を使うかどうか
	// tailscale などを使う場合は不要
	ExporterHTTPS      bool   `ini:"exporter_https"`
	ExporterListenAddr string `ini:"exporter_listen_addr"`
	ExporterListenPort int    `ini:"exporter_listen_port"`

	TLSFullchainFile    string `ini:"tls_fullchain_file"`
	TLSPrivkeyFile      string `ini:"tls_privkey_file"`
	TLSVerifyCacertPath string `ini:"tls_verify_cacert_path"`
}

func NewConfig

func NewConfig(configFilePath string) (*Config, error)

type RTCStats

type RTCStats struct {
	Timestamp float64 `json:"timestamp"`
	ID        string  `json:"id"`
	Type      string  `json:"type"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c *Config, conn driver.Conn) (*Server, error)

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) StartExporter

func (s *Server) StartExporter(ctx context.Context) error

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) error

Directories

Path Synopsis
cmd
kohaku command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL