Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to convert message to event #538

Open
netixx opened this issue Oct 28, 2024 · 1 comment
Open

failed to convert message to event #538

netixx opened this issue Oct 28, 2024 · 1 comment

Comments

@netixx
Copy link
Contributor

netixx commented Oct 28, 2024

I have the following logs on my instance:

2024/10/28 11:26:34.254027 [prometheus_write_output:x] failed to convert message to event: failed to parse json {"af-data":[,{"af-name":"ipv6","number-of-bestpaths":0}]}: invalid character ',' looking for beginning of value

I modified the event.go file to display the actual string that fails to parse like so: https://github.com/netixx/gnmic/blob/feat/event-format-more-info/pkg/formatters/event.go#L253-L254

The subscription is as follows:

2024/10/28 10:54:20.377373 [gnmic] sending gNMI SubscribeRequest: subscribe='subscribe:{prefix:{origin:"Cisco-IOS-XR-ipv4-bgp-oper" elem:{name:"bgp"} elem:{name:"instances"} elem:{name:"instance"} elem:{name:"instance-active"} elem:{name:"default-vrf"} elem:{name:"neighbors"} elem:{name:"neighbor"} elem:{name:"af-data"}} subscription:{path:{elem:{name:"af-name"}} mode:SAMPLE sample_interval:30000000000} subscription:{path:{elem:{name:"number-of-bestpaths"}} mode:SAMPLE sample_interval:30000000000}}', mode='STREAM', encoding='JSON', to XXX

I think the issue is that the router sending garbage in the field:

	case *gnmi.TypedValue_JsonIetfVal:
		jsondata = updValue.GetJsonIetfVal()
	case *gnmi.TypedValue_JsonVal:
		jsondata = updValue.GetJsonVal()

If that is the case, I will open a case with the manufacturer, however I would need to precisely dump the response from the device. Is there a way to do that ?

Secondly, could we make the json parsing more forgiving (custom parser maybe) ?

@karimra
Copy link
Collaborator

karimra commented Oct 31, 2024

You can see the original response by adding --format prototext to the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants