Trace Context Scope (core/TraceScope.java)

ruoyi-ai · ruoyi-common/ruoyi-common-trace/src/main/java/org/ruoyi/common/trace/core/TraceScope.java · java · MIT
infra, lang:java, tag:trace, tag:context

Manages execution trace contexts and scopes with automatic cleanup. Reuse when implementing distributed tracing and context propagation in Java.

// Source: https://github.com/ageerle/ruoyi-ai | License: MIT | Copyright 2026 ruoyi-ai
// Provided via justclaw.it.com; keep this notice with the code.
package org.ruoyi.common.trace.core;

/**
 * Trace 上下文作用域。
 */
public final class TraceScope implements AutoCloseable {

    private final String previousTraceId;
    private final String previousBusinessType;
    private final String previousBusinessId;
    private final Long previousUserId;
    private final String previousTenantId;

    TraceScope(String previousTraceId,
               String previousBusinessType,
               String previousBusinessId,
               Long previousUserId,
               String previousTenantId) {
        this.previousTraceId = previousTraceId;
        this.previousBusinessType = previousBusinessType;


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key