mirror of
https://github.com/yalue/onnxruntime_go.git
synced 2025-10-30 02:11:45 +08:00
Expose telemetry control APIs
- This change adds the DisableTelemetry() and EnableTelemetry() top-level functions, which wrap the DisableTelemetryEvents() and EnableTelemetryEvents() C API functions for the package's internal onnxruntime environment. - This change rolls back some of the prior commit. As a fan of the onnxruntime library, I decided to take a more charitable approach to their telemetry and not disable it by default in these bindings.
This commit is contained in:
@@ -265,3 +265,30 @@ func TestExampleNetwork(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnableDisableTelemetry(t *testing.T) {
|
||||
InitializeRuntime(t)
|
||||
defer func() {
|
||||
e := DestroyEnvironment()
|
||||
if e != nil {
|
||||
t.Logf("Error cleaning up environment: %s\n", e)
|
||||
t.FailNow()
|
||||
}
|
||||
}()
|
||||
e := EnableTelemetry()
|
||||
if e != nil {
|
||||
t.Logf("Error enabling onnxruntime telemetry: %s\n", e)
|
||||
t.Fail()
|
||||
}
|
||||
e = DisableTelemetry()
|
||||
if e != nil {
|
||||
t.Logf("Error disabling onnxruntime telemetry: %s\n", e)
|
||||
t.Fail()
|
||||
}
|
||||
e = EnableTelemetry()
|
||||
if e != nil {
|
||||
t.Logf("Error re-enabling onnxruntime telemetry after disabling: %s\n",
|
||||
e)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user