static DWORD VmDnsForwarderMetricsInit( PVMDNS_FORWARDER_ENTRY pForwarderEntry ) { DWORD dwError = 0; UINT64 buckets[] = {1, 10, 100, 300, 1000}; VM_METRICS_LABEL labelDurationOps[2][2] = {{{"operation","query"},{"forwarder",""}}, {{"operation","update"},{"forwarder",""}}}; labelDurationOps[0][1].pszValue = pForwarderEntry->pszForwarder; labelDurationOps[1][1].pszValue = pForwarderEntry->pszForwarder; BAIL_ON_VMDNS_ERROR(dwError); dwError = VmMetricsHistogramNew( gVmDnsMetricsContext, "vmdns_forwarder_request_duration", labelDurationOps[0], 2, "Forwarder Process Request Duration", buckets, 5, &pForwarderEntry->ForwarderMetricsContext.pQueryDuration ); BAIL_ON_VMDNS_ERROR(dwError); dwError = VmMetricsHistogramNew( gVmDnsMetricsContext, "vmdns_forwarder_request_duration", labelDurationOps[1], 2, "Forwarder Process Request Duration", buckets, 5, &pForwarderEntry->ForwarderMetricsContext.pUpdateDuration ); BAIL_ON_VMDNS_ERROR(dwError); cleanup: return dwError; error: VmDnsLog(VMDNS_LOG_LEVEL_ERROR, "%s failed, error (%d)", __FUNCTION__, dwError); goto cleanup; }
static DWORD _VmDirRpcMetricsInit( VOID) { DWORD dwError = 0; DWORD i = 0; uint64_t buckets[5] = {1, 10, 100, 500, 1000}; VM_METRICS_LABEL labelOps[METRICS_RPC_OP_COUNT][1] = { {{"operation", "GeneratePassword"}}, {{"operation", "GetKeyTabRecBlob"}}, {{"operation", "CreateUser"}}, {{"operation", "CreateUserEx"}}, {{"operation", "SetLogLevel"}}, {{"operation", "SetLogMask"}}, {{"operation", "SuperLogQueryServerData"}}, {{"operation", "SuperLogEnable"}}, {{"operation", "SuperLogDisable"}}, {{"operation", "IsSuperLogEnabled"}}, {{"operation", "SuperLogFlush"}}, {{"operation", "SuperLogSetSize"}}, {{"operation", "SuperLogGetSize"}}, {{"operation", "SuperLogGetEntriesLdapOperation"}}, {{"operation", "OpenDatabaseFile"}}, {{"operation", "ReadDatabaseFile"}}, {{"operation", "CloseDatabaseFile"}}, {{"operation", "SetBackendState"}}, {{"operation", "GetState"}}, {{"operation", "GetLogLevel"}}, {{"operation", "GetLogMask"}} }; for (i=0; i < METRICS_RPC_OP_COUNT; i++) { dwError = VmMetricsHistogramNew(pmContext, "vmdir_dcerpc_request_duration", labelOps[i], 1, "Histogram for DCERPC Request Durations for different operations", buckets, 5, &pRpcRequestDuration[i]); BAIL_ON_VMDIR_ERROR(dwError); } cleanup: return dwError; error: VMDIR_LOG_ERROR(VMDIR_LOG_MASK_ALL, "%s (%d)", __FUNCTION__, dwError); goto cleanup; }
DWORD VmDirLdapMetricsInit( VOID ) { DWORD dwError = 0; DWORD i = 0; uint64_t buckets[5] = {1, 10, 100, 500, 1000}; VM_METRICS_LABEL labelOps[METRICS_LDAP_OP_COUNT][1] = {{{"operation","bind"}}, {{"operation","search"}}, {{"operation","add"}}, {{"operation","modify"}}, {{"operation","delete"}}, {{"operation","unbind"}}}; VM_METRICS_LABEL labelErrors[METRICS_LDAP_ERROR_COUNT][1] = {{{"code","LDAP_SUCCESS"}}, {{"code","LDAP_UNAVAILABLE"}}, {{"code","LDAP_SERVER_DOWN"}}, {{"code","LDAP_UNWILLING_TO_PERFORM"}}, {{"code","LDAP_INVALID_DN_SYNTAX"}}, {{"code","LDAP_NO_SUCH_ATTRIBUTE"}}, {{"code","LDAP_INVALID_SYNTAX"}}, {{"code","LDAP_UNDEFINED_TYPE"}}, {{"code","LDAP_TYPE_OR_VALUE_EXISTS"}}, {{"code","LDAP_OBJECT_CLASS_VIOLATION"}}, {{"code","LDAP_ALREADY_EXISTS"}}, {{"code","LDAP_CONSTRAINT_VIOLATION"}}, {{"code","LDAP_NOT_ALLOWED_ON_NONLEAF"}}, {{"code","LDAP_PROTOCOL_ERROR"}}, {{"code","LDAP_INVALID_CREDENTIALS"}}, {{"code","LDAP_INSUFFICIENT_ACCESS"}}, {{"code","LDAP_AUTH_METHOD_NOT_SUPPORTED"}}, {{"code","LDAP_SASL_BIND_IN_PROGRESS"}}, {{"code","LDAP_TIMELIMIT_EXCEEDED"}}, {{"code","LDAP_SIZELIMIT_EXCEEDED"}}, {{"code","LDAP_NO_SUCH_OBJECT"}}, {{"code","LDAP_BUSY"}}, {{"code","LDAP_OTHER"}}}; for (i=0; i < METRICS_LDAP_ERROR_COUNT; i++) { dwError = VmMetricsCounterNew(pmContext, "vmdir_ldap_error_count", labelErrors[i], 1, "Counter for various LDAP errors", &pLdapErrorCount[i]); BAIL_ON_VMDIR_ERROR(dwError); } for (i=0; i < METRICS_LDAP_OP_COUNT; i++) { dwError = VmMetricsHistogramNew(pmContext, "vmdir_ldap_request_duration", labelOps[i], 1, "Histogram for LDAP Request Durations for different operations", buckets, 5, &pLdapRequestDuration[i]); BAIL_ON_VMDIR_ERROR(dwError); } cleanup: return dwError; error: VMDIR_LOG_ERROR(VMDIR_LOG_MASK_ALL, "VmDirLdapMetricsInit failed (%d)", dwError); goto cleanup; }