mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-05 19:56:07 +08:00
chore: some changes
This commit is contained in:
parent
1f04b77897
commit
9fd7a1807a
@ -10,13 +10,11 @@ import (
|
||||
|
||||
// LoadFieldKeysFromJSON loads telemetry field keys from a JSON file
|
||||
func LoadFieldKeysFromJSON(filePath string) (map[string][]*telemetrytypes.TelemetryFieldKey, error) {
|
||||
// Read the JSON file
|
||||
jsonData, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read JSON file: %w", err)
|
||||
}
|
||||
|
||||
// Parse JSON directly into the target format using built-in unmarshaling
|
||||
var result map[string][]*telemetrytypes.TelemetryFieldKey
|
||||
if err := json.Unmarshal(jsonData, &result); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal JSON: %w", err)
|
||||
@ -27,7 +25,6 @@ func LoadFieldKeysFromJSON(filePath string) (map[string][]*telemetrytypes.Teleme
|
||||
|
||||
// LoadFieldKeysFromJSONString loads telemetry field keys from a JSON string
|
||||
func LoadFieldKeysFromJSONString(jsonStr string) (map[string][]*telemetrytypes.TelemetryFieldKey, error) {
|
||||
// Parse JSON directly into the target format using built-in unmarshaling
|
||||
var result map[string][]*telemetrytypes.TelemetryFieldKey
|
||||
if err := json.Unmarshal([]byte(jsonStr), &result); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal JSON: %w", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user