agentsclimarketplace

Observability

Skill cemezgin/go-service-guide/skills/observability

Tracing with OpenTelemetry and structured logging with slog. Use when adding observability to services, handlers, or debugging production issues.From its SKILL.md

Install
npx -y skills add cemezgin/go-service-guide --skill observability

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.7 KB, as published. Nobody here has run it

Observability

References: Examples

Tracing (OpenTelemetry)

Example

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)

Example

Use log/slog with structured JSON:

slog.InfoContext(ctx, "order retrieved",
    "order_id", orderID,
    "reference_id", referenceID,
)

Log Levels

LevelUse When
INFONormal operations, successful requests
WARNRecoverable errors, degraded state, fallbacks used
ERRORFailures requiring attention, unrecoverable errors

Lambda Lifecycle

Example

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

Example

client := tracing.NewRestyClient(baseURL,
    tracing.WithTimeout(30*time.Second),
    tracing.WithRetryCount(3),
)

Keep looking

Skills are one crate of 626,474. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.