-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Adding platform telemetry #2109
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c58b508
staging some in progress work
walrusmcd 1447aeb
added some inference session changes and global error logging
walrusmcd c380add
next iteration
walrusmcd f9ea7a4
next round of changes. coded SessionCreation
walrusmcd ed8c955
fixed build break in POSIX.
walrusmcd 176c07c
merged origin/master
walrusmcd e16a24d
fixed the C# projection with the new api additions.
walrusmcd c2a47fa
fixed posix build failures
walrusmcd e90e6b4
another posix build break
walrusmcd bc1d66c
Merge remote-tracking branch 'origin/master' into paulm/telemetry
walrusmcd 882f7ab
DML build breaks.
walrusmcd 0c45370
code style and PR comments.
walrusmcd 8b07208
doc changes
walrusmcd 8038585
git merge origin/master
walrusmcd f50935b
extra spaces got in there somehow.
walrusmcd fb8393b
camelCase fixed
walrusmcd beec829
Rearrange content order (#2183)
faxu e721907
Merge remote-tracking branch 'origin/master' into paulm/telemetry
pranavsharma 7d1a1b9
Merge remote-tracking branch 'origin/master' into paulm/telemetry
pranavsharma 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 |
---|---|---|
|
@@ -30,9 +30,12 @@ | |
* [Technical Design Details](#technical-design-details) | ||
* [Extensibility Options](#extensibility-options) | ||
|
||
**[Data/Telemetry](#Data/Telemetry)** | ||
|
||
**[Contributions and Feedback](#contribute)** | ||
|
||
**[License](#license)** | ||
|
||
*** | ||
# Key Features | ||
## Run any ONNX model | ||
|
@@ -160,6 +163,10 @@ To tune performance for ONNX models, the [ONNX Go Live tool "OLive"](https://git | |
transform](include/onnxruntime/core/optimizer/graph_transformer.h) | ||
* [Add a new rewrite rule](include/onnxruntime/core/optimizer/rewrite_rule.h) | ||
|
||
*** | ||
# Data/Telemetry | ||
This project may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](docs/Privacy.md) for more details. | ||
|
||
*** | ||
# Contribute | ||
We welcome contributions! Please see the [contribution guidelines](CONTRIBUTING.md). | ||
|
@@ -171,6 +178,7 @@ For any feedback or to report a bug, please file a [GitHub Issue](https://github | |
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) | ||
or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
*** | ||
# License | ||
[MIT License](LICENSE) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Privacy | ||
|
||
## Data Collection | ||
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. | ||
|
||
*** | ||
|
||
### Private Builds | ||
No data collection is performed when using your private builds. | ||
|
||
### Official Builds | ||
Currently telemetry is only implemented for Windows builds, but may be expanded in the future to cover other platforms. Telemetry is turned OFF by default while this feature is in BETA. When the feature moves from BETA to RELEASE, developers should expect telemetry to be ON by default when using the Official Builds. This is implemented via 'Platform Telemetry' per vendor platform providers (see telemetry.h). | ||
|
||
#### Technical Details | ||
The Windows provider uses the [TraceLogging](https://docs.microsoft.com/en-us/windows/win32/tracelogging/trace-logging-about) API for its implementation. | ||
|
||
For API usage details to turn this on/off, please check the API pages: | ||
* [C API](./C_API.md#telemetry) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#define ONNXRUNTIME_VERSION_STRING "1.0" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#include "core/platform/telemetry.h" | ||
#include "core/platform/env.h" | ||
|
||
namespace onnxruntime { | ||
|
||
void LogRuntimeError(uint32_t sessionId, const common::Status& status, const char* file, | ||
const char* function, uint32_t line) | ||
{ | ||
const Env& env = Env::Default(); | ||
env.GetTelemetryProvider().LogRuntimeError(sessionId, status, file, function, line); | ||
} | ||
|
||
void Telemetry::EnableTelemetryEvents() const { | ||
} | ||
|
||
void Telemetry::DisableTelemetryEvents() const { | ||
} | ||
|
||
void Telemetry::LogProcessInfo() const { | ||
} | ||
|
||
void Telemetry::LogSessionCreation(uint32_t session_id, int64_t ir_version, const std::string& model_producer_name, | ||
const std::string& model_producer_version, const std::string& model_domain, | ||
const std::unordered_map<std::string, int>& domain_to_version_map, | ||
const std::string& model_graph_name, | ||
const std::unordered_map<std::string, std::string>& model_metadata, | ||
const std::string& loadedFrom, const std::vector<std::string>& execution_provider_ids) const { | ||
ORT_UNUSED_PARAMETER(session_id); | ||
ORT_UNUSED_PARAMETER(ir_version); | ||
ORT_UNUSED_PARAMETER(model_producer_name); | ||
ORT_UNUSED_PARAMETER(model_producer_version); | ||
ORT_UNUSED_PARAMETER(model_domain); | ||
ORT_UNUSED_PARAMETER(domain_to_version_map); | ||
ORT_UNUSED_PARAMETER(model_graph_name); | ||
ORT_UNUSED_PARAMETER(model_metadata); | ||
ORT_UNUSED_PARAMETER(loadedFrom); | ||
ORT_UNUSED_PARAMETER(execution_provider_ids); | ||
} | ||
|
||
void Telemetry::LogRuntimeError(uint32_t session_id, const common::Status& status, const char* file, | ||
const char* function, uint32_t line) const { | ||
ORT_UNUSED_PARAMETER(session_id); | ||
ORT_UNUSED_PARAMETER(status); | ||
ORT_UNUSED_PARAMETER(file); | ||
ORT_UNUSED_PARAMETER(function); | ||
ORT_UNUSED_PARAMETER(line); | ||
} | ||
|
||
void Telemetry::LogRuntimePerf(uint32_t session_id, uint32_t total_runs_since_last, int64_t total_run_duration_since_last) const { | ||
ORT_UNUSED_PARAMETER(session_id); | ||
ORT_UNUSED_PARAMETER(total_runs_since_last); | ||
ORT_UNUSED_PARAMETER(total_run_duration_since_last); | ||
} | ||
|
||
} // namespace onnxruntime | ||
|
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <unordered_map> | ||
|
||
#include "core/common/status.h" | ||
#include "core/common/common.h" | ||
|
||
namespace onnxruntime { | ||
|
||
/** | ||
* Configuration information for a session. | ||
* An interface used by the onnxruntime implementation to | ||
* access operating system functionality for telemetry | ||
* | ||
* look at env.h and the Env objection which is the activation factory | ||
* for telemetry instances | ||
* | ||
* All Telemetry implementations are safe for concurrent access from | ||
* multiple threads without any external synchronization. | ||
*/ | ||
class Telemetry { | ||
public: | ||
// don't create these, use Env::GetTelemetryProvider() instead | ||
// this constructor is made public so that other platform Env providers can | ||
// use this base class as a "stub" implementation | ||
Telemetry() = default; | ||
virtual ~Telemetry() = default; | ||
|
||
virtual void EnableTelemetryEvents() const; | ||
virtual void DisableTelemetryEvents() const; | ||
|
||
virtual void LogProcessInfo() const; | ||
|
||
virtual void LogSessionCreation(uint32_t session_id, int64_t ir_version, const std::string& model_producer_name, | ||
const std::string& model_producer_version, const std::string& model_domain, | ||
const std::unordered_map<std::string, int>& domain_to_version_map, | ||
const std::string& model_graph_name, | ||
const std::unordered_map<std::string, std::string>& model_metadata, | ||
const std::string& loadedFrom, const std::vector<std::string>& execution_provider_ids) const; | ||
|
||
virtual void LogRuntimeError(uint32_t session_id, const common::Status& status, const char* file, | ||
const char* function, uint32_t line) const; | ||
|
||
virtual void LogRuntimePerf(uint32_t session_id, uint32_t total_runs_since_last, int64_t total_run_duration_since_last) const; | ||
|
||
private: | ||
ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(Telemetry); | ||
}; | ||
|
||
} // namespace onnxruntime |
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.
Do we plan to send events for cases when we just do ORT_THROW? #Resolved
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.
good catch. I first coded ORT_RETURN_IF and ORT_THROW_IF . it covers most all code paths, but not all. how about i file a tracking item in a second PR to catch all of the macros?
In reply to: 335302117 [](ancestors = 335302117)
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.
Sure, that's fine. #Resolved
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.
added as a work item
In reply to: 335777787 [](ancestors = 335777787)