Skip to content

chore: add e2e test use case#239

Merged
xuthus5 merged 1 commit intoopenGemini:mainfrom
chenhuansome:ci-otel-pipeline
Oct 12, 2025
Merged

chore: add e2e test use case#239
xuthus5 merged 1 commit intoopenGemini:mainfrom
chenhuansome:ci-otel-pipeline

Conversation

@chenhuansome
Copy link
Contributor

@chenhuansome chenhuansome commented Sep 28, 2025

What problem does this PR solve?

This PR implements full OpenTelemetry tracing support for the OpenGemini Go client, including a complete integration test suite that validates tracing data is properly stored and queried in OpenGemini database.

Key Features

  1. OpenTelemetry SDK Integration
  • Complete tracing pipeline setup with proper shutdown handling
  • Support for both OTLP gRPC and HTTP exporters
  • Configurable batch processing with 1-second timeout
  1. Dual Exporter Configuration
exporter, err := otlptracegrpc.New(ctx,
    otlptracegrpc.WithEndpoint("127.0.0.1:18086"),
    otlptracegrpc.WithInsecure())
  1. Comprehensive Integration Tests

New test suite in tests/trace/trace_test.go validates:

  • Trace Data Generation: All client operations generate spans
  • Data Storage: Spans are stored in OpenGemini (jaeger_storage.trace measurement)
  • Data Verification: Query and validate stored trace data
  1. Test Coverage
TestOtelClient_WriteInterceptors()    // Tests write operations
TestOtelClient_ShowTagKeys()          // Tests metadata operations  
TestOtelCreateAndQueryMeasurement()   // Tests schema operations

Test Validation Strategy

Each test validates that the expected number of spans are created and stored:

// Must find 2 spans: create database + write point
if len(series.Values) != 2 {
    panic("expected 2 values")
}

// Must find 5 spans: create db + write point + create measurement + show tag keys + drop db  
if len(series.Values) != 5 {
    panic("expected 5 values")
}

Infrastructure Changes

  1. New Test Module
  • Created tests/trace/ module with dedicated dependencies
  • Isolated integration testing from unit tests
  1. CI/CD Integration
# GitHub workflow updates
- name: setup ts-trace
  run: go install github.com/openGemini/observability/trace/cmd/ts-trace@latest && ts-trace &
  1. Dependency Upgrades
  • Upgraded from github.com/golang/snappy to github.com/klauspost/compress/snappy
  • Better compression performance and maintenance

Testing Workflow

  1. Setup: Initialize OpenTelemetry SDK with ts-trace exporter
  2. Execute: Perform database operations through traced client
  3. Validate: Query jaeger_storage.trace measurement to verify spans
  4. Cleanup: Drop test measurement after each test

Verification Results

Tests confirm that all client operations properly:

  • [✓ ] Generate OpenTelemetry spans

  • [✓ ] Export to ts-trace collector

  • [✓ ] Store in OpenGemini database

  • [✓ ] Are queryable for validation

*related documents:
openGemini/openGemini.github.io#163

@dosubot
Copy link

dosubot bot commented Sep 28, 2025

Related Documentation

Checked 2 published document(s). No updates required.

You have 3 draft document(s). Publish docs to keep them always up-to-date

How did I do? Any feedback?  Join Discord

@chenhuansome chenhuansome changed the title Ci otel pipeline chore: add PR title line pipeline for otel feature Sep 28, 2025
@chenhuansome chenhuansome changed the title chore: add PR title line pipeline for otel feature chore: add ci config about otel Sep 30, 2025
@chenhuansome chenhuansome changed the title chore: add ci config about otel chore: add e2e test use case Oct 12, 2025
Signed-off-by: chenhuan <xiangyuyu_2024@qq.com>
@xuthus5 xuthus5 merged commit 17d0cc6 into openGemini:main Oct 12, 2025
11 checks passed
@dosubot
Copy link

dosubot bot commented Oct 12, 2025

Documentation Updates

Checked 2 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

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.

2 participants