Skip to content

Script Development / Guance

The Guance Connector primarily provides a DataWay object for data writing and encapsulation of OpenAPI.

This Connector's API Key requires the Administrator role

Since this Connector automatically retrieves sensitive information such as workspace tokens for subsequent data reporting operations,

the API Key must be assigned the Administrator role.

DFF.CONN(...) parameters are as follows:

Parameter Type Required / Default Description
connector_id str Required Connector ID

OpenAPI documentation can be found at:

.dataway

The dataway attribute is the DataWay operation object corresponding to the current Guance. Its usage is the same as directly creating a DataWay Connector operation object.

Example
1
status_code, result = guance.dataway.write_by_category(category='metric', measurement='Host Monitoring', tags={'host': 'web-01'}, fields={'cpu': 10})

For complete content, please refer to:

.is_api_key_valid / .is_api_key_match

The is_api_key_valid / is_api_key_match attributes return whether the current Connector's API Key is valid:

Example
1
print(guance.is_api_key_valid)
Output Example
1
True

.workspace

The workspace attribute returns the current workspace information:

Example
1
2
import json
print(json.dumps(guance.workspace, indent=2))
Output Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "uuid"        : "wksp_xxxxx",
  "name"        : "xxxxx",
  "rpName"      : "rp1",
  "language"    : "zh",
  "timezone"    : "",
  "bossStation" : "CN",
  "billingState": "normal",
  "versionType" : "pay",
  "token"       : "tkn_xxxxx",
  "cliToken"    : "wkcli_xxxxx",
  "<Other fields omitted>": "..."
}

.workspace_uuid

The workspace_uuid attribute returns the current workspace UUID:

Example
1
print(guance.workspace_uuid)
Output Example
1
wksp_xxxxx

.workspace_token

The workspace_token attribute returns the current workspace Token:

Example
1
print(guance.workspace_token)
Output Example
1
tkn_xxxxx

.workspace_language

The workspace_language attribute returns the current workspace language:

Example
1
print(guance.workspace_language)
Output Example
1
zh

.do_get(...)

Used to initiate a GET request to the Guance OpenAPI. Parameters are as follows:

Parameter Type Required / Default Description
path str Required Path
query dict Parameters
Example
1
2
3
4
import json

result = guance.do_get('/api/v1/workspace/get')
print(json.dumps(result, indent=2))
Output Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "uuid"        : "wksp_xxxxx",
  "name"        : "xxxxx",
  "rpName"      : "rp1",
  "language"    : "zh",
  "timezone"    : "",
  "bossStation" : "CN",
  "billingState": "normal",
  "versionType" : "pay",
  "token"       : "tkn_xxxxx",
  "cliToken"    : "wkcli_xxxxx",
  "<Other fields omitted>": "..."
}

.do_post(...)

Used to initiate a POST request to the Guance OpenAPI. Parameters are as follows:

Parameter Type Required / Default Description
path str Required Path
query dict Parameters
body dict JSON Request Body
Example
1
2
3
4
body = {
    'desc': 'New description'
}
result = guance.do_post('/api/v1/workspace/modify', body=body)

Nodes

Guance has multiple nodes available for use. When creating a Guance Connector, the corresponding Guance node must be specified.

To ensure full offline usability, DataFlux Func itself saves a list of the latest Guance nodes available at the time of each release.

Therefore, it is possible that new nodes added by Guance may not be immediately reflected in DataFlux Func.


In such cases, you can refer to the configuration of the new Guance node at the following address and manually fill it in by selecting "Private Deployment".

The current list of available nodes is as follows:

Node Name Address
Fetching the latest node list...