Skip to content

Commit e69e157

Browse files
authored
timeseries: Removed the reference of model registry (open-edge-platform#1042)
Signed-off-by: Vellaisamy, Sathyendran <[email protected]>
1 parent 3ff6d51 commit e69e157

File tree

15 files changed

+171
-503
lines changed

15 files changed

+171
-503
lines changed

microservices/time-series-analytics/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ENV PYTHONPATH="$PYTHONPATH:/tmp/py_package:/app/kapacitor_python/"
6666

6767
# Adding classifier program
6868
# Copy Python source files in a single layer for better caching
69-
COPY ./src/classifier_startup.py ./src/opcua_alerts.py ./src/mr_interface.py ./src/main.py /app/
69+
COPY ./src/classifier_startup.py ./src/opcua_alerts.py ./src/main.py /app/
7070

7171
# Copy configuration files and directories efficiently
7272
COPY ./config.json /app/

microservices/time-series-analytics/config.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
"model_registry": {
3-
"enable": false,
4-
"version": "1.0"
5-
},
62
"udfs": {
73
"name": "temperature_classifier"
84
}

microservices/time-series-analytics/docs/user-guide/Overview.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ What sets this microservice apart is its support for advanced analytics through
99
The key features include:
1010
- **Bring your own Data Sets and corresponding User Defined Functions(UDFs) for custom analytics**: Easily implement and deploy your own Python-based analytics logic, following Kapacitor’s UDF standards.
1111
- **Seamless Integration**: Automatically stores processed results back into InfluxDB for unified data management and visualization.
12-
- **Model Registry Support**: Dynamically fetch and deploy UDF scripts, machine learning models, and TICKscripts from the Model Registry microservice, enabling rapid customization and iteration.
1312
- **Versatile Use Cases**: Ideal for anomaly detection, alerting, and advanced time series analytics in industrial, IoT, and enterprise environments.
1413

1514
For more information on creating custom UDFs, see the [Kapacitor Anomaly Detection Guide](https://docs.influxdata.com/kapacitor/v1/guides/anomaly_detection/)

microservices/time-series-analytics/docs/user-guide/api-docs/openapi.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
"openapi": "3.1.0",
33
"info": {
44
"title": "Time Series Analytics Microservice API",
5-
"version": "1.0.0"
5+
"version": "1.1.0"
66
},
7+
"servers": [
8+
{
9+
"url": "/ts-api"
10+
}
11+
],
712
"paths": {
813
"/health": {
914
"get": {
@@ -27,13 +32,13 @@
2732
"/opcua_alerts": {
2833
"post": {
2934
"summary": "Receive Alert",
30-
"description": "Receive and process OPC UA alerts.\n\nThis endpoint accepts alert messages in JSON format and forwards them to the configured OPC UA client.\nIf the OPC UA client is not initialized, it will attempt to initialize it using the current configuration.\n\nRequest Body Example:\n {\n \"alert\": \"message\"\n }\n\nResponses:\n 200:\n description: Alert received and processed successfully.\n content:\n application/json:\n example:\n {\n \"status_code\": 200,\n \"status\": \"success\",\n \"message\": \"Alert received\"\n }\n 500:\n description: Failed to process the alert due to server error or misconfiguration.\n content:\n application/json:\n example:\n {\n \"detail\": \"Failed to initialize OPC UA client: \u003Cerror_message\u003E\"\n }\n\nRaises:\n HTTPException: If OPC UA alerts are not configured or if there is an error during processing.",
35+
"description": "Receive and process OPC UA alerts.\n\nThis endpoint accepts alert messages in JSON format and forwards them to the \nconfigured OPC UA client.\nIf the OPC UA client is not initialized, it will attempt to initialize it \nusing the current configuration.\n\nRequest Body Example:\n {\n \"alert\": \"message\"\n }\n\nResponses:\n 200:\n description: Alert received and processed successfully.\n content:\n application/json:\n example:\n {\n \"status_code\": 200,\n \"status\": \"success\",\n \"message\": \"Alert received\"\n }\n 500:\n description: Failed to process the alert due to server error or misconfiguration.\n content:\n application/json:\n example:\n {\n \"detail\": \"Failed to initialize OPC UA client: \u003Cerror_message\u003E\"\n }\n\nRaises:\n HTTPException: If OPC UA alerts are not configured or if there is an error during \n processing.",
3136
"operationId": "receive_alert_opcua_alerts_post",
3237
"requestBody": {
3338
"content": {
3439
"application/json": {
3540
"schema": {
36-
"$ref": "#/components/schemas/Opcua_Alerts_Message"
41+
"$ref": "#/components/schemas/OpcuaAlertsMessage"
3742
}
3843
}
3944
},
@@ -66,7 +71,7 @@
6671
"/input": {
6772
"post": {
6873
"summary": "Receive Data",
69-
"description": "Receives a data point in JSON format, converts it to InfluxDB line protocol, and sends it to the Kapacitor service.\n\nThe input JSON must include:\n - topic (str): The topic name.\n - tags (dict): Key-value pairs for tags (e.g., {\"location\": \"factory1\"}).\n - fields (dict): Key-value pairs for fields (e.g., {\"temperature\": 23.5}).\n - timestamp (int, optional): Epoch time in nanoseconds. If omitted, current time is used.\n\nExample request body:\n{\n \"topic\": \"sensor_data\",\n \"tags\": {\"location\": \"factory1\", \"device\": \"sensorA\"},\n \"fields\": {\"temperature\": 23.5, \"humidity\": 60},\n \"timestamp\": 1718000000000000000\n}\n\nArgs:\n data_point (DataPoint): The data point to be processed, provided in the request body.\nReturns:\n dict: A status message indicating success or failure.\nRaises:\n HTTPException: If the Kapacitor service returns an error or if any exception occurs during processing.\n\nresponses:\n '200':\n description: Data successfully sent to the Time series Analytics microservice\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: success\n message:\n type: string\n example: Data sent to Time series Analytics microservice\n '4XX':\n description: Client error (e.g., invalid input or Kapacitor error)\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/HTTPValidationError'\n '500':\n description: Internal server error\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string",
74+
"description": "Receives a data point in JSON format, converts it to InfluxDB line protocol, \nand sends it to the Kapacitor service.\n\nThe input JSON must include:\n - topic (str): The topic name.\n - tags (dict): Key-value pairs for tags (e.g., {\"location\": \"factory1\"}).\n - fields (dict): Key-value pairs for fields (e.g., {\"temperature\": 23.5}).\n - timestamp (int, optional): Epoch time in nanoseconds. If omitted, current time is used.\n\nExample request body:\n{\n \"topic\": \"sensor_data\",\n \"tags\": {\"location\": \"factory1\", \"device\": \"sensorA\"},\n \"fields\": {\"temperature\": 23.5, \"humidity\": 60},\n \"timestamp\": 1718000000000000000\n}\n\nArgs:\n data_point (DataPoint): The data point to be processed, provided in the request body.\nReturns:\n dict: A status message indicating success or failure.\nRaises:\n HTTPException: If the Kapacitor service returns an error or if any exception \n occurs during processing.\n\nresponses:\n '200':\n description: Data successfully sent to the Time series Analytics microservice\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: success\n message:\n type: string\n example: Data sent to Time series Analytics microservice\n '4XX':\n description: Client error (e.g., invalid input or Kapacitor error)\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/HTTPValidationError'\n '500':\n description: Internal server error\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string",
7075
"operationId": "receive_data_input_post",
7176
"requestBody": {
7277
"content": {
@@ -105,7 +110,7 @@
105110
"/config": {
106111
"get": {
107112
"summary": "Get Config",
108-
"description": "Endpoint to retrieve the current configuration of the input service.\nAccepts an optional 'restart' query parameter and returns the current configuration in JSON format.\nIf 'restart=true' is provided, the Time Series Analytics Microservice UDF deployment service will be restarted before returning the configuration.\n\n---\nparameters:\n - in: query\n name: restart\n schema:\n type: boolean\n default: false\n description: Restart the Time Series Analytics Microservice UDF deployment if true\nresponses:\n 200:\n description: Current configuration retrieved successfully\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\n \"model_registry\": { \"enable\": true, \"version\": \"2.0\" },\n \"udfs\": { \"name\": \"udf_name\", \"model\": \"model_name\" },\n \"alerts\": {}\n }\n 500:\n description: Failed to retrieve configuration\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to retrieve configuration\"",
113+
"description": "Endpoint to retrieve the current configuration of the input service.\nAccepts an optional 'restart' query parameter and returns the current configuration \nin JSON format.\nIf 'restart=true' is provided, the Time Series Analytics Microservice UDF deployment \nservice will be restarted before returning the configuration.\n\n---\nparameters:\n - in: query\n name: restart\n schema:\n type: boolean\n default: false\n description: Restart the Time Series Analytics Microservice UDF deployment if true\nresponses:\n 200:\n description: Current configuration retrieved successfully\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\n \"udfs\": { \"name\": \"udf_name\", \"model\": \"model_name\" },\n \"alerts\": {}\n }\n 500:\n description: Failed to retrieve configuration\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to retrieve configuration\"",
109114
"operationId": "get_config_config_get",
110115
"parameters": [
111116
{
@@ -153,7 +158,7 @@
153158
},
154159
"post": {
155160
"summary": "Config File Change",
156-
"description": "Endpoint to handle configuration changes.\nThis endpoint can be used to update the configuration of the input service.\nUpdates the configuration of the input service with the provided key-value pairs.\n\n---\nrequestBody:\n required: true\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\"model_registry\": {\n \"enable\": true\n \"version\": \"2.0\"\n },\n \"udfs\": {\n \"name\": \"udf_name\",\n \"model\": \"model_name\"}\n \"alerts\": {\n }\nresponses:\n 200:\n description: Configuration updated successfully\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: \"success\"\n message:\n type: string\n example: \"Configuration updated successfully\"\n 400:\n description: Invalid input or error processing request\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Error message\"\n 500:\n description: Failed to write configuration to file\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to write configuration to file\"",
161+
"description": "Endpoint to handle configuration changes.\nThis endpoint can be used to update the configuration of the input service.\nUpdates the configuration of the input service with the provided key-value pairs.\n\n---\nrequestBody:\n required: true\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\n \"udfs\": {\n \"name\": \"udf_name\",\n \"model\": \"model_name\",\n \"device\": \"cpu or gpu\"}\n \"alerts\": {\n }\nresponses:\n 200:\n description: Configuration updated successfully\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: \"success\"\n message:\n type: string\n example: \"Configuration updated successfully\"\n 400:\n description: Invalid input or error processing request\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Error message\"\n 500:\n description: Failed to write configuration to file\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to write configuration to file\"",
157162
"operationId": "config_file_change_config_post",
158163
"requestBody": {
159164
"required": true,
@@ -194,21 +199,13 @@
194199
"schemas": {
195200
"Config": {
196201
"properties": {
197-
"model_registry": {
198-
"additionalProperties": true,
199-
"type": "object",
200-
"title": "Model Registry",
201-
"default": {
202-
"enable": false,
203-
"version": "1.0"
204-
}
205-
},
206202
"udfs": {
207203
"additionalProperties": true,
208204
"type": "object",
209205
"title": "Udfs",
210206
"default": {
211-
"name": "udf_name"
207+
"name": "udf_name",
208+
"device": "cpu/gpu"
212209
}
213210
},
214211
"alerts": {
@@ -228,7 +225,8 @@
228225
}
229226
},
230227
"type": "object",
231-
"title": "Config"
228+
"title": "Config",
229+
"description": "Configuration model for the service."
232230
},
233231
"DataPoint": {
234232
"properties": {
@@ -270,7 +268,8 @@
270268
"topic",
271269
"fields"
272270
],
273-
"title": "DataPoint"
271+
"title": "DataPoint",
272+
"description": "Data point model for input data."
274273
},
275274
"HTTPValidationError": {
276275
"properties": {
@@ -285,13 +284,14 @@
285284
"type": "object",
286285
"title": "HTTPValidationError"
287286
},
288-
"Opcua_Alerts_Message": {
287+
"OpcuaAlertsMessage": {
289288
"properties": {
290289

291290
},
292291
"additionalProperties": true,
293292
"type": "object",
294-
"title": "Opcua_Alerts_Message"
293+
"title": "OpcuaAlertsMessage",
294+
"description": "Model for OPC UA alert messages."
295295
},
296296
"ValidationError": {
297297
"properties": {

0 commit comments

Comments
 (0)