2

Hi I am planning to write a go based aws lambda what all configurations are needed for getting apm transaction. I have set ELASTIC_APM_SERVER_URL and ELASTIC_APM_SERVICE_NAME. I am calling my send apm function after the end of handler function of lambda. Inside the lambda we are creating a context.

ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
    defer cancel()
func SendApmTransactionFcm(Service string, ApmData *FcmApmJob) {
    apmTransaction := apm.DefaultTracer().StartTransaction(Service, "transaction")
    defer apmTransaction.End()
    apmTransaction.Context.SetLabel("clientid", ApmData.ClientID)
    apmTransaction.Context.SetLabel("messageid", ApmData.MessageId)
    apmTransaction.Context.SetLabel("appid", ApmData.AppId)
    apmTransaction.Context.SetLabel("personalized", ApmData.Personalized)
    apmTransaction.Context.SetLabel("processtime", ApmData.ProcessTime)
    apmTransaction.Context.SetLabel("successfcmrequest", ApmData.SuccessFcmBatch)
    apmTransaction.Context.SetLabel("failedfcmrequest", ApmData.FailedFcmBatch)
    CustomLogging("pushNotificaton", fmt.Sprintf("Apm transaction for fcm service %+v with transaction id %+v", ApmData, apmTransaction.TransactionData))
}

using "https://go.elastic.co/apm/v2" package but not described properly how to use with context as of lambda. Also want to check how we can confirm if apm transaction sent successfully or not.

0 Answers0