Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

quickstart/{java, go}/metrics: Add tags for "status" and "error" #484

Merged
merged 3 commits into from
Nov 29, 2018

Conversation

hvent90
Copy link
Contributor

@hvent90 hvent90 commented Nov 28, 2018

Addresses #470

Part 1 of 2 pull request to reduce cognitive load as reviewing quickstarts is no simple task.

This PR does the following for Go & Java Metric quickstarts:

  1. Removes the "error" measure
  2. Creates a tag for "status" and "Error"
  3. Sets "status" tag to "OK"
  4. If error, "status" tag is set to "ERROR" and "error" tag is set to the error string
  5. Wrapped readEvaluateProcessLine in a latency measurement to catch errors

@@ -406,15 +401,17 @@ Now we will insert a specific tag called "repl". It will give us a new `context.

For example
```go
ctx, err := tag.New(context.Background(), tag.Insert(KeyMethod, "repl"))
ctx, _ := tag.New(context.Background(), tag.Insert(KeyMethod, "repl"),
Copy link
Member

Choose a reason for hiding this comment

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

Please run these Go snippets through go-fmt first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you!

func readEvaluateProcess(br *bufio.Reader) error {
ctx, err := tag.New(context.Background(), tag.Insert(KeyMethod, "repl"))
func readEvaluateProcess(br *bufio.Reader) (terr error) {
ctx, _ := tag.New(context.Background(), tag.Insert(KeyMethod, "repl"),
Copy link
Member

Choose a reason for hiding this comment

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

Ditto about go-fmt

@hvent90
Copy link
Contributor Author

hvent90 commented Nov 29, 2018

@odeke-em indentation fixed in latest commit. I also added a bit of noise to the PR by switching from shortcodes to backticks ``` for my editor (Atom) to correctly indent the files.

Update: Upon further inspection, my editor is still not respecting correct indentation (8 spaces per tab). I'm looking into it.

In the meantime, here is a fun photo showcasing correct indentation in the editor, but no change in the file itself. Contents were copied and formatted directly from the Go Playground:
screen shot 2018-11-28 at 5 14 24 pm

Copy link
Member

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

Awesome, thank you @hvent90, LGTM!

@odeke-em odeke-em merged commit 9d426ca into census-instrumentation:master Nov 29, 2018
@hvent90 hvent90 deleted the stats-errors branch November 29, 2018 02:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants