Description: Backport some functions and defs from raven 2.0.0 release. There is no real API breakage here.
Simply remove the patch when raven is updated to 2.0.0
Author: Nilesh Patra <npatra974@gmail.com>
Forwarded: not
Last-Update: 2021-01-11
--- a/client.go
+++ b/client.go
@@ -76,6 +76,8 @@
 	Send(url, authHeader string, packet *Packet) error
 }
 
+type Extra map[string]interface{}
+
 type outgoingPacket struct {
 	packet *Packet
 	ch     chan error
@@ -168,6 +170,28 @@
 	}
 }
 
+// NewPacketWithExtra constructs a packet with the specified message, extra information, and interfaces.
+func NewPacketWithExtra(message string, extra Extra, interfaces ...Interface) *Packet {
+	if extra == nil {
+		extra = Extra{}
+	}
+	setExtraDefaults(extra)
+
+	return &Packet{
+		Message:    message,
+		Interfaces: interfaces,
+		Extra:      extra,
+	}
+}
+
+func setExtraDefaults(extra Extra) Extra {
+	extra["runtime.Version"] = runtime.Version()
+	extra["runtime.NumCPU"] = runtime.NumCPU()
+	extra["runtime.GOMAXPROCS"] = runtime.GOMAXPROCS(0) // 0 just returns the current value
+	extra["runtime.NumGoroutine"] = runtime.NumGoroutine()
+	return extra
+}
+
 // Init initializes required fields in a packet. It is typically called by
 // Client.Send/Report automatically.
 func (packet *Packet) Init(project string) error {
