dqlmagic 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dqlmagic-1.0.1/PKG-INFO +75 -0
- dqlmagic-1.0.1/dqlmagic/__init__.py +6 -0
- dqlmagic-1.0.1/dqlmagic/dqlmagic.py +180 -0
- dqlmagic-1.0.1/dqlmagic.egg-info/PKG-INFO +75 -0
- dqlmagic-1.0.1/dqlmagic.egg-info/SOURCES.txt +12 -0
- dqlmagic-1.0.1/dqlmagic.egg-info/dependency_links.txt +1 -0
- dqlmagic-1.0.1/dqlmagic.egg-info/requires.txt +3 -0
- dqlmagic-1.0.1/dqlmagic.egg-info/top_level.txt +1 -0
- dqlmagic-1.0.1/dqlmagic.egg-info/zip-safe +1 -0
- dqlmagic-1.0.1/pyproject.toml +3 -0
- dqlmagic-1.0.1/readme.md +62 -0
- dqlmagic-1.0.1/setup.cfg +27 -0
- dqlmagic-1.0.1/setup.py +1 -0
dqlmagic-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dqlmagic
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: IPython magic function for Dynatrace Query Language (DQL)
|
|
5
|
+
Home-page: https://github.com/dtPaTh/Dqlmagic
|
|
6
|
+
Author: Patrick Thurner
|
|
7
|
+
Author-email: patrick.thurner@dynatrace.com
|
|
8
|
+
License: Apache 2.0
|
|
9
|
+
Keywords: Notebook,Jupyter,DQL,Dynatrace Query Language
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Dqlmagic
|
|
15
|
+
|
|
16
|
+
An IPython magic function allowing to use DQL in your notebooks.
|
|
17
|
+
|
|
18
|
+
Dynatrace Query Language (DQL) is a powerful tool to explore your data and discover patterns, identify anomalies and outliers, create statistical modeling, and more based on data stored in Dynatrace Grail storage.
|
|
19
|
+
|
|
20
|
+
Dqlmagic makes DQL queries available to be used in jupyter notebooks.
|
|
21
|
+
|
|
22
|
+
## Available magic functions
|
|
23
|
+
|
|
24
|
+
### dql <dql_query>
|
|
25
|
+
Allows to run a DQL query and returns the response records as json array.
|
|
26
|
+
|
|
27
|
+
Available as inline and cell function.
|
|
28
|
+
|
|
29
|
+
### dql_raw <dql_query>
|
|
30
|
+
Allows to run a DQL query and returns the response in raw json format as provided by the api.
|
|
31
|
+
|
|
32
|
+
Available as inline and cell function.
|
|
33
|
+
|
|
34
|
+
### auth_grail <config_prefix>
|
|
35
|
+
Inline function connecting to the grail cluster.
|
|
36
|
+
|
|
37
|
+
Reads connection parameters from .env file:
|
|
38
|
+
```
|
|
39
|
+
dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
40
|
+
|
|
41
|
+
dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
42
|
+
dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
43
|
+
dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
44
|
+
|
|
45
|
+
dt_tenant="<YOUR-TENANT-ID>"
|
|
46
|
+
grail_apiurl="https://<YOUR-TENANT-ID>.live.dynatrace.com/api/v2/dql/query"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The ```<config_prefix>``` is **optional** to be used if you have multiple configs stored in your .env file like e.g.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
dt_config_prefix="DEV"
|
|
53
|
+
|
|
54
|
+
DEV_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
55
|
+
DEV_dt_oauth_clientid="<YOUR-DEV-CLIENT-ID>"
|
|
56
|
+
DEV_dt_oauth_clientsecret="<YOUR-DEV-CLIENT-SECRET>"
|
|
57
|
+
DEV_dt_oauth_scope="<YOUR-DEV-ACCESS-SCOPE>"
|
|
58
|
+
DEV_dt_tenant="<YOUR-DEV-TENANT-ID>"
|
|
59
|
+
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.dynatracelabs.com/platform/storage/query/v1/"
|
|
60
|
+
|
|
61
|
+
PROD_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
62
|
+
PROD_dt_oauth_clientid="<YOUR-PROD-CLIENT-ID>"
|
|
63
|
+
PROD_dt_oauth_clientsecret="<YOUR-PROD-CLIENT-SECRET>"
|
|
64
|
+
PROD_dt_oauth_scope="<YOUR-PROD-ACCESS-SCOPE>"
|
|
65
|
+
PROD_dt_tenant="<YOUR-PROD-TENANT-ID>"
|
|
66
|
+
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.dynatracelabs.com/platform/storage/query/v1/"
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
With the parameter ```dt_config_prefix```, you set the default config prefix used, if %auth_grail parameter ```<config_prefix>``` is not provided.
|
|
71
|
+
|
|
72
|
+
For more details on how to setup API oauth clients in Dynatrace see [Configure and manage account API OAuth clients
|
|
73
|
+
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth)
|
|
74
|
+
|
|
75
|
+
For more details on .env file see [How to NOT embedded credential in Jupyter notebook](https://yuthakarn.medium.com/how-to-not-show-credential-in-jupyter-notebook-c349f9278466) or [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic, line_cell_magic)
|
|
2
|
+
import requests
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from dotenv import load_dotenv
|
|
6
|
+
from datetime import timedelta
|
|
7
|
+
import datetime
|
|
8
|
+
import time
|
|
9
|
+
|
|
10
|
+
@magics_class
|
|
11
|
+
class DQLmagic(Magics):
|
|
12
|
+
|
|
13
|
+
config_prefix=''
|
|
14
|
+
|
|
15
|
+
oauth_url = None
|
|
16
|
+
oauth_clientid = None
|
|
17
|
+
oauth_clientsecret = None
|
|
18
|
+
oauth_scope = None
|
|
19
|
+
|
|
20
|
+
grail_apiurl = None
|
|
21
|
+
access_token = None
|
|
22
|
+
|
|
23
|
+
dt_tenant = None
|
|
24
|
+
dt_app_context = None
|
|
25
|
+
|
|
26
|
+
isPlatformAPI = False
|
|
27
|
+
|
|
28
|
+
dql_default_query_timespan_minutes = 8*60
|
|
29
|
+
|
|
30
|
+
def get_bearer(self):
|
|
31
|
+
|
|
32
|
+
if (self.oauth_url is None or self.oauth_clientid is None or self.oauth_clientsecret is None or self.oauth_scope is None or self.oauth_scope is None):
|
|
33
|
+
self.access_token = None
|
|
34
|
+
else:
|
|
35
|
+
payload = "grant_type=client_credentials&client_id="+self.oauth_clientid+"&client_secret="+self.oauth_clientsecret+"&scope="+self.oauth_scope
|
|
36
|
+
|
|
37
|
+
headers = {'content-type': "application/x-www-form-urlencoded"}
|
|
38
|
+
|
|
39
|
+
try:
|
|
40
|
+
response = requests.request("POST", self.oauth_url, data=payload, headers=headers)
|
|
41
|
+
res = json.loads(response.text)
|
|
42
|
+
|
|
43
|
+
self.access_token = res["access_token"]
|
|
44
|
+
except:
|
|
45
|
+
self.access_token = None
|
|
46
|
+
|
|
47
|
+
return self.access_token
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@line_magic
|
|
51
|
+
def auth_grail(self, line):
|
|
52
|
+
|
|
53
|
+
load_dotenv()
|
|
54
|
+
|
|
55
|
+
cfgPrefix = os.getenv('dt_config_prefix')
|
|
56
|
+
|
|
57
|
+
if len(line)>0:
|
|
58
|
+
cfgPrefix=line.strip()
|
|
59
|
+
|
|
60
|
+
if cfgPrefix==None: cfgPrefix=''
|
|
61
|
+
else: cfgPrefix+='_'
|
|
62
|
+
self.config_prefix = cfgPrefix
|
|
63
|
+
|
|
64
|
+
self.oauth_url = os.getenv(self.config_prefix+'dt_oauth_url')
|
|
65
|
+
self.oauth_clientid = os.getenv(self.config_prefix+'dt_oauth_clientid')
|
|
66
|
+
self.oauth_clientsecret = os.getenv(self.config_prefix+'dt_oauth_clientsecret')
|
|
67
|
+
self.oauth_scope = os.getenv(self.config_prefix+'dt_oauth_scope')
|
|
68
|
+
|
|
69
|
+
if (self.oauth_url is None): return "Missing connection parameter 'dt_oauth_url'"
|
|
70
|
+
if (self.oauth_clientid is None): return "Missing connection parameter 'oauth_clientid'"
|
|
71
|
+
if (self.oauth_clientsecret is None): return "Missing connection parameter 'oauth_clientsecret'"
|
|
72
|
+
if (self.oauth_scope is None): return "Missing connection parameter 'oauth_scope'"
|
|
73
|
+
|
|
74
|
+
self.grail_apiurl = os.getenv(self.config_prefix+'grail_apiurl')
|
|
75
|
+
self.dt_tenant = os.getenv(self.config_prefix+"dt_tenant")
|
|
76
|
+
self.dt_app_context = os.getenv(self.config_prefix+"dt_app_context")
|
|
77
|
+
queryTimespan = os.getenv('dql_default_query_timespan_minutes')
|
|
78
|
+
if queryTimespan != None: self.dql_default_query_timespan_minutes = int(queryTimespan)
|
|
79
|
+
|
|
80
|
+
if (self.grail_apiurl is None): return "Missing connection parameter 'grail_apiurl'"
|
|
81
|
+
if (self.dt_tenant is None): return "Missing connection parameter 'dt_tenant'"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
self.get_bearer()
|
|
85
|
+
|
|
86
|
+
if (self.access_token is None):
|
|
87
|
+
return "Couldn't successfully authenticate"
|
|
88
|
+
else:
|
|
89
|
+
return "Successfully authenticated"
|
|
90
|
+
|
|
91
|
+
@line_magic
|
|
92
|
+
def dql(self, line):
|
|
93
|
+
return self.dql(line,None)
|
|
94
|
+
|
|
95
|
+
@cell_magic
|
|
96
|
+
def dql(self, line, cell):
|
|
97
|
+
return self.dql(line, cell)
|
|
98
|
+
|
|
99
|
+
@line_cell_magic
|
|
100
|
+
def dql(self, line, cell=None):
|
|
101
|
+
res = self.dql_raw(line,cell)
|
|
102
|
+
if res:
|
|
103
|
+
jdata = json.loads(res)
|
|
104
|
+
return jdata["result"]["records"]
|
|
105
|
+
else:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
@line_magic
|
|
109
|
+
def dql_raw(self, line):
|
|
110
|
+
return self.dql_raw(line,None)
|
|
111
|
+
|
|
112
|
+
@cell_magic
|
|
113
|
+
def dql_raw(self, line, cell):
|
|
114
|
+
return self.dql_raw(line, cell)
|
|
115
|
+
|
|
116
|
+
@line_cell_magic
|
|
117
|
+
def dql_raw(self, line, cell=None):
|
|
118
|
+
|
|
119
|
+
if (self.get_bearer() is None):
|
|
120
|
+
return "Not authorized. Log in via '%auth_grail <...>"
|
|
121
|
+
else :
|
|
122
|
+
|
|
123
|
+
dql=line
|
|
124
|
+
if cell is not None:
|
|
125
|
+
dql = cell
|
|
126
|
+
|
|
127
|
+
queryParams = {
|
|
128
|
+
"enrich":"metric-metadata"
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
headers = {
|
|
132
|
+
"accept": "application/json",
|
|
133
|
+
"Authorization":"Bearer "+self.access_token,
|
|
134
|
+
"dt-tenant": self.dt_tenant
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
now = datetime.datetime.utcnow()
|
|
138
|
+
|
|
139
|
+
body = {
|
|
140
|
+
"query": dql,
|
|
141
|
+
"defaultTimeframeStart": (now - timedelta(minutes=self.dql_default_query_timespan_minutes)).strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
|
|
142
|
+
"defaultTimeframeEnd": now.strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
|
|
143
|
+
"timezone": "UTC",
|
|
144
|
+
"locale": "en_US",
|
|
145
|
+
"maxResultRecords": 1000,
|
|
146
|
+
"fetchTimeoutSeconds": 60,
|
|
147
|
+
"requestTimeoutMilliseconds": 1000,
|
|
148
|
+
"enablePreview": True,
|
|
149
|
+
"defaultSamplingRatio": 1000,
|
|
150
|
+
"defaultScanLimitGbytes": 250
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
response = requests.request("POST", self.grail_apiurl+"query:execute", headers=headers, params=queryParams, json=body)
|
|
154
|
+
if(response.status_code == 200):
|
|
155
|
+
return response.text
|
|
156
|
+
elif (response.status_code == 202):
|
|
157
|
+
print ("Start polling query updates..")
|
|
158
|
+
statusQueryParams = {
|
|
159
|
+
"request-token": response.json()["requestToken"],
|
|
160
|
+
"enrich":"metric-metadata"
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
polling_interval = 1
|
|
164
|
+
|
|
165
|
+
while True:
|
|
166
|
+
statusResponse = requests.get(self.grail_apiurl+"query:poll", params=statusQueryParams)
|
|
167
|
+
|
|
168
|
+
if statusResponse.status_code == 200:
|
|
169
|
+
status_update = statusResponse.json()["state"]
|
|
170
|
+
if status_update == "SUCCEEDED":
|
|
171
|
+
return statusResponse.text
|
|
172
|
+
else:
|
|
173
|
+
time.sleep(polling_interval)
|
|
174
|
+
else:
|
|
175
|
+
return '{"result":{"records":[{"ERROR":"Failed to poll query result ('+str(statusResponse.status_code)+')"}]}}'
|
|
176
|
+
|
|
177
|
+
else:
|
|
178
|
+
return '{"result":{"records":[{"ERROR":"Failed to execute query ('+str(response.status_code)+')"}]}}'
|
|
179
|
+
|
|
180
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dqlmagic
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: IPython magic function for Dynatrace Query Language (DQL)
|
|
5
|
+
Home-page: https://github.com/dtPaTh/Dqlmagic
|
|
6
|
+
Author: Patrick Thurner
|
|
7
|
+
Author-email: patrick.thurner@dynatrace.com
|
|
8
|
+
License: Apache 2.0
|
|
9
|
+
Keywords: Notebook,Jupyter,DQL,Dynatrace Query Language
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Dqlmagic
|
|
15
|
+
|
|
16
|
+
An IPython magic function allowing to use DQL in your notebooks.
|
|
17
|
+
|
|
18
|
+
Dynatrace Query Language (DQL) is a powerful tool to explore your data and discover patterns, identify anomalies and outliers, create statistical modeling, and more based on data stored in Dynatrace Grail storage.
|
|
19
|
+
|
|
20
|
+
Dqlmagic makes DQL queries available to be used in jupyter notebooks.
|
|
21
|
+
|
|
22
|
+
## Available magic functions
|
|
23
|
+
|
|
24
|
+
### dql <dql_query>
|
|
25
|
+
Allows to run a DQL query and returns the response records as json array.
|
|
26
|
+
|
|
27
|
+
Available as inline and cell function.
|
|
28
|
+
|
|
29
|
+
### dql_raw <dql_query>
|
|
30
|
+
Allows to run a DQL query and returns the response in raw json format as provided by the api.
|
|
31
|
+
|
|
32
|
+
Available as inline and cell function.
|
|
33
|
+
|
|
34
|
+
### auth_grail <config_prefix>
|
|
35
|
+
Inline function connecting to the grail cluster.
|
|
36
|
+
|
|
37
|
+
Reads connection parameters from .env file:
|
|
38
|
+
```
|
|
39
|
+
dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
40
|
+
|
|
41
|
+
dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
42
|
+
dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
43
|
+
dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
44
|
+
|
|
45
|
+
dt_tenant="<YOUR-TENANT-ID>"
|
|
46
|
+
grail_apiurl="https://<YOUR-TENANT-ID>.live.dynatrace.com/api/v2/dql/query"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The ```<config_prefix>``` is **optional** to be used if you have multiple configs stored in your .env file like e.g.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
dt_config_prefix="DEV"
|
|
53
|
+
|
|
54
|
+
DEV_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
55
|
+
DEV_dt_oauth_clientid="<YOUR-DEV-CLIENT-ID>"
|
|
56
|
+
DEV_dt_oauth_clientsecret="<YOUR-DEV-CLIENT-SECRET>"
|
|
57
|
+
DEV_dt_oauth_scope="<YOUR-DEV-ACCESS-SCOPE>"
|
|
58
|
+
DEV_dt_tenant="<YOUR-DEV-TENANT-ID>"
|
|
59
|
+
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.dynatracelabs.com/platform/storage/query/v1/"
|
|
60
|
+
|
|
61
|
+
PROD_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
62
|
+
PROD_dt_oauth_clientid="<YOUR-PROD-CLIENT-ID>"
|
|
63
|
+
PROD_dt_oauth_clientsecret="<YOUR-PROD-CLIENT-SECRET>"
|
|
64
|
+
PROD_dt_oauth_scope="<YOUR-PROD-ACCESS-SCOPE>"
|
|
65
|
+
PROD_dt_tenant="<YOUR-PROD-TENANT-ID>"
|
|
66
|
+
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.dynatracelabs.com/platform/storage/query/v1/"
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
With the parameter ```dt_config_prefix```, you set the default config prefix used, if %auth_grail parameter ```<config_prefix>``` is not provided.
|
|
71
|
+
|
|
72
|
+
For more details on how to setup API oauth clients in Dynatrace see [Configure and manage account API OAuth clients
|
|
73
|
+
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth)
|
|
74
|
+
|
|
75
|
+
For more details on .env file see [How to NOT embedded credential in Jupyter notebook](https://yuthakarn.medium.com/how-to-not-show-credential-in-jupyter-notebook-c349f9278466) or [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
readme.md
|
|
3
|
+
setup.cfg
|
|
4
|
+
setup.py
|
|
5
|
+
dqlmagic/__init__.py
|
|
6
|
+
dqlmagic/dqlmagic.py
|
|
7
|
+
dqlmagic.egg-info/PKG-INFO
|
|
8
|
+
dqlmagic.egg-info/SOURCES.txt
|
|
9
|
+
dqlmagic.egg-info/dependency_links.txt
|
|
10
|
+
dqlmagic.egg-info/requires.txt
|
|
11
|
+
dqlmagic.egg-info/top_level.txt
|
|
12
|
+
dqlmagic.egg-info/zip-safe
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dqlmagic
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
dqlmagic-1.0.1/readme.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Dqlmagic
|
|
2
|
+
|
|
3
|
+
An IPython magic function allowing to use DQL in your notebooks.
|
|
4
|
+
|
|
5
|
+
Dynatrace Query Language (DQL) is a powerful tool to explore your data and discover patterns, identify anomalies and outliers, create statistical modeling, and more based on data stored in Dynatrace Grail storage.
|
|
6
|
+
|
|
7
|
+
Dqlmagic makes DQL queries available to be used in jupyter notebooks.
|
|
8
|
+
|
|
9
|
+
## Available magic functions
|
|
10
|
+
|
|
11
|
+
### dql <dql_query>
|
|
12
|
+
Allows to run a DQL query and returns the response records as json array.
|
|
13
|
+
|
|
14
|
+
Available as inline and cell function.
|
|
15
|
+
|
|
16
|
+
### dql_raw <dql_query>
|
|
17
|
+
Allows to run a DQL query and returns the response in raw json format as provided by the api.
|
|
18
|
+
|
|
19
|
+
Available as inline and cell function.
|
|
20
|
+
|
|
21
|
+
### auth_grail <config_prefix>
|
|
22
|
+
Inline function connecting to the grail cluster.
|
|
23
|
+
|
|
24
|
+
Reads connection parameters from .env file:
|
|
25
|
+
```
|
|
26
|
+
dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
27
|
+
|
|
28
|
+
dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
29
|
+
dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
30
|
+
dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
31
|
+
|
|
32
|
+
dt_tenant="<YOUR-TENANT-ID>"
|
|
33
|
+
grail_apiurl="https://<YOUR-TENANT-ID>.live.dynatrace.com/api/v2/dql/query"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The ```<config_prefix>``` is **optional** to be used if you have multiple configs stored in your .env file like e.g.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
dt_config_prefix="DEV"
|
|
40
|
+
|
|
41
|
+
DEV_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
42
|
+
DEV_dt_oauth_clientid="<YOUR-DEV-CLIENT-ID>"
|
|
43
|
+
DEV_dt_oauth_clientsecret="<YOUR-DEV-CLIENT-SECRET>"
|
|
44
|
+
DEV_dt_oauth_scope="<YOUR-DEV-ACCESS-SCOPE>"
|
|
45
|
+
DEV_dt_tenant="<YOUR-DEV-TENANT-ID>"
|
|
46
|
+
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.dynatracelabs.com/platform/storage/query/v1/"
|
|
47
|
+
|
|
48
|
+
PROD_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
49
|
+
PROD_dt_oauth_clientid="<YOUR-PROD-CLIENT-ID>"
|
|
50
|
+
PROD_dt_oauth_clientsecret="<YOUR-PROD-CLIENT-SECRET>"
|
|
51
|
+
PROD_dt_oauth_scope="<YOUR-PROD-ACCESS-SCOPE>"
|
|
52
|
+
PROD_dt_tenant="<YOUR-PROD-TENANT-ID>"
|
|
53
|
+
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.dynatracelabs.com/platform/storage/query/v1/"
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
With the parameter ```dt_config_prefix```, you set the default config prefix used, if %auth_grail parameter ```<config_prefix>``` is not provided.
|
|
58
|
+
|
|
59
|
+
For more details on how to setup API oauth clients in Dynatrace see [Configure and manage account API OAuth clients
|
|
60
|
+
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth)
|
|
61
|
+
|
|
62
|
+
For more details on .env file see [How to NOT embedded credential in Jupyter notebook](https://yuthakarn.medium.com/how-to-not-show-credential-in-jupyter-notebook-c349f9278466) or [python-dotenv](https://pypi.org/project/python-dotenv/)
|
dqlmagic-1.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = dqlmagic
|
|
3
|
+
version = attr: dqlmagic.__version__
|
|
4
|
+
author = Patrick Thurner
|
|
5
|
+
author_email = patrick.thurner@dynatrace.com
|
|
6
|
+
url = https://github.com/dtPaTh/Dqlmagic
|
|
7
|
+
description = IPython magic function for Dynatrace Query Language (DQL)
|
|
8
|
+
long_description = file: readme.md
|
|
9
|
+
long_description_content_type = text/markdown
|
|
10
|
+
keywords = Notebook, Jupyter, DQL, Dynatrace Query Language
|
|
11
|
+
license = Apache 2.0
|
|
12
|
+
classifiers =
|
|
13
|
+
License :: OSI Approved :: Apache Software License
|
|
14
|
+
Programming Language :: Python :: 3
|
|
15
|
+
|
|
16
|
+
[options]
|
|
17
|
+
packages = find:
|
|
18
|
+
zip_safe = True
|
|
19
|
+
install_requires =
|
|
20
|
+
ipython
|
|
21
|
+
jupyter
|
|
22
|
+
python-dotenv
|
|
23
|
+
|
|
24
|
+
[egg_info]
|
|
25
|
+
tag_build =
|
|
26
|
+
tag_date = 0
|
|
27
|
+
|
dqlmagic-1.0.1/setup.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__import__("setuptools").setup()
|