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

docs(grpc): add grpc example #326

Merged
merged 6 commits into from
Sep 26, 2019

Conversation

markwolff
Copy link
Member

Which problem is this PR solving?

Short description of the changes

  • static_codegen example taken from grpc docs instrumented with OpenTelemetry.

#### Jaeger UI

`jaeger:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`).
Go to zipkin with your browser [http://localhost:50051/trace/(your-trace-id)]() (e.g http://localhost:50051/trace/4815c3d576d930189725f1f1d1bdfcc6)
Copy link
Member

Choose a reason for hiding this comment

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

s/zipkin/jaeger/

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

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

Nice!

const tracer = opentelemetry.getTracer();

/** A function which makes requests and handles response. */
function main(port) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to pass port here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No - moved to just use local var instead

@@ -0,0 +1,48 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

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

Probably, we can move this example in a grpc/static_codegen folder and add another example, under grpc/dynamic_codegen which can be the dynamic code generation (generated at runtime using Protobuf.js) variant of gRPC example. WDYT?

examples/grpc/setup.js Show resolved Hide resolved
Copy link
Member

@OlivierAlbertini OlivierAlbertini left a comment

Choose a reason for hiding this comment

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

Nice!


Setup [Zipkin Tracing](https://zipkin.io/pages/quickstart.html)
or
Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/1.12/getting-started/#all-in-one)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/1.12/getting-started/#all-in-one)
Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one)

examples/grpc/setup.js Show resolved Hide resolved
enabled: true,
// if it can't find the module, put the absolute path since the packages are not published yet
path: '@opentelemetry/plugin-grpc',
ignoreOutgoingUrls: [/spans/]
Copy link
Member

Choose a reason for hiding this comment

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

Do you use it ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, removed

#### Jaeger UI

`jaeger:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`).
Go to zipkin with your browser [http://localhost:50051/trace/(your-trace-id)]() (e.g http://localhost:50051/trace/4815c3d576d930189725f1f1d1bdfcc6)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Go to zipkin with your browser [http://localhost:50051/trace/(your-trace-id)]() (e.g http://localhost:50051/trace/4815c3d576d930189725f1f1d1bdfcc6)
Go to Jaeger with your browser [http://localhost:50051/trace/(your-trace-id)]() (e.g http://localhost:50051/trace/4815c3d576d930189725f1f1d1bdfcc6)


#### Zipkin UI
`zipkin:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`).
Go to zipkin with your browser [http://localhost:9411/zipkin/traces/(your-trace-id)]() (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Go to zipkin with your browser [http://localhost:9411/zipkin/traces/(your-trace-id)]() (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)
Go to Zipkin with your browser [http://localhost:9411/zipkin/traces/(your-trace-id)]() (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)


/**
* The trace instance needs to be initialized first, if you want to enable
* automatic tracing for built-in plugins (HTTP in this case).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* automatic tracing for built-in plugins (HTTP in this case).
* automatic tracing for built-in plugins.


/**
* The trace instance needs to be initialized first, if you want to enable
* automatic tracing for built-in plugins (HTTP in this case).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* automatic tracing for built-in plugins (HTTP in this case).
* automatic tracing for built-in plugins.

@@ -35,7 +35,7 @@ Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/1.12/getting-started/#a
`zipkin:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`).
Go to zipkin with your browser [http://localhost:9411/zipkin/traces/(your-trace-id)]() (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)

<!-- <p align="center"><img src="./images/zipkin-ui.png?raw=true"/></p> -->
<p align="center"><img src="https://user-images.githubusercontent.com/5515583/65533964-7a11a600-deb3-11e9-8af0-a91243db6fdc.png"/></p>
Copy link
Member

Choose a reason for hiding this comment

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

Should we store it in the repo ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, stored in ./images as in http example

@mayurkale22
Copy link
Member

@markwolff Please fix the comments, otherwise good to go.

@mayurkale22
Copy link
Member

@markwolff If you want, use below image for Jaeger UI. I ran this example using both the exporters, everything look good to me (dep. on #325).

gRPC_jaeger

@mayurkale22 mayurkale22 merged commit 0aa4fb5 into open-telemetry:master Sep 26, 2019
OlivierAlbertini pushed a commit to VilledeMontreal/opentelemetry-js that referenced this pull request Sep 26, 2019
* docs(grpc): add grpc example

* docs(readme): add zipkin ui image

* fix: typos, add local images, refactor

* fix: typo
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.

examples: provide an example for gRPC plugin
5 participants