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

Add Synchronous Metric Instruments SDK #179

Merged
merged 16 commits into from
Aug 3, 2020

Conversation

ankit-bhargava
Copy link
Contributor

This PR implements classes described in the Metric Instruments API (PR #161). These classes, unlike the no-op implementations included with the API, are capable of actually collecting telemetry data and sit at the beginning of the Metrics data pipeline as they capture data from instrumented applications. Instruments employ Aggregators (pending approval in PR #178 ) to combine the updates they receive into meaningful values. The PR will not compile without these files.

A test suite which validates each instrument’s ability to record values in single-threaded and concurrent scenarios is included. Functions necessary for the metrics pipeline as a whole such as reference counting are tested as well.

This PR is part of a series of PRs to add a full implementation of metrics API and SDK support.

Note: We templated instruments to support a wider array of scalar types. Templating prevents us from using out of line declarations as we normally would. As a result, we left all implementation code in the header file. If there are any suggestions to remedy this we will gladly make the change.

@codecov
Copy link

codecov bot commented Jul 16, 2020

Codecov Report

Merging #179 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #179   +/-   ##
=======================================
  Coverage   92.19%   92.19%           
=======================================
  Files         117      117           
  Lines        4038     4038           
=======================================
  Hits         3723     3723           
  Misses        315      315           

@ankit-bhargava ankit-bhargava marked this pull request as ready for review July 16, 2020 15:25
@ankit-bhargava ankit-bhargava requested a review from a team July 16, 2020 15:25
@reyang reyang added the pr:do-not-merge This PR is not ready to be merged. label Jul 20, 2020
@ankit-bhargava ankit-bhargava marked this pull request as draft July 21, 2020 15:21
@ankit-bhargava ankit-bhargava marked this pull request as ready for review July 26, 2020 04:41
@ankit-bhargava ankit-bhargava changed the title Add Metric Instruments SDK Add Synchronous Metric Instruments SDK Jul 28, 2020
{}

/**
* Returns a Bound Instrument associated with the specified labels. * Multiples requests
Copy link
Member

Choose a reason for hiding this comment

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

Is this a format error?

// Utility function which converts maps to strings for better performance
inline std::string mapToString(const std::map<std::string,std::string> & conv){
std::stringstream ss;
ss <<"{ ";
Copy link
Member

Choose a reason for hiding this comment

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

There are several places in this PR where the code is not well-formatted (e.g. spacing, indentation, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that, for some reason these weren't an issue in my IDE. I'll be sure to go over them carefully and take care of all the issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

went back over and tried to clean up most of these

@reyang reyang removed the pr:do-not-merge This PR is not ready to be merged. label Jul 29, 2020
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM, I'm concerned about the contention and allocation but these are not blocking this PR.

@reyang reyang added the pr:please-merge This PR is ready to be merged by a Maintainer (rebased, CI passed, has enough valid approvals, etc.) label Jul 30, 2020
@ankit-bhargava
Copy link
Contributor Author

@reyang Thanks for the review! This PR can only be merged after PR #181 is merged. Additionally, I would like to ensure all the CI tests are passing but they don't seem to run on this branch...

@reyang
Copy link
Member

reyang commented Jul 30, 2020

@ankit-bhargava would you rebase and resolve the conflicts?

@ankit-bhargava ankit-bhargava force-pushed the metrics-sdk-syncinstr branch from cc7fb1f to a332250 Compare July 31, 2020 04:28
@ankit-bhargava
Copy link
Contributor Author

@reyang I had some issues rebasing so please let me know if anything looks off. Otherwise, this should be ready to go!

@ankit-bhargava ankit-bhargava force-pushed the metrics-sdk-syncinstr branch from 921e53e to 42da878 Compare August 3, 2020 15:54
@ankit-bhargava ankit-bhargava force-pushed the metrics-sdk-syncinstr branch from 02a72da to 4d90ee7 Compare August 3, 2020 19:35
@ankit-bhargava
Copy link
Contributor Author

@reyang Recently rebased, think this can be merged.

@reyang reyang merged commit 3ac89eb into open-telemetry:master Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:please-merge This PR is ready to be merged by a Maintainer (rebased, CI passed, has enough valid approvals, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants