Add imgproxy.source_image_url and imgproxy.processing_options attributes to New Relic, DataDog, and OpenTelemetry traces

This commit is contained in:
DarthSim
2024-08-23 18:37:24 +03:00
parent e9d96b77e8
commit ba17ed8f19
7 changed files with 110 additions and 0 deletions

View File

@@ -80,6 +80,27 @@ func (d Entries) MarshalJSON() ([]byte, error) {
return buf.Bytes(), nil
}
func (d Entries) flatten(m map[string]interface{}, prefix string) {
for _, e := range d {
key := e.Name
if len(prefix) > 0 {
key = prefix + "." + key
}
if dd, ok := e.Value.(Entries); ok {
dd.flatten(m, key)
} else {
m[key] = e.Value
}
}
}
func (d Entries) Flatten() map[string]interface{} {
m := make(map[string]interface{})
d.flatten(m, "")
return m
}
func Diff(a, b interface{}) Entries {
valA := reflect.Indirect(reflect.ValueOf(a))
valB := reflect.Indirect(reflect.ValueOf(b))