We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Endpoint to disable telemtry
fairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.

Endpoint to disable telemtry
fairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mindsdb/api/http/namespaces/util.py`
Content:
```
1 from flask import request
2 from flask_restx import Resource, abort
3 from flask import current_app as ca
4 
5 from mindsdb.api.http.namespaces.configs.util import ns_conf
6 from mindsdb import __about__
7 
8 @ns_conf.route('/ping')
9 class Ping(Resource):
10     @ns_conf.doc('get_ping')
11     def get(self):
12         '''Checks server avaliable'''
13         return {'status': 'ok'}
14 
15 @ns_conf.route('/report_uuid')
16 class ReportUUID(Resource):
17     @ns_conf.doc('get_report_uuid')
18     def get(self):
19         metamodel_name = '___monitroing_metamodel___'
20         predictor = ca.mindsdb_native.create(metamodel_name)
21         return {
22             'report_uuid': predictor.report_uuid
23         }
24
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mindsdb/api/http/namespaces/util.py b/mindsdb/api/http/namespaces/util.py
--- a/mindsdb/api/http/namespaces/util.py
+++ b/mindsdb/api/http/namespaces/util.py
@@ -1,3 +1,4 @@
+import os
 from flask import request
 from flask_restx import Resource, abort
 from flask import current_app as ca
@@ -5,6 +6,8 @@
 from mindsdb.api.http.namespaces.configs.util import ns_conf
 from mindsdb import __about__
 
+TELEMETRY_FILE = 'telemetry.lock'
+
 @ns_conf.route('/ping')
 class Ping(Resource):
     @ns_conf.doc('get_ping')
@@ -21,3 +24,34 @@
         return {
             'report_uuid': predictor.report_uuid
         }
+
+@ns_conf.route('/telemetry')
+class Telemetry(Resource):
+    @ns_conf.doc('get_telemetry_status')
+    def get(self):
+        status = "enabled" if is_telemetry_active() else "disabled"
+        return {"status": status}
+
+    @ns_conf.doc('set_telemetry')
+    def post(self):
+        data = request.json
+        action = data['action']
+        if str(action).lower() in ["true", "enable", "on"]:
+            enable_telemetry()
+        else:
+            disable_telemetry()
+
+
+def enable_telemetry():
+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)
+    if os.path.exists(path):
+        os.remove(path)
+
+def disable_telemetry():
+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)
+    with open(path, 'w') as _:
+        pass
+
+def is_telemetry_active():
+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)
+    return not os.path.exists(path)

{"golden_diff": "diff --git a/mindsdb/api/http/namespaces/util.py b/mindsdb/api/http/namespaces/util.py\n--- a/mindsdb/api/http/namespaces/util.py\n+++ b/mindsdb/api/http/namespaces/util.py\n@@ -1,3 +1,4 @@\n+import os\n from flask import request\n from flask_restx import Resource, abort\n from flask import current_app as ca\n@@ -5,6 +6,8 @@\n from mindsdb.api.http.namespaces.configs.util import ns_conf\n from mindsdb import __about__\n \n+TELEMETRY_FILE = 'telemetry.lock'\n+\n @ns_conf.route('/ping')\n class Ping(Resource):\n     @ns_conf.doc('get_ping')\n@@ -21,3 +24,34 @@\n         return {\n             'report_uuid': predictor.report_uuid\n         }\n+\n+@ns_conf.route('/telemetry')\n+class Telemetry(Resource):\n+    @ns_conf.doc('get_telemetry_status')\n+    def get(self):\n+        status = \"enabled\" if is_telemetry_active() else \"disabled\"\n+        return {\"status\": status}\n+\n+    @ns_conf.doc('set_telemetry')\n+    def post(self):\n+        data = request.json\n+        action = data['action']\n+        if str(action).lower() in [\"true\", \"enable\", \"on\"]:\n+            enable_telemetry()\n+        else:\n+            disable_telemetry()\n+\n+\n+def enable_telemetry():\n+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n+    if os.path.exists(path):\n+        os.remove(path)\n+\n+def disable_telemetry():\n+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n+    with open(path, 'w') as _:\n+        pass\n+\n+def is_telemetry_active():\n+    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n+    return not os.path.exists(path)\n", "issue": "Endpoint to disable telemtry\nfairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.\r\n\nEndpoint to disable telemtry\nfairly self explainatory, add and an endpoint to the HTTP API that can be used to disable/enable the telemtry.\r\n\n", "before_files": [{"content": "from flask import request\nfrom flask_restx import Resource, abort\nfrom flask import current_app as ca\n\nfrom mindsdb.api.http.namespaces.configs.util import ns_conf\nfrom mindsdb import __about__\n\n@ns_conf.route('/ping')\nclass Ping(Resource):\n    @ns_conf.doc('get_ping')\n    def get(self):\n        '''Checks server avaliable'''\n        return {'status': 'ok'}\n\n@ns_conf.route('/report_uuid')\nclass ReportUUID(Resource):\n    @ns_conf.doc('get_report_uuid')\n    def get(self):\n        metamodel_name = '___monitroing_metamodel___'\n        predictor = ca.mindsdb_native.create(metamodel_name)\n        return {\n            'report_uuid': predictor.report_uuid\n        }\n", "path": "mindsdb/api/http/namespaces/util.py"}], "after_files": [{"content": "import os\nfrom flask import request\nfrom flask_restx import Resource, abort\nfrom flask import current_app as ca\n\nfrom mindsdb.api.http.namespaces.configs.util import ns_conf\nfrom mindsdb import __about__\n\nTELEMETRY_FILE = 'telemetry.lock'\n\n@ns_conf.route('/ping')\nclass Ping(Resource):\n    @ns_conf.doc('get_ping')\n    def get(self):\n        '''Checks server avaliable'''\n        return {'status': 'ok'}\n\n@ns_conf.route('/report_uuid')\nclass ReportUUID(Resource):\n    @ns_conf.doc('get_report_uuid')\n    def get(self):\n        metamodel_name = '___monitroing_metamodel___'\n        predictor = ca.mindsdb_native.create(metamodel_name)\n        return {\n            'report_uuid': predictor.report_uuid\n        }\n\n@ns_conf.route('/telemetry')\nclass Telemetry(Resource):\n    @ns_conf.doc('get_telemetry_status')\n    def get(self):\n        status = \"enabled\" if is_telemetry_active() else \"disabled\"\n        return {\"status\": status}\n\n    @ns_conf.doc('set_telemetry')\n    def post(self):\n        data = request.json\n        action = data['action']\n        if str(action).lower() in [\"true\", \"enable\", \"on\"]:\n            enable_telemetry()\n        else:\n            disable_telemetry()\n\n\ndef enable_telemetry():\n    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n    if os.path.exists(path):\n        os.remove(path)\n\ndef disable_telemetry():\n    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n    with open(path, 'w') as _:\n        pass\n\ndef is_telemetry_active():\n    path = os.path.join(ca.config_obj['storage_dir'], TELEMETRY_FILE)\n    return not os.path.exists(path)\n", "path": "mindsdb/api/http/namespaces/util.py"}]}