Skip to content

Commit 2a2f265

Browse files
authored
Merge pull request #44 from derrickstolee/custom-summary-clean
Create a new summary configuration for statistics of regions and printf events
2 parents 576ec02 + dccc5de commit 2a2f265

File tree

12 files changed

+1389
-1
lines changed

12 files changed

+1389
-1
lines changed

Docs/Examples/summary_example.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Example summary configuration
2+
# This file demonstrates how to configure summary metrics tracking
3+
4+
# Message pattern rules - count messages matching specific prefixes
5+
message_patterns:
6+
# Count messages starting with "gh_client__queue_oid:"
7+
- prefix: "gh_client__queue_oid:"
8+
field_name: "queuedCount"
9+
10+
# Count messages starting with "gh_client__get_immediate:"
11+
- prefix: "gh_client__get_immediate:"
12+
field_name: "immediateCount"
13+
14+
# Region timer rules - aggregate time spent in regions by category/label
15+
region_timers:
16+
# Track prefetch operations
17+
- category: "gh-client"
18+
label: "objects/prefetch"
19+
count_field: "prefetchCount"
20+
time_field: "prefetchTime"
21+
22+
# Track immediate get operations
23+
- category: "gh-client"
24+
label: "objects/get"
25+
count_field: "getCount"
26+
time_field: "getTime"
27+
28+
# Track batch operations
29+
- category: "gvfs-helper"
30+
label: "objects/post"
31+
count_field: "batchCount"
32+
time_field: "batchTime"
33+
34+
# Example output in OTEL span attributes:
35+
# {
36+
# "trace2.process.summary": {
37+
# "queuedCount": 405,
38+
# "immediateCount": 128,
39+
# "prefetchCount": 1,
40+
# "prefetchTime": 30.4,
41+
# "getCount": 127,
42+
# "getTime": 50.3,
43+
# "batchCount": 1,
44+
# "batchTime": 12.3
45+
# }
46+
# }

config.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ type Config struct {
5252
// Pathname to YML file containing our filter settings.
5353
FilterSettingsPath string `mapstructure:"filter"`
5454
filterSettings *FilterSettings
55+
56+
// Pathname to YML file containing summary settings.
57+
SummaryPath string `mapstructure:"summary"`
58+
summary *SummarySettings
5559
}
5660

5761
// `Validate()` checks if the receiver configuration is valid.
@@ -111,6 +115,13 @@ func (cfg *Config) Validate() error {
111115
}
112116
}
113117

118+
if len(cfg.SummaryPath) > 0 {
119+
cfg.summary, err = parseSummarySettings(cfg.SummaryPath)
120+
if err != nil {
121+
return err
122+
}
123+
}
124+
114125
return nil
115126
}
116127

0 commit comments

Comments
 (0)