hashicorp / hashicorp/nomad

Add debug flag to the cli to show API calls made

Open
#11,286 0 comments 3 reactions 0 assignees View on GitHub
theme/cli type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Proposal

It would be useful if the Nomad CLI could show the API calls it's making under the hood. In addition to it's use in troubleshooting connection errors, this would be very useful if it isn't clear which API calls correspond to a nomad CLI call. This can help with situations when the user knows how to accomplish something via the CLI, but needs to do the same task via the API.

### Use-cases

`nomad alloc status -stats` is a good example of this. There is no alloc endpoint in the API docs, and the `-stats` flag causes it to read `/v1/client/allocation/[alloc_id]/stats`. Not being very familiar with the API, and not expecting this call to go to `/client`, I had to resort to Wireshark to figure this out.

### Attempted Solutions

The `-verbose` flag did not provide the information desired. I didn't see any other pertinent flags in the help.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the `nomad alloc status -stats` CLI path and the API request it makes to `/v1/client/allocation/[alloc_id]/stats`; compare this with the existing `-verbose` behavior. Done means a debug flag clearly reports the API calls made by CLI commands, including the endpoint involved in this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.