Ejemplo n.º 1
0
    // Networking

    override public void noticeNetworkRequest(string URL,
                                              string httpMethod,
                                              Timer timer,
                                              Dictionary <string, object> headers,
                                              int httpStatusCode,
                                              int bytesSent,
                                              int bytesReceived,
                                              byte[] responseData,
                                              Dictionary <string, object> parameters)
    {
        NativeDictionaryWrapper nativeHeaders = new NativeDictionaryWrapper();

        if (headers != null)
        {
            foreach (KeyValuePair <string, object> kvp in headers)
            {
                nativeHeaders.insert(kvp.Key, kvp.Value);
            }
        }
        NativeDictionaryWrapper nativeParameters = new NativeDictionaryWrapper();

        if (parameters != null)
        {
            foreach (KeyValuePair <string, object> kvp in parameters)
            {
                nativeParameters.insert(kvp.Key, kvp.Value);
            }
        }

        int responseDataLength = 0;

        if (responseData != null)
        {
            responseDataLength = responseData.Length;
        }

        NR_noticeNetworkRequest(URL,
                                httpMethod,
                                timer.handle,
                                nativeHeaders.handle,
                                httpStatusCode,
                                bytesSent,
                                bytesReceived,
                                responseData,
                                responseDataLength,
                                nativeParameters.handle);
    }
Ejemplo n.º 2
0
    // Insights Events

    override public bool recordEvent(string name,
                                     Dictionary <string, object> attributes)
    {
        NativeDictionaryWrapper nativeAttributes = new NativeDictionaryWrapper();

        if (attributes != null)
        {
            foreach (KeyValuePair <string, object> kvp in attributes)
            {
                if (!nativeAttributes.insert(kvp.Key, kvp.Value))
                {
                    UnityEngine.Debug.LogError("ERROR: NewRelic recordEvent() failed. event named '" + name + "' failed due to invalid key-value pair in attributes: key='" + kvp.Key + "', value='" + kvp.Value + "'");
                    return(false);
                }
            }
        }
        return(NR_recordEvent(name, nativeAttributes.handle));
    }