Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
07-30-2020 03:21 AM - last edited on 08-05-2020 01:38 PM by Ryan.Paredez
I am having golang application and want to connect to AppDynamics. But when I am creating an application I am not able to find any machine agent for go lang application. Although they are providing go SDK. But I am not able to send data with the help of that.
07-30-2020 09:54 AM - last edited on 08-05-2020 01:37 PM by Ryan.Paredez
Hi Abhishek,
Are both the Go SDK and machine agent for the server independently reporting?
Thanks,
Kyle Furlong, Technical Lead (C++ and Dynamic Languages)
09-07-2020 05:49 AM
@Kyle.Furlong
> Are both the Go SDK and machine agent for the server independently reporting?
I've downloaded the Golang SDK and done basic setup. It can report to the controller (although i dont see the same details that my nodejs or java service has). Is it required to also install a machine agent?
09-08-2020 11:59 AM
Hi T.c,
No, it is not required to install the machine agent. It is only recommended if you would like to have infrastructure metrics for the instance.
As you noted, the Go SDK does not provide the same level of instrumentation as our full-fledged agents. You will need to integrate the SDK functions into your code to surface the data which you are interested in.
We are in the process of R&D on a solution for Go which is more like our Java agent, but I can provide no timeline or further details in the present moment.
Thanks,
Kyle Furlong, Technical Lead (C++ and Dynamic Languages)
09-09-2020 10:23 AM
How GoLang SDK knows controller details to report.
Thanks,
Kumar
09-09-2020 02:37 PM
Hi Suman,
Please check the docs and go through the install steps: https://docs.appdynamics.com/display/PRO45/Using+Go+SDK
Regards,
Kyle
Thanks,
Kyle Furlong, Technical Lead (C++ and Dynamic Languages)
09-12-2020 02:20 PM
Hi There
As mentioned with Golang it's a Dynamics Agent, where you have to use the AppDynamics SDK to implement the instrumentation into your Golang Application
Please find belowa sample Golang Application that has a single BT & just does a remote http service call.
This is just to have an example of how it would be instrumented
==================================================================================
package main
import (
appd "appdynamics"
"net/http"
"log"
"io/ioutil"
"fmt"
"os"
"time"
)
func main() {
fmt.Printf("About to run golang test process...\n")
cfg := appd.Config{}
cfg.AppName = "Go_App"
cfg.TierName = "GoTier"
cfg.NodeName = "gonode1"
cfg.Controller.Host = "controller.saas.appdynamics.com"
cfg.Controller.Port = 443
cfg.Controller.UseSSL = true
cfg.Controller.Account = "customer1"
cfg.Controller.AccessKey = "xxxxxxxxx"
cfg.InitTimeoutMs = 30000
fmt.Printf("about to call InitSDK(InitTimeoutMS = %d)...", cfg.InitTimeoutMs)
if err := appd.InitSDK(&cfg); err != nil {
fmt.Printf("Error initializing the AppDynamics SDK\n")
os.Exit(1)
} else {
fmt.Printf("Initialized AppDynamics SDK successfully\n")
}
backendName := "HTTPBE"
backendType := "HTTP"
backendProperties := map[string]string {
"URL": "https://httpbin.org/get",
}
resolveBackend := false
appd.AddBackend(backendName, backendType, backendProperties, resolveBackend)
for loop := 0; loop < 3000; loop++ {
btHandle := appd.StartBT("GoTestBT1", "")
ecHandle := appd.StartExitcall(btHandle, backendName)
hdr := appd.GetExitcallCorrelationHeader(ecHandle)
resp, err := http.Get("https://httpbin.org/get")
fmt.Printf(hdr)
if err != nil {
log.Fatalln(err)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
log.Println(string(body))
}
appd.EndExitcall(ecHandle)
appd.EndBT(btHandle)
fmt.Printf("Loop %d: Got BT handle %x\n", loop, btHandle)
time.Sleep(1 * time.Second)
if loop%10 == 0 {
fmt.Printf("Setting error for loop #%d\n", loop)
appd.AddBTError(btHandle,appd.APPD_LEVEL_ERROR,"Error message test string",true)
}
appd.EndBT(btHandle)
}
fmt.Println("calling term()...")
appd.TerminateSDK()
fmt.Println("done")
}
===================================================================================
Ciao
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form