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

[hotrod] Add links to traces #2536

Merged
merged 6 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We gratefully welcome improvements to documentation as well as to code.
## Getting Started

### Pre-requisites
* Install [Go](https://golang.org/doc/install) and setup GOPATH and add $GOPATH/bin in PATH
* Install [Go](https://golang.org/doc/install) and setup GOPATH and add $GOPATH/bin in PATH

This library uses Go modules to manage dependencies.

Expand Down Expand Up @@ -116,18 +116,32 @@ import (

## Testing guidelines

We strive to maintain as high code coverage as possible. Since `go test` command does not generate
We strive to maintain as high code coverage as possible. The current repository limit is set at 95%,
with some exclusions discussed below.

### Combining code coverage

We use [cover.sh](./scripts/cover.sh) script to run tests and combine code coverage from all packages
(see also [issue # 797](https://github.com/jaegertracing/jaeger/issues/797)).

### Packages with no tests

Since `go test` command does not generate
code coverage information for packages that have no test files, we have a build step (`make nocover`)
that breaks the build when such packages are discovered, with an error like this:
that breaks the build when such packages are discovered, with the following error:

```
error: at least one *_test.go file must be in all directories with go files
so that they are counted for code coverage.
If no tests are possible for a package (e.g. it only defines types), create empty_test.go
```

As the message says, all packages are required to have at least one `*_test.go` file.

### Excluding packages from testing

There are conditions that cannot be tested without external dependencies, such as a function that
creates a gocql.Session, because it requires an active connection to Cassandra database. It is
creates a `gocql.Session`, because it requires an active connection to Cassandra database. It is
recommended to isolate such functions in a separate package with bare minimum of code and add a
file `.nocover` to exclude the package from coverage calculations. The file should contain
a comment explaining why it is there, for example:
Expand All @@ -145,4 +159,3 @@ Before merging a PR make sure:

Merge the PR by using "Squash and merge" option on Github. Avoid creating merge commits.
After the merge make sure referenced issues were closed.

2 changes: 2 additions & 0 deletions examples/hotrod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ services:
command: ["all"]
environment:
- JAEGER_AGENT_HOST=jaeger
# Note: if your application is using Node.js Jaeger Client, you need port 6832,
# unless issue https://github.com/jaegertracing/jaeger/issues/1596 is resolved.
- JAEGER_AGENT_PORT=6831
networks:
- jaeger-example
Expand Down
58 changes: 30 additions & 28 deletions examples/hotrod/services/frontend/gen_assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/hotrod/services/frontend/web_assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ <h4><em>Rides On Demand</em></h4>
var after = Date.now();
console.log(data);
var duration = formatDuration(data.ETA);
freshCar.html('HotROD <b>' + data.Driver + '</b> arriving in ' + duration + ' [req: ' + requestID + ', latency: ' + (after-before) + 'ms]');
var trace = 'http://localhost:16686/search?limit=20&lookback=1h&service=frontend&tags=%7B%22driver%22%3A%22' + data.Driver + '%22%7D';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it too hard to add a field somewhere with the location of the Jaeger installation? Or to copy the search terms, so that people can just paste into their remote Jaeger instance?

Copy link
Member

@joe-elliott joe-elliott Oct 5, 2020

Choose a reason for hiding this comment

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

I'm concerned that hotrod is used in a lot of different examples and this link may not always be valid. I'd say in most cases where people are running hotrod localhost:16686 will be the Jaeger UI, but when it's not this may be confusing.

I do think this is a cool feature for demoing tracing though and wonder the same thing as @jpkrohling

Is it too hard to add a field somewhere with the location of the Jaeger installation?

Copy link
Member Author

Choose a reason for hiding this comment

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

added config option -j http://localhost:16686

freshCar.html(`HotROD <b>${data.Driver}</b> arriving in ${duration} [req: ${requestID}, latency: ${after-before}ms] [<a href="${trace}" target="_blank">find trace</a>]`);
},
});
});
Expand Down