Registering a Data Source¶
Registering a data source is the first step of data registration and management in Common Data Service. Only by registering data sources in Common Data Service can these data sources provide various data for data consumers.
Prerequisites¶
You need to be assigned the required asset permission and operation permission, and a menu group containing the Data Sources menu. If not assigned, contact the application administrator.
All APIs that need to be registered have been standardized according to the Common Data Service API specifications. For more information, see Common Data Service API Specifications.
Procedure¶
Select Data Sources from the left navigation pane.
Select the Public Sources or Private Sources tab according to the effective scope of the target data source, and click New. For more information about the difference between public and private data sources, see Public/Private Data Sources.
Enter the following basic information of the data source on the Create Data Source page.
Field
Required/Optional
Description
Example
Data Source Key
Required
The identifier of the data source, which needs to be unique globally (including public and private data sources). Enter a string of up to 100 characters.
SolarAPI
Data Source Name
Required
The name of the data source. Enter a string of up to 100 characters.
Solar API
Service Address
Required
The service address of the data source, which usually consists of the transfer protocol and the domain name or IP of the server hosting the API services.
http://s-solareeop.apaas-eu2.example.com
Protocol
Required
If the data source comes from EnOS Metric Management, select
OLAP
. Otherwise selectStandard
.Standard
Enter the following API details in the API List section. If you need to register multiple APIs, click + Add API.
Category
Field
Required/Optional
Description
Example
Basic Configuration
API Type
Required
Depending on the type of data provided by the API, select
Metrics
,Accumulative Points
,Attributes
, orRecords
. Duplicate API types under the same data source are not allowed, that is, there is at most one API of each type.Metrics
Basic Configuration
API Address
Required
The resource path of the API, that is, the API access path.
/solar/metrics
Advanced Configuration
HTTP Method
Required
The request method of the API. Use
GET
orPOST
.POST
Advanced Configuration
String to Number
Required
If you need Common Data Service to convert the API query results from strings to numbers, enable this option.
Enabled
Advanced Configuration
Content Type
Required
The content type sent by the API. Use
application/x-www-form-urlencoded
orapplication/json
.application/x-www-form-urlencoded
Advanced Configuration
Service Address
Optional
If the service address of the API is different from the data source, enter the API service address, which will be used to overwrite the service address of the data source when Common Data Service calls this API.
/
Advanced Configuration
Connection Timeout Threshold
Required
If the connection time exceeds the threshold, Common Data Service decides that the connection has timed out. Enter a number greater than 0. The unit is
ms
and the default value is 10000.10000
Advanced Configuration
API Call Timeout Threshold
Required
If the request time exceeds the threshold, Common Data Service decides that the request has timed out. Enter a number greater than 0. The unit is
ms
and the default value is 30000.30000
Advanced Configuration
API Call Slow Threshold
Required
If the request time exceeds the threshold, Common Data Service decides that it is slow request. Enter a number greater than 0. The unit is
ms
and the default value is 15000.15000
Advanced Configuration
Failure Call Rate Threshold
Required
If the proportion of failed requests exceeds the threshold, the circuit breaker mechanism is triggered. Enter a number greater than 0 and less than or equal to 100. The unit is
%
and the default value is 50.50
Advanced Configuration
Slow Call Rate Threshold
Required
If the proportion of slow requests exceeds the threshold, the circuit breaker mechanism is triggered. Enter a number greater than 0 and less than or equal to 100. The unit is
%
and the default value is 50.50
Note
When Common Data Service queries multi-source data, to prevent the unavailability or low performance of a single data source from affecting other data sources, a circuit breaker mechanism is adopted for abnormal data sources. The mechanism uses data source API as the statistical unit and the last 100 calls of a certain data source API as the statistical range to count the number of slow requests (slow requests refer to requests whose request time exceeds API Call Slow Threshold).
If the slow request rate exceeds API Call Slow Threshold or the failure rate exceeds Failure Call Rate Threshold, Common Data Service triggers the circuit breaker mechanism and stops the calls of the data source API for 1 minute.
After 1 minute, Common Data Service restores the data source API service to a half-open state, allowing 10 requests. If the the circuit breaker condition is not met at this time, the circuit breaker ends, otherwise the circuit breaker continues for one minute.
Common Data Service circuit breaker mechanism only works for registered data source APIs. In the case of accessing multiple data source APIs in one request and circuit breaks partially occur, the data provided by other data source APIs can still be returned through Common Data Service without being affected by the circuit breaker.
Click Submit.
Results¶
Once registered, the data source appears in the data source list. You can view its details and perform the following actions on it.
Edit the data source: Click Edit of the target data source and modify configurations as required.
Delete the data source: Click Delete of the target data source. Deleted data sources cannot be restored.