Skip to content

Instantly share code, notes, and snippets.

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
@tamaco489
tamaco489 / dashboards.yaml
Created February 22, 2026 14:24
dashboards.yaml
# DOC: [Provision Grafana] https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards
# DOC: [Github Sample] https://github.com/grafana/grafana/blob/main/conf/provisioning/dashboards/sample.yaml
# プロビジョニング設定のバージョン (現時点では 1 のみ)
apiVersion: 1
providers:
# Grafana 起動時に JSON ファイルから自動的にダッシュボードを読み込む設定
- name: "default"
orgId: 1 # 組織 ID (デフォルトは 1)
### OpenTelemetryを使用したローカルインフラストラクチャのサンプルリクエスト集
### 変数定義
@baseUrl = http://localhost:8080
### 記事取得 (トレースとメトリクスが記録される)
GET {{baseUrl}}/articles/article-001
### 別の記事取得
GET {{baseUrl}}/articles/test-001
@tamaco489
tamaco489 / loki.yaml
Created February 22, 2026 05:51
Grafana Loki config for collecting and storing Docker container logs with TSDB schema (single-node, filesystem backend)
# Reference:
# DOC: [Configure Loki] https://grafana.com/docs/loki/latest/configure/
# DOC: [Getting Started Example] https://github.com/grafana/loki/tree/v3.6.0/examples/getting-started
# マルチテナント認証を無効化 (有効の場合、全リクエストに X-Scope-OrgID ヘッダーが必要になるため)
auth_enabled: false
# HTTP サーバー設定
server:
# Loki の HTTP API ポート (Alloy からのログ書き込みと Grafana からのクエリを受け付ける)
@tamaco489
tamaco489 / prometheus.yaml
Created February 22, 2026 05:48
Prometheus config for scraping Grafana Alloy health metrics and receiving remote write from Alloy
# Reference:
# DOC: [Configuration] https://prometheus.io/docs/prometheus/latest/configuration/configuration/
global:
# ターゲットからメトリクスを取得する間隔 (デフォルト 15s)
scrape_interval: 20s
# アラートルールの評価間隔 (この構成では未使用だが global の必須フィールド)
evaluation_interval: 20s
@tamaco489
tamaco489 / tempo.yaml
Created February 22, 2026 05:45
Grafana Tempo config for receiving OTLP traces via gRPC and storing them on local filesystem
# Reference:
# DOC: [Github] https://github.com/grafana/intro-to-mltp/blob/main/tempo/tempo.yaml
# Grafana がトレースクエリ結果をストリーミング形式で受け取れるようにする
# スパン数が多いトレース (数百~数千スパン) を表じする際、全データの取得完了を待つと Grafana 側での表示遅延が発生する可能性があるため
stream_over_http_enabled: true
server:
# Tempo の HTTP API ポート (Grafana は 3200 番ポートで接続し、トレースクエリを実行する)
http_listen_port: 3200
@tamaco489
tamaco489 / config.alloy
Created February 22, 2026 05:44
Grafana Alloy config for collecting OTLP traces/metrics and Docker container logs, forwarding to Tempo, Prometheus, and Loki
// ==========================================================
// Reference
// ==========================================================
// DOC: [Grafana Alloy Reference] https://grafana.com/docs/alloy/latest/reference/
// DOC: [Components] https://grafana.com/docs/alloy/latest/get-started/components/
// ==========================================================
// OTLP 受信 (トレース・メトリクス)
// ==========================================================
// アプリから送られる OTLP テレメトリデータの受け口 (gRPC / HTTP の 2 プロトコルで待ち受け、受信データをバッチ処理へ渡す)
@tamaco489
tamaco489 / docker-compose.otel-local-stack.yaml
Last active February 23, 2026 04:53
Local OpenTelemetry observability stack (Alloy + Tempo + Prometheus + Loki + Grafana) for Go applications
services:
# アプリケーションサーバー (Go): OTLP でテレメトリを送信
article-server:
container_name: article-server
build:
context: .
dockerfile: article_server/Dockerfile
ports:
- "8080:8080"
environment: