forked from git-ecosystem/trace2receiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pii.go
30 lines (23 loc) · 782 Bytes
/
pii.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package trace2receiver
// Settings to enable/disable possibly GDPR-sensitive fields
// in the telemetry output.
type PiiSettings struct {
Include PiiInclude `mapstructure:"include"`
}
type PiiInclude struct {
// Lookup system hostname and add to process span.
Hostname bool `mapstructure:"hostname"`
// Lookup the client username and add to process span.
Username bool `mapstructure:"username"`
}
func parsePiiFile(path string) (*PiiSettings, error) {
return parseYmlFile[PiiSettings](path, parsePiiFromBuffer)
}
func parsePiiFromBuffer(data []byte, path string) (*PiiSettings, error) {
pii, err := parseYmlBuffer[PiiSettings](data, path)
if err != nil {
return nil, err
}
// TODO insert any post-parse validation or data structure setup here.
return pii, nil
}