mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 08:36:37 +08:00
docs: add package and exported symbol comments for revive lint compliance
This commit is contained in:
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package otel_trace 提供 OpenTelemetry 链路追踪封装工具
|
||||
package otel_trace
|
||||
|
||||
import "go.opentelemetry.io/otel/propagation"
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// Tracer 全局 OpenTelemetry Tracer 实例
|
||||
var Tracer trace.Tracer
|
||||
var shutdownFuncs []func(context.Context) error
|
||||
|
||||
@@ -45,6 +46,7 @@ func init() {
|
||||
Tracer = tracerProvider.Tracer("github.com/Rain-kl/Wavelet")
|
||||
}
|
||||
|
||||
// Shutdown 关闭所有 Trace Provider
|
||||
func Shutdown(ctx context.Context) {
|
||||
for _, fn := range shutdownFuncs {
|
||||
_ = fn(ctx)
|
||||
@@ -52,6 +54,7 @@ func Shutdown(ctx context.Context) {
|
||||
shutdownFuncs = nil
|
||||
}
|
||||
|
||||
// Start 创建一个新的 Trace Span
|
||||
func Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
|
||||
return Tracer.Start(ctx, name, opts...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user