Skip to content

feat(services): add OpenTelemetry tracing to Storage, Function, Database, and Cache services#370

Merged
poyrazK merged 1 commit intomainfrom
feat/opentelemetry-tracing-v2
Apr 30, 2026
Merged

feat(services): add OpenTelemetry tracing to Storage, Function, Database, and Cache services#370
poyrazK merged 1 commit intomainfrom
feat/opentelemetry-tracing-v2

Conversation

@poyrazK
Copy link
Copy Markdown
Owner

@poyrazK poyrazK commented Apr 30, 2026

Summary

Instrument StorageService, FunctionService, DatabaseService, and CacheService with OpenTelemetry spans for improved observability. Closes #339.

This supersedes PR #369 (now closed — it accidentally included unrelated resource-limit changes).

Changes

  • StorageService (storage-service): Upload, Download, CreateBucket, DeleteBucket
  • FunctionService (function-service): CreateFunction, InvokeFunction, GetFunctionLogs
  • DatabaseService (database-service): CreateDatabase, RestoreDatabase, doRotateCredentials
  • CacheService (cache-service): CreateCache, GetCacheStats

Implementation

Each method follows the established OTel pattern:

tracer := otel.Tracer(tracerName)
_, span := tracer.Start(ctx, "Service.Method",
    trace.WithAttributes(
        attribute.String("field", value),
    ))
defer span.End()
// ... existing logic ...
if err != nil {
    span.RecordError(err)
    return nil, err
}

Uses _ for the span-wrapped context to avoid propagating trace context into repo/mock calls (which would break mock equality assertions in unit tests).

Test Plan

  • go build ./internal/core/services/...
  • go test ./internal/core/services/... -count=1 (all pass)

Verification

With TRACING_ENABLED=true and Jaeger running locally, traces will appear at http://localhost:16686.

…ase, and Cache services

Instrument the following high-value methods with spans following the existing
tracing pattern (otel.Tracer + defer span.End + span.RecordError):

- StorageService: Upload, Download, CreateBucket, DeleteBucket
- FunctionService: CreateFunction, InvokeFunction, GetFunctionLogs
- DatabaseService: CreateDatabase, RestoreDatabase, doRotateCredentials
- CacheService: CreateCache, GetCacheStats

Uses tracer name constants (e.g. "storage-service") for consistency with
existing otelgin middleware and pkg/tracing infrastructure.

Closes #339.
Copilot AI review requested due to automatic review settings April 30, 2026 12:51
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@poyrazK has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 40 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: deed6d11-792d-435a-a768-02e8e5c2ebe1

📥 Commits

Reviewing files that changed from the base of the PR and between b4819c0 and 2e6a0f4.

📒 Files selected for processing (4)
  • internal/core/services/cache.go
  • internal/core/services/database.go
  • internal/core/services/function.go
  • internal/core/services/storage.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/opentelemetry-tracing-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 9 minutes and 40 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@poyrazK poyrazK merged commit 69dc082 into main Apr 30, 2026
26 of 27 checks passed
@poyrazK poyrazK deleted the feat/opentelemetry-tracing-v2 branch April 30, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement distributed tracing with OpenTelemetry and Jaeger

2 participants