cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setup up AppDynamics agent on Go lang application

Abhishek.Tiwari
New Member

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.

6 REPLIES 6

Kyle.Furlong
AppDynamics Team (Retired)

Hi Abhishek,

 

Are both the Go SDK and machine agent for the server independently reporting?

 

Thanks,
Kyle Furlong, Technical Lead (C++ and Dynamic Languages)




Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

@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?

Kyle.Furlong
AppDynamics Team (Retired)

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)




Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

How GoLang SDK knows controller details to report.

 

Thanks,

Kumar

 

Kyle.Furlong
AppDynamics Team (Retired)

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)




Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

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



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Learn more about me in the Community Member Spotlight Q & A