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

nats micro stats <service> fails with /endpoints/0/data: expected object, but got null #1148

Closed
jadamcrain opened this issue Nov 1, 2023 · 1 comment · Fixed by #1150
Closed
Labels
defect Suspected defect such as a bug or regression

Comments

@jadamcrain
Copy link
Contributor

jadamcrain commented Nov 1, 2023

Observed behavior

Hi, I'm following along on main with prototyping some Rust services and using nats micro . @Jarema pointed out to me on Slack that there was some work going on in main to make the Rust service API work with the CLI tooling.

Using main , I can now list my service and demo service built into nats:

> nats micro list
╭────────────────────────────────────────────────────────────────────────────╮
│                             All Micro Services                             │
├──────────┬─────────┬────────────────────────┬──────────────────────────────┤
│ Name     │ Version │ ID                     │ Description                  │
├──────────┼─────────┼────────────────────────┼──────────────────────────────┤
│ test     │ 1.0.0   │ QOv6Nd9jIdMx5ovNIB3gCB │ NATS CLI Demo Service (test) │
│ snapshot │ 0.0.1   │ srimFQtrRuMqQOJAHzKkzW │ Telemetry snapshot service   │
╰──────────┴─────────┴────────────────────────┴──────────────────────────────╯

Good stuff, I was getting an error about the endpoints not being filled out before but can now get past that on main. Next I tried to query for stats on both:

> nats micro stats test --trace
11:21:13 >>> $SRV.STATS.test: {}
11:21:13 <<< (404B) {"name":"test","id":"QOv6Nd9jIdMx5ovNIB3gCB","version":"1.0.0","metadata":{"_nats.client.created.library":"natscli","_nats.client.created.version":"0.1.1"},"type":"io.nats.micro.v1.stats_response","started":"2023-11-01T18:19:47.9781136Z","endpoints":[{"name":"echo","subject":"test.echo","queue_group":"q","num_requests":0,"num_errors":0,"last_error":"","processing_time":0,"average_processing_time":0}]}
11:21:13 === Received 1 responses

> nats micro stats snapshot --trace
11:21:20 >>> $SRV.STATS.snapshot: {}
11:21:20 <<< (341B) {"type":"io.nats.micro.v1.stats_response","name":"snapshot","id":"srimFQtrRuMqQOJAHzKkzW","version":"0.0.1","started":"2023-11-01T18:18:16.6798459Z","endpoints":[{"name":"snapshot","subject":"snapshot","num_requests":10,"num_errors":0,"processing_time":517900,"average_processing_time":258950,"last_error":"","data":null,"queue_group":"q"}]}
11:21:21 === Received 1 responses
nats: error: /endpoints/0/data: expected object, but got null

The demo service (Go I presume?) omits returning a data field at all, whereas my Rust service explicitly returns null which the CLI doesn't like.

Didn't see anything in tracker about stats not working against a Rust service.

Expected behavior

Not sure if the Rust serde should be adjusted to omit data when Option == None or if the CLI should gracefully handle null in the same way that it handles the JSON field not being present?

Server and client version

Using main 3fbf7c889e491f1821422ad6859a14f8fa0115d3

WITH

nats 0.1.1

Host environment

No response

Steps to reproduce

No response

@jadamcrain jadamcrain added the defect Suspected defect such as a bug or regression label Nov 1, 2023
@Jarema
Copy link
Member

Jarema commented Nov 2, 2023

Thanks for filling the issue!

We decided to not loosen the schema validation on CLI, but instead do not serialize the data.
Fix has been posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants