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:
Nathan
2023-06-21 20:52:39 -04:00
parent b2007c3814
commit ccbc079746
4 changed files with 66 additions and 5 deletions

View File

@@ -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()
}
}