← スキル一覧に戻る

observability
by cemezgin
⭐ 0🍴 0📅 2026年1月25日
SKILL.md
name: observability description: Tracing with OpenTelemetry and structured logging with slog. Use when adding observability to services, handlers, or debugging production issues. userInvokable: true
Observability
References: Examples
Tracing (OpenTelemetry)
Mandatory for: repositories, API clients, Lambdas, usecases
func (s *Service) GetOrder(ctx context.Context, id string) (*Order, error) {
ctx, span := tracing.StartSpan(ctx, "Service.GetOrder")
defer span.End()
span.SetAttributes(attribute.String("order.id", id))
// business logic...
}
Structured Logging (slog)
Use log/slog with structured JSON:
slog.InfoContext(ctx, "order retrieved",
"order_id", orderID,
"reference_id", referenceID,
)
Log Levels
| Level | Use When |
|---|---|
| INFO | Normal operations, successful requests |
| WARN | Recoverable errors, degraded state, fallbacks used |
| ERROR | Failures requiring attention, unrecoverable errors |
Lambda Lifecycle
func main() {
ctx := context.Background()
otelShutdown, err := otel.Setup(ctx)
if err != nil {
fmt.Printf("Error setting up OpenTelemetry: %v\n", err)
os.Exit(1)
}
defer func() {
if err := otelShutdown(context.Background()); err != nil {
fmt.Printf("Error shutting down: %v\n", err)
}
}()
lambda.Start(otellambda.InstrumentHandler(handler))
}
HTTP Client Tracing
client := tracing.NewRestyClient(baseURL,
tracing.WithTimeout(30*time.Second),
tracing.WithRetryCount(3),
)
スコア
総合スコア
45/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です