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

Add gRPC integration guide #355

Merged
merged 3 commits into from
Feb 25, 2019

Conversation

mayurkale22
Copy link
Member

@codecov-io
Copy link

Codecov Report

Merging #355 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #355      +/-   ##
==========================================
- Coverage   95.28%   95.26%   -0.03%     
==========================================
  Files         124      124              
  Lines        8339     8339              
  Branches      619      619              
==========================================
- Hits         7946     7944       -2     
- Misses        393      395       +2
Impacted Files Coverage Δ
src/stackdriver-monitoring.ts 81.05% <0%> (-2.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc5f4d1...7a03f03. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Feb 21, 2019

Codecov Report

Merging #355 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #355      +/-   ##
==========================================
- Coverage   95.28%   95.26%   -0.03%     
==========================================
  Files         124      124              
  Lines        8339     8339              
  Branches      619      619              
==========================================
- Hits         7946     7944       -2     
- Misses        393      395       +2
Impacted Files Coverage Δ
src/stackdriver-monitoring.ts 81.05% <0%> (-2.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc5f4d1...ab2e920. Read the comment docs.

const { StackdriverTraceExporter } =
require('@opencensus/exporter-stackdriver');

let tracer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: what if you made setupOpencensusAndExporters return the tracer so that you could assign it with const. Maybe call it something like getSetupTracer or something similar.

function main () {
const client = new rpcProto.Fetch('localhost:50051',
grpc.credentials.createInsecure());
let data;
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: could this just be const data = process.argv[2] || 'opencensus'? Not sure if that's actually better but feels more compact.

});

setTimeout(() => {
console.log('done.');
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the role of this message / is there a better way to check for doneness than waiting one minute?

Copy link
Member Author

Choose a reason for hiding this comment

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

The minimum reporting period for Stackdriver is 1 minute. The thread with the StackdriverStatsExporter must live for at least the interval past any metrics that must be collected, or some risk being lost if they are recorded after the last export. We planned to add a flush method instead of doing this.

I will enable StackdriverStatsExporter here, once the gRPC stats are available #270

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, interesting. Can you add a comment to explain this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// for more details.
// Expects ADCs to be provided through the environment as ${GOOGLE_APPLICATION_CREDENTIALS}
// A Stackdriver workspace is required and provided through the environment as ${GOOGLE_PROJECT_ID}
const projectId = process.env.GOOGLE_PROJECT_ID;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth specifying above that this is intended to run on the Google Cloud Platform? Or is that already implied somewhere?

const { StackdriverTraceExporter } =
require('@opencensus/exporter-stackdriver');

let tracer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar optional comment here on assigning via const with the return value of the setup function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -2,7 +2,7 @@

Our service takes in a payload containing bytes and capitalizes them.

Using OpenCensus Node, we can collect traces of our system and export them to the backend of our choice, to give observability to our distributed systems.
Using OpenCensus Node, we can collect traces of our system and export them to the backend of our choice(we are using Stackdriver for this example), to give observability to our distributed systems.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: add space

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@mayurkale22 mayurkale22 merged commit 0267db1 into census-instrumentation:master Feb 25, 2019
@mayurkale22 mayurkale22 deleted the grpc_example branch February 25, 2019 22:40
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.

None yet

4 participants