MCPcopy
hub / github.com/redis/go-redis / funcFileLine

Function funcFileLine

extra/redisotel/tracing.go:201–225  ·  view source on GitHub ↗
(pkg string)

Source from the content-addressed store, hash-verified

199}
200
201func funcFileLine(pkg string) (string, string, int) {
202 const depth = 16
203 var pcs [depth]uintptr
204 n := runtime.Callers(3, pcs[:])
205 ff := runtime.CallersFrames(pcs[:n])
206
207 var fn, file string
208 var line int
209 for {
210 f, ok := ff.Next()
211 if !ok {
212 break
213 }
214 fn, file, line = f.Function, f.File, f.Line
215 if !strings.Contains(fn, pkg) {
216 break
217 }
218 }
219
220 if ind := strings.LastIndexByte(fn, '/'); ind != -1 {
221 fn = fn[ind+1:]
222 }
223
224 return fn, file, line
225}
226
227// Database span attributes semantic conventions recommended server address and port
228// https://opentelemetry.io/docs/specs/semconv/database/database-spans/#connection-level-attributes

Callers 2

ProcessHookMethod · 0.85
ProcessPipelineHookMethod · 0.85

Calls 2

NextMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected