Advertisement
Guest User

Untitled

a guest
Apr 7th, 2017
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. ROUTINE ======================== github.com/stackimpact/stackimpact-go/internal.(*APIRequest).post in /home/go/.gvm/pkgsets/go1.7/global/src/git
  2. hub.com/stackimpact/stackimpact-go/internal/api_request.go
  3. 512.14kB 478.35MB (flat, cum) 13.72% of Total
  4. . . 24: return ar
  5. . . 25:}
  6. . . 26:
  7. . . 27:func (ar *APIRequest) post(endpoint string, payload map[string]interface{}) (map[string]interface{}, error) {
  8. . . 28: reqBody := map[string]interface{}{
  9. 512.14kB 512.14kB 29: "runtime_type": "go",
  10. . . 30: "runtime_version": runtime.Version(),
  11. . . 31: "agent_version": AgentVersion,
  12. . . 32: "app_name": ar.agent.AppName,
  13. . . 33: "app_version": ar.agent.AppVersion,
  14. . . 34: "app_environment": ar.agent.AppEnvironment,
  15. . . 35: "host_name": ar.agent.HostName,
  16. . . 36: "build_id": ar.agent.buildId,
  17. . . 37: "run_id": ar.agent.runId,
  18. . . 38: "run_ts": ar.agent.runTs,
  19. . . 39: "sent_at": time.Now().Unix(),
  20. . 8.02MB 40: "payload": payload,
  21. . . 41: }
  22. . . 42:
  23. . . 43: reqBodyJson, _ := json.Marshal(reqBody)
  24. . . 44:
  25. . 469.83MB 45: var buf bytes.Buffer
  26. . . 46: w := gzip.NewWriter(&buf)
  27. . . 47: w.Write(reqBodyJson)
  28. . . 48: w.Close()
  29. . . 49:
  30. . . 50: url := ar.agent.DashboardAddress + "/agent/v1/" + endpoint
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement