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

feat: implement named meter #700

Merged
merged 7 commits into from
Jan 21, 2020

Conversation

xiao-lix
Copy link
Contributor

Which problem is this PR solving?

Short description of the changes

  • Implement named meters and update documentation

}

getMeter(
name: string = 'default',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mayurkale22 Just to double check that we decide to have 'default' name and also give better names in examples and tests in today's SIG metting, is it correct? Thanks :)

Copy link
Member

Choose a reason for hiding this comment

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

No, this typing has name as an optional property. We want it to be required, but we need to check anyways since someone not using typescript may call getMeter without name and we have to return something

@codecov-io
Copy link

codecov-io commented Jan 15, 2020

Codecov Report

Merging #700 into master will increase coverage by 2.71%.
The diff coverage is 96.87%.

@@            Coverage Diff             @@
##           master     #700      +/-   ##
==========================================
+ Coverage   89.92%   92.63%   +2.71%     
==========================================
  Files         218      227       +9     
  Lines       10129    10312     +183     
  Branches      945      938       -7     
==========================================
+ Hits         9108     9553     +445     
+ Misses       1021      759     -262
Impacted Files Coverage Δ
...ges/opentelemetry-propagator-jaeger/src/version.ts 0% <0%> (ø)
...ckages/opentelemetry-plugin-ioredis/src/ioredis.ts 100% <100%> (ø)
.../opentelemetry-plugin-pg-pool/test/pg-pool.test.ts 88.09% <100%> (+53.17%) ⬆️
...opagator-jaeger/test/JaegerHttpTraceFormat.test.ts 100% <100%> (ø)
...try-propagator-jaeger/src/JaegerHttpTraceFormat.ts 95.65% <95.65%> (ø)
...kages/opentelemetry-plugin-dns/test/utils/utils.ts 33.33% <0%> (-26.67%) ⬇️
...ages/opentelemetry-plugin-http/test/utils/utils.ts 33.33% <0%> (-26.67%) ⬇️
...ges/opentelemetry-tracing/src/NoopSpanProcessor.ts 66.66% <0%> (-8.34%) ⬇️
packages/opentelemetry-plugin-dns/src/version.ts 100% <0%> (ø) ⬆️
packages/opentelemetry-tracing/src/config.ts 100% <0%> (ø) ⬆️
... and 55 more

/**
* This class represents a meter provider which platform libraries can extend
*/
export class MeterProvider implements types.MeterProvider {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please change Provider to Registry (MeterProvider => MeterRegistry), there is still confusion about the name. See: #699 (comment). We can come back to this once we have some decision.

Sorry for the confusion :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, no problem. 🤣

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.

lgtm

@mayurkale22
Copy link
Member

@dyladan please review when you get a chance.

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

lgtm, just a minor comments

```

Now, you can require this file from your application code and use the `Meter` to create and manage metrics. The simplest of these metrics is a counter. Let's create and export from our `monitoring.js` file a middleware function that express can use to count all requests by route. Modify the `monitoring.js` file so that it looks like this:

```javascript
'use strict';

const { Meter } = require("@opentelemetry/metrics");
const { MeterRegistry } = require("@opentelemetry/metrics");
Copy link
Member

Choose a reason for hiding this comment

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

Nit: change all double quotes from all examples to be single quotes

@@ -1,9 +1,9 @@
"use strict";

const { Meter } = require("@opentelemetry/metrics");
const { MeterRegistry } = require("@opentelemetry/metrics");
Copy link
Member

Choose a reason for hiding this comment

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

Nit: please use single quotes

@mayurkale22 mayurkale22 added the Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) label Jan 17, 2020
Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

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

Good job !

@mayurkale22
Copy link
Member

I think this is good to go. Please rebase branch with the base branch, unable to merge w/o that.

@mayurkale22 mayurkale22 added API size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 20, 2020
@mayurkale22 mayurkale22 merged commit 63748ae into open-telemetry:master Jan 21, 2020
@xiao-lix xiao-lix deleted the xiao/named-meter branch January 21, 2020 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Named Meters
6 participants