helper.go 477 B

1234567891011121314151617
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package cassandraexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/cassandraexporter"
  4. import "encoding/json"
  5. func attributesToMap(attributes map[string]any) map[string]string {
  6. newAttrMap := make(map[string]string)
  7. for k, v := range attributes {
  8. jsonV, err := json.Marshal(v)
  9. if err == nil {
  10. newAttrMap[k] = string(jsonV)
  11. }
  12. }
  13. return newAttrMap
  14. }