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.
Common Data Service is oriented to different usage scenarios and provides the following methods to register data sources:
For a brand new data source, you can complete the registration by manually creating a data source.
If you need to share a data source between different environments or different OUs, you can quickly register the data source by exporting and importing files.
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.
Creating a Data Source¶
Select Source Data > 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
Enter a string of up to 100 characters as the identifier of the data source, which needs to be unique within the same (public/private) effective scope. If the key of a private data source is the same as a registered public data source key, the system will use the private data source when the duplicate key is passed in to call the data source.
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 2.2
orOLAP 2.3
, and if you need to synchronize metrics from Metric Management, one data source withOLAP 2.3
protocol is required. 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.
Exporting and Importing a Data Source¶
Follow the steps below to import a data source from a source OU to a target OU to achieve the rapid sharing of the data source.
Select Source Data > Data Sources from the left navigation pane in the source OU.
Select the Public Sources or Private Sources tab according to the effective scope of the target data source. For more information about the difference between public and private data sources, see Public/Private Data Sources.
Click Export corresponding to the target data source in the data source list. The exported JSON file contains such information as the data source’s identifier, service address, and API list.
Select Source Data > Data Sources from the left navigation pane in the target OU.
Select the Public Sources or Private Sources tab according to the effective scope of the target data source.
Click Import > Upload, select the file exported in step 3, and click OK.
Review the service address of the data source in the pop-up window and click OK.
Note
The data source with the same identifier in the file will overwrite the existing one, and the data source with a different identifier will be added.
When you register a private data source, if the data source key in the file is the same as a registered public data source key, the system will use the private data source when the duplicate key is passed in to call the data source.
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.