diff --git a/v3/newrelic/attributes_from_internal.go b/v3/newrelic/attributes_from_internal.go index af0a36b3a..cf45f3499 100644 --- a/v3/newrelic/attributes_from_internal.go +++ b/v3/newrelic/attributes_from_internal.go @@ -452,50 +452,6 @@ func addUserAttribute(a *attributes, key string, val interface{}, d destinationS } func writeAttributeValueJSON(w *jsonFieldsWriter, key string, val interface{}) { - switch v := val.(type) { - case string: - w.stringField(key, v) - case bool: - if v { - w.rawField(key, `true`) - } else { - w.rawField(key, `false`) - } - case uint8: - w.intField(key, int64(v)) - case uint16: - w.intField(key, int64(v)) - case uint32: - w.intField(key, int64(v)) - case uint64: - w.intField(key, int64(v)) - case uint: - w.intField(key, int64(v)) - case uintptr: - w.intField(key, int64(v)) - case int8: - w.intField(key, int64(v)) - case int16: - w.intField(key, int64(v)) - case int32: - w.intField(key, int64(v)) - case int64: - w.intField(key, v) - case int: - w.intField(key, int64(v)) - case float32: - w.floatField(key, float64(v)) - case float64: - w.floatField(key, v) - default: - w.stringField(key, fmt.Sprintf("%T", v)) - } -} - -// This is capable of consuming maps and structs, but this is expensive. -// If possible, pass them already stringified. -// note that other than the additional support for complex structs, this is a 1:1 clone of writeAgentAttributeValues() -func writeLogAttributeJSON(w *jsonFieldsWriter, key string, val any) { switch v := val.(type) { case string: w.stringField(key, v) diff --git a/v3/newrelic/log_event.go b/v3/newrelic/log_event.go index 5bb388075..18f79e595 100644 --- a/v3/newrelic/log_event.go +++ b/v3/newrelic/log_event.go @@ -61,7 +61,7 @@ func (e *logEvent) WriteJSON(buf *bytes.Buffer) { buf.WriteString(`,"attributes":{`) w := jsonFieldsWriter{buf: buf} for key, val := range e.atributes { - writeLogAttributeJSON(&w, key, val) + writeAttributeValueJSON(&w, key, val) } buf.WriteByte('}') }