MCPcopy Create free account
hub / github.com/PostHog/duckgres / sendProfilingMetadata

Function sendProfilingMetadata

duckdbservice/profiling.go:25–36  ·  view source on GitHub ↗

sendProfilingMetadata reads the profiling output file written by DuckDB and sends it as gRPC trailing metadata so the control plane can attach it to the trace span.

(ctx context.Context, session *Session)

Source from the content-addressed store, hash-verified

23// clearProfilingOutput removes the previous statement's profile before a
24// statement begins. The returned timestamp is used to reject a profile that
25// was not produced by this execution.
26func clearProfilingOutput() time.Time {
27 _ = os.Remove(profilingOutputPath)
28 return time.Now()
29}
30
31func profilingMetadataSince(startedAt time.Time) string {
32 info, err := os.Stat(profilingOutputPath)
33 if err != nil || !info.ModTime().After(startedAt) {
34 return ""
35 }
36 data, err := os.ReadFile(profilingOutputPath)
37 if err != nil || len(data) == 0 {
38 return ""
39 }

Callers 2

Calls 2

SetTrailerMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected