func Init(license string, appName string, lang string, langVersion string) error {
	C.newrelic_register_message_handler((*[0]byte)(C.newrelic_message_handler))
	clicense := C.CString(license)
	defer C.free(unsafe.Pointer(clicense))
	cappName := C.CString(appName)
	defer C.free(unsafe.Pointer(cappName))
	clang := C.CString(lang)
	defer C.free(unsafe.Pointer(clang))
	clangVersion := C.CString(langVersion)
	defer C.free(unsafe.Pointer(clangVersion))
	rv := C.newrelic_init(clicense, cappName, clang, clangVersion)
	return nrError(rv, "initialize")
}
func Init(license string, appName string) int {
	cLicense := C.CString(license)
	defer C.free(unsafe.Pointer(cLicense))

	cAppName := C.CString(appName)
	defer C.free(unsafe.Pointer(cAppName))

	cLanguage := C.CString(LANGUAGE)
	defer C.free(unsafe.Pointer(cLanguage))

	cLanguageVersion := C.CString(runtime.Version())
	defer C.free(unsafe.Pointer(cLanguageVersion))

	result := C.newrelic_init(cLicense, cAppName, cLanguage, cLanguageVersion)
	return int(result)
}
示例#3
0
文件: sdk.go 项目: frewsxcv/empire
/**
 * Start the CollectorClient and the harvester thread that sends application
 * performance data to New Relic once a minute.
 *
 * @param license  New Relic account license key
 * @param app_name  name of instrumented application
 * @param language  name of application programming language
 * @param language_version  application programming language version
 * @return  segment id on success, error code on error, else warning code
 */
func doInit(license string, appName string, language string, languageVersion string) (int, error) {
	clicense := C.CString(license)
	defer C.free(unsafe.Pointer(clicense))

	cappName := C.CString(appName)
	defer C.free(unsafe.Pointer(cappName))

	clang := C.CString("Go")
	defer C.free(unsafe.Pointer(clang))

	clangVersion := C.CString(runtime.Version())
	defer C.free(unsafe.Pointer(clangVersion))

	errno := C.newrelic_init(clicense, cappName, clang, clangVersion)
	return errNo(errno)
}