Created
February 22, 2023 06:18
-
-
Save ashutosh887/0c37508d7b81419f5d3456cff6d58001 to your computer and use it in GitHub Desktop.
Adding APM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (hs *HTTPServer) addAPMPanelToHomeDashboard(c *models.ReqContext, dash *simplejson.Json) { | |
// check org if dashboard exists -> apm | |
// 1. if not exist in org - return | |
dashboardExistInOrg := true | |
if !dashboardExistInOrg { | |
return | |
} | |
// generate dashbaord | |
// create json and append to home json | |
// we can get this from UID -> getDashBoardByUID | |
// "datasource": { | |
// "type": "loki", | |
// "uid": "cPmWX-o4z" | |
panels := dash.Get("panels").MustArray() | |
newpanel := simplejson.NewFromAny(map[string]interface{}{ | |
"type": "dashlist", | |
"id": 123123, | |
"gridPos": map[string]interface{}{ | |
"x": 14, | |
"y": 2, | |
"w": 10, | |
"h": 14, | |
}, | |
}) | |
panels = append(panels, newpanel) | |
dash.Set("panels", panels) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment