trpc.group/trpc-go/trpc-go@v1.0.3/rpcz/config.go (about) 1 // 2 // 3 // Tencent is pleased to support the open source community by making tRPC available. 4 // 5 // Copyright (C) 2023 THL A29 Limited, a Tencent company. 6 // All rights reserved. 7 // 8 // If you have downloaded a copy of the tRPC source code from Tencent, 9 // please note that tRPC source code is licensed under the Apache 2.0 License, 10 // A copy of the Apache 2.0 License is included in this file. 11 // 12 // 13 14 package rpcz 15 16 // Config stores the config of rpcz. 17 type Config struct { 18 Fraction float64 19 Capacity uint32 20 ShouldRecord ShouldRecord 21 Exporter SpanExporter 22 } 23 24 func (c *Config) shouldRecord() ShouldRecord { 25 if c.ShouldRecord == nil { 26 return AlwaysRecord 27 } 28 return c.ShouldRecord 29 } 30 31 // ShouldRecord determines if the Span should be recorded. 32 type ShouldRecord = func(Span) bool 33 34 // AlwaysRecord always records span. 35 func AlwaysRecord(_ Span) bool { return true }