void TSPluginInit(int argc, const char *argv[]) { TSCont contp; TSPluginRegistrationInfo info; info.plugin_name = "session-1"; info.vendor_name = "MyCompany"; info.support_email = "*****@*****.**"; if (TSPluginRegister(&info) != TS_SUCCESS) { TSError("[session-1] Plugin registration failed.\n"); goto error; } transaction_count = INKStatCreate("transaction.count", INKSTAT_TYPE_INT64); session_count = INKStatCreate("session.count", INKSTAT_TYPE_INT64); av_transaction = INKStatCreate("avg.transactions", INKSTAT_TYPE_FLOAT); contp = TSContCreate(ssn_handler, NULL); TSHttpHookAdd(TS_HTTP_SSN_START_HOOK, contp); error: TSError("[session-1] Plugin not initialized"); }
void init_stats(void) { /* noncoupled: */ method_count_redirected_connect = INKStatCreate("method.count.redirected.connect", INKSTAT_TYPE_INT64); method_count_redirected_delete = INKStatCreate("method.count.redirected.delete", INKSTAT_TYPE_INT64); method_count_redirected_get = INKStatCreate("method.count.redirected.get", INKSTAT_TYPE_INT64); method_count_redirected_head = INKStatCreate("method.count.redirected.head", INKSTAT_TYPE_FLOAT); method_count_redirected_icp_query = INKStatCreate("method.count.redirected.icp_query", INKSTAT_TYPE_FLOAT); method_count_redirected_options = INKStatCreate("method.count.redirected.options", INKSTAT_TYPE_INT64); method_count_redirected_post = INKStatCreate("method.count.redirected.post", INKSTAT_TYPE_INT64); method_count_redirected_purge = INKStatCreate("method.count.redirected.purge", INKSTAT_TYPE_INT64); method_count_redirected_put = INKStatCreate("method.count.redirected.put", INKSTAT_TYPE_INT64); method_count_redirected_trace = INKStatCreate("method.count.redirected.trace", INKSTAT_TYPE_INT64); method_count_redirected_unknown = INKStatCreate("method.count.redirected.unknown", INKSTAT_TYPE_INT64); /* coupled: */ request_outcomes = INKStatCoupledGlobalCategoryCreate("request_outcomes"); requests_all = INKStatCoupledGlobalAdd(request_outcomes, "requests.all", INKSTAT_TYPE_FLOAT); requests_redirects = INKStatCoupledGlobalAdd(request_outcomes, "requests.redirects", INKSTAT_TYPE_INT64); requests_unchanged = INKStatCoupledGlobalAdd(request_outcomes, "requests.unchanged", INKSTAT_TYPE_INT64); }