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

golang sdk

Hi,

I am new to the community and I am having a few problems to use appdynamics with golang. I followed the tutorial and succefully connected my GO application with the SDK, but I still have a few questions. First of all, do I need to manually insert a business transaction to every external call i wish to observe? For example:

func (c userRepository) getAll()  {
appd.AddBackend("backTest", "DB", map[string]string{"DATABASE": "mongodb",}, false)
btHandle := appd.StartBT("database 1", "")
ecHandle := appd.StartExitcall(btHandle, "backTest")

// calling database

if err != nil {
appd.AddBTError(btHandle, appd.ErrorLevel(2), "error message", true)
} appd.EndExitcall(ecHandle)
appd.EndBT(btHandle)

return ...
}

func (c userRepository) getById() {
appd.AddBackend("backTest", "DB", map[string]string{"DATABASE": "mongodb",}, false)
btHandle := appd.StartBT("database 1", "")
ecHandle := appd.StartExitcall(btHandle, "backTest")

// calling database again
if err != nil {
appd.AddBTError(btHandle, appd.ErrorLevel(2), "another error message", true)
} appd.EndExitcall(ecHandle)
appd.EndBT(btHandle)

return ...
}

 And should I do it manually for every external call that i make? (external API, Database, ....) I find it too time consuming  it and makes the code longer and more difficult to read. Can anyone tell me if I am using the SDK properly or if there is something that i am missing and could make it simpler?

3 REPLIES 3

Ryan.Paredez
Community Manager

Hi @Tatiane.Nicchetti,

Can you share the link to the tutorial you followed? 


Thanks,

Ryan, Cisco AppDynamics Community Manager




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

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.

Hi,

I followed this tutorial to initialize the Agent and the Controller Configuration (https://docs.appdynamics.com/appd/4.5.x/en/application-monitoring/install-app-server-agents/go-langu...).

I have a question about configuring the BTs and Backends. Our company's other applications are already in the appdynamics environment (all in Node or Java) and we need to add this Golang api to monitor all of them together in the dashboard. If I initialize the agent and controllers, will we see all of them working together? Or do we need to set up all calls to backends like i did in the example even if those backends that are already being monitored in the dashboard?

Joe.Catera
AppDynamics Team

Hi Tatiane,

I took a look at the latest docs https://docs.appdynamics.com/appd/23.x/latest/en/application-monitoring/install-app-server-agents/go... and didn't see any different between it and the 4.5.x version, so I'm going to follow up with the writer of the doc to contact the Go SDK engineers to take a look at your example and help answer your questions. Thanks for your post and hope to get you some answers soon.