-
Notifications
You must be signed in to change notification settings - Fork 451
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
[Metrics API/SDK] - Pass state to async callback function. #1408
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2feef1b
initial commit
lalitb eaca516
more changes
lalitb f22dcb8
Merge branch 'main' into add-state-callback
lalitb d9ec874
comment out argument not used
lalitb 31cfc04
Merge branch 'add-state-callback' of github.com:lalitb/opentelemetry-…
lalitb 824ebc0
fix review comments
lalitb 154afa5
Merge branch 'main' into add-state-callback
lalitb 6dca5eb
Merge branch 'main' into add-state-callback
ThomsonTan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,24 +47,26 @@ class Meter | |
nostd::string_view unit = "") noexcept = 0; | ||
|
||
/** | ||
* Creates a Asynchronouse (Observable) counter with the passed characteristics and returns a | ||
* Creates a Asynchronous (Observable) counter with the passed characteristics and returns a | ||
* shared_ptr to that Observable Counter | ||
* | ||
* @param name the name of the new Observable Counter. | ||
* @param callback the function to be observed by the instrument. | ||
* @param description a brief description of what the Observable Counter is used for. | ||
* @param unit the unit of metric values following https://unitsofmeasure.org/ucum.html. | ||
* @param callback the function to be observed by the instrument. | ||
* @return a shared pointer to the created Observable Counter. | ||
* @param state to be passed back to callback | ||
*/ | ||
virtual void CreateLongObservableCounter(nostd::string_view name, | ||
void (*callback)(ObserverResult<long> &), | ||
void (*callback)(ObserverResult<long> &, void *), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a breaking change for the alpha users? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes , it would be breaking change. |
||
nostd::string_view description = "", | ||
nostd::string_view unit = "") noexcept = 0; | ||
nostd::string_view unit = "", | ||
void *state = nullptr) noexcept = 0; | ||
|
||
virtual void CreateDoubleObservableCounter(nostd::string_view name, | ||
void (*callback)(ObserverResult<double> &), | ||
void (*callback)(ObserverResult<double> &, void *), | ||
nostd::string_view description = "", | ||
nostd::string_view unit = "") noexcept = 0; | ||
nostd::string_view unit = "", | ||
void *state = nullptr) noexcept = 0; | ||
|
||
/** | ||
* Creates a Histogram with the passed characteristics and returns a shared_ptr to that Histogram. | ||
|
@@ -89,20 +91,22 @@ class Meter | |
* shared_ptr to that Observable Counter | ||
* | ||
* @param name the name of the new Observable Gauge. | ||
* @param callback the function to be observed by the instrument. | ||
* @param description a brief description of what the Observable Gauge is used for. | ||
* @param unit the unit of metric values following https://unitsofmeasure.org/ucum.html. | ||
* @param callback the function to be observed by the instrument. | ||
* @return a shared pointer to the created Observable Gauge. | ||
* @param state to be passed back to callback | ||
*/ | ||
virtual void CreateLongObservableGauge(nostd::string_view name, | ||
void (*callback)(ObserverResult<long> &), | ||
void (*callback)(ObserverResult<long> &, void *), | ||
nostd::string_view description = "", | ||
nostd::string_view unit = "") noexcept = 0; | ||
nostd::string_view unit = "", | ||
void *state = nullptr) noexcept = 0; | ||
|
||
virtual void CreateDoubleObservableGauge(nostd::string_view name, | ||
void (*callback)(ObserverResult<double> &), | ||
void (*callback)(ObserverResult<double> &, void *), | ||
nostd::string_view description = "", | ||
nostd::string_view unit = "") noexcept = 0; | ||
nostd::string_view unit = "", | ||
void *state = nullptr) noexcept = 0; | ||
|
||
/** | ||
* Creates an UpDownCounter with the passed characteristics and returns a shared_ptr to that | ||
|
@@ -128,20 +132,23 @@ class Meter | |
* a shared_ptr to that Observable UpDownCounter | ||
* | ||
* @param name the name of the new Observable UpDownCounter. | ||
* @param callback the function to be observed by the instrument. | ||
* @param description a brief description of what the Observable UpDownCounter is used for. | ||
* @param unit the unit of metric values following https://unitsofmeasure.org/ucum.html. | ||
* @param callback the function to be observed by the instrument. | ||
* @return a shared pointer to the created Observable UpDownCounter. | ||
* @param state to be passed back to callback | ||
*/ | ||
virtual void CreateLongObservableUpDownCounter(nostd::string_view name, | ||
void (*callback)(ObserverResult<long> &), | ||
void (*callback)(ObserverResult<long> &, void *), | ||
nostd::string_view description = "", | ||
nostd::string_view unit = "") noexcept = 0; | ||
nostd::string_view unit = "", | ||
void *state = nullptr) noexcept = 0; | ||
|
||
virtual void CreateDoubleObservableUpDownCounter(nostd::string_view name, | ||
void (*callback)(ObserverResult<double> &), | ||
void (*callback)(ObserverResult<double> &, | ||
void *), | ||
nostd::string_view description = "", | ||
nostd::string_view unit = "") noexcept = 0; | ||
nostd::string_view unit = "", | ||
void *state = nullptr) noexcept = 0; | ||
}; | ||
} // namespace metrics | ||
OPENTELEMETRY_END_NAMESPACE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
Creates a Asynchronouse --> Creates an Asynchronous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.