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

Provide godoc examples for using the api #630

Merged
merged 1 commit into from Aug 9, 2019

Conversation

csmarchbanks
Copy link
Member

Closes #194

cc: @krasi-georgiev

Closes prometheus#194

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
if len(warnings) > 0 {
fmt.Printf("Warnings: %v\n", warnings)
}
fmt.Printf("Result:\n%v\n", result)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering whether it is a good idea to add a comment for the exepcted output like in the examples:

https://blog.golang.org/examples
// Output: golly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered having an Output section, but we don't know exactly what the Output would be, and if it is wrong the tests will fail.

We could make a mock Prometheus, where we know the response, but I agree with your comment below that the example would be a bit strange in that case.

api/prometheus/v1/example_test.go Show resolved Hide resolved
@krasi-georgiev
Copy link
Contributor

LGTM

@beorn7 beorn7 merged commit 801fabc into prometheus:master Aug 9, 2019
@csmarchbanks csmarchbanks deleted the api-examples branch August 9, 2019 21:24
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

Successfully merging this pull request may close these issues.

documentation for API client
3 participants