01 Mar 2024 07:49 PM - last edited on 04 Mar 2024 08:55 AM by MaciejNeumann
Team,
Dynatrace release notes this week for 1.286 came out. They mentioned that "Deletion of legacy Kubernetes container metrics in Dynatrace version 1.292" will happen, which is about 3 months away. How best review our many tenants for this without manually looking? We have too many dashboards/metrics to go through everything manually.
Release notes: https://docs.dynatrace.com/docs/whats-new/release-notes/saas/sprint-286
Infrastructure Observability | Kubernetes
deprecated
In Dynatrace version 1.292, the following metric keys will be deleted, and access to their historical data will no longer be possible. If you are using any of these metrics, please migrate to the What to use instead metrics, which contain the same data and can be used to access the data.
Containers, CPU
builtin:containers.cpu.throttledMilliCores.legacy
|
builtin:containers.cpu.throttledMilliCores |
builtin:containers.cpu.usageMilliCores.legacy
|
builtin:containers.cpu.usageMilliCores |
builtin:containers.cpu.usagePercent.legacy
|
builtin:containers.cpu.usagePercent |
builtin:containers.cpu.throttlingRatio
|
There is no replacement for the throttling ratio, but it can be calculated on the fly from other metrics. |
Memory
builtin:containers.memory.residentSetBytes.legacy
|
builtin:containers.memory.residentSetBytes |
builtin:containers.memory.usagePercent.legacy
|
builtin:containers.memory.usagePercent |
Solved! Go to Solution.
03 Mar 2024 11:55 PM
For the dashboards you can use something like this, i will.
import requests
import time
import os
import json
# ############################################### #
# # # #
# # Set the following variables to your # #
# # environment # #
# # # #
# ############################################### #
# Set the following variables to your environment
tenant = '{tenantId}'
dynatraceTenant = '{0}.live.dynatrace.com'.format(tenant)
dynatraceTokenEncrypt = '{apiToken}'
dynatraceToken = dynatraceTokenEncrypt
# ############################################### #
# # # #
# # Do not modify below this line # #
# # # #
# ############################################### #
epochtime = int(time.time())
namefile = "{0}-dashboards-{1}".format(tenant, epochtime)
rootFolder = os.path.dirname(os.path.abspath(__file__))
outputFile = "{0}\{1}.json".format(rootFolder,namefile)
dashboardWithDeprecateKeys = {}
# ############################################### #
# # Logic # #
# ############################################### #
# get the list of dashboards
url = "https://" + dynatraceTenant + "/api/config/v1/dashboards"
headers = {
'accept': 'application/json; charset=utf-8',
'Authorization': 'Api-Token ' + dynatraceToken,
'Content-Type': 'application/json; charset=utf-8'
}
response = requests.get(url, headers=headers)
response.raise_for_status()
# first item in the list
exitafter = 0
arrayDeprecateKeys = [
"builtin:containers.cpu.throttledMilliCores.legacy",
"builtin:containers.cpu.usageMilliCores.legacy",
"builtin:containers.cpu.usagePercent.legacy",
"builtin:containers.cpu.throttlingRatio",
"builtin:containers.memory.residentSetBytes.legacy",
"builtin:containers.memory.usagePercent.legacy"
]
for dashboard in response.json()["dashboards"]:
if exitafter == 1:
break
url = "https://" + dynatraceTenant + "/api/config/v1/dashboards/" + dashboard["id"]
response = requests.get(url, headers=headers)
response.raise_for_status()
# check if the dashboard has any deprecated keys text
for key in arrayDeprecateKeys:
# print("Checking for deprecated key: " + key)
if key in response.text:
print("Dashboard URL: " + url)
dashboardWithDeprecateKeys[dashboard["id"]] = {
"name": dashboard["name"],
"url": url
}
if "deprecatedKeys" in dashboardWithDeprecateKeys[dashboard["id"]]:
dashboardWithDeprecateKeys[dashboard["id"]]["deprecatedKeys"].append(key)
else:
dashboardWithDeprecateKeys[dashboard["id"]]["deprecatedKeys"] = [key]
else:
print("No deprecated keys found:" + key)
# exitafter = exitafter + 1
with open(outputFile, 'w') as outfile:
json.dump(dashboardWithDeprecateKeys, outfile, indent=4)
print("File saved: " + outputFile)
print("Total dashboards with deprecated keys: " + str(len(dashboardWithDeprecateKeys)))
I know that could be better but for now this will create a Json file with all dashboards and theirs Deprecate Keys
Hope it helps
04 Mar 2024 01:48 PM
thanks for bringing this up - we will integrate this into this tool: https://metricaudit.services.dynatrace.com/
The tool checks all your dashboards, alerts, and SLOs for known (to be) deprecated metrics and allows you to export the information in csv for further analysis.
I'll come back asap here to tell you when it's available.
04 Mar 2024 02:06 PM
Ah thanks. I forgot about this tool and this would be great for this to be in this tool
04 Mar 2024 04:11 PM
Just got confirmed that these metrics are already integrated into the tool 🙂
(Also working on getting it mentioned in the release notes) thx again @Kenny_Gillette
04 Mar 2024 04:13 PM
Perfect. Thanks for response!