Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var APIServerQueries = []prometheus.Query{
{
MetricName: "apiserver_request_total",
},
{
MetricName: "rest_client_requests_total",
},
{
MetricName: "etcd_object_counts",
},
{
MetricName: "apiserver_storage_objects",
},
{
MetricName: "apiserver_current_inflight_requests",
},
{
MetricName: "process_resident_memory_bytes",
},
{
MetricName: "process_cpu_seconds_total",
},
{
MetricName: "go_threads",
},
{
MetricName: "go_goroutines",
},
}
APIServerQueries are the queries we will do to the control plane API Server in order to fetch all the raw metrics.
var APIServerSpecs = definition.SpecGroups{ "api-server": { IDGenerator: prometheus.FromRawEntityIDGenerator, TypeGenerator: prometheus.ControlPlaneComponentTypeGenerator, Specs: []definition.Spec{ { Name: "apiserverRequestsDelta", ValueFunc: prometheus.FromValueWithOverriddenName( "apiserver_request_total", "apiserverRequestsDelta", prometheus.IncludeOnlyLabelsFilter("verb", "code"), ), Type: sdkMetric.DELTA, }, { Name: "apiserverRequestsRate", ValueFunc: prometheus.FromValueWithOverriddenName( "apiserver_request_total", "apiserverRequestsRate", prometheus.IncludeOnlyLabelsFilter("verb", "code"), ), Type: sdkMetric.RATE, }, { Name: "apiserverCurrentInflightRequestsMutating", ValueFunc: prometheus.FromValueWithLabelsFilter( "apiserver_current_inflight_requests", "apiserverCurrentInflightRequestsMutating", prometheus.IncludeOnlyWhenLabelMatchFilter(map[string]string{ "request_kind": "mutating", }), ), Type: sdkMetric.GAUGE, }, { Name: "apiserverCurrentInflightRequestsReadOnly", ValueFunc: prometheus.FromValueWithLabelsFilter( "apiserver_current_inflight_requests", "apiserverCurrentInflightRequestsReadOnly", prometheus.IncludeOnlyWhenLabelMatchFilter(map[string]string{ "request_kind": "readOnly", }), ), Type: sdkMetric.GAUGE, }, { Name: "restClientRequestsDelta", ValueFunc: prometheus.FromValueWithOverriddenName( "rest_client_requests_total", "restClientRequestsDelta", prometheus.IncludeOnlyLabelsFilter("method", "code"), ), Type: sdkMetric.DELTA, }, { Name: "restClientRequestsRate", ValueFunc: prometheus.FromValueWithOverriddenName( "rest_client_requests_total", "restClientRequestsRate", prometheus.IncludeOnlyLabelsFilter("method", "code"), ), Type: sdkMetric.RATE, }, { Name: "etcdObjectCounts", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_object_counts", "etcdObjectCounts"), Type: sdkMetric.GAUGE, Optional: true, }, { Name: "apiserverStorageObjects", ValueFunc: fetchIfMissing( prometheus.FromValueWithOverriddenName("apiserver_storage_objects", "apiserverStorageObjects"), prometheus.FromValueWithOverriddenName("etcd_object_counts", "etcdObjectCounts"), ), Type: sdkMetric.GAUGE, }, { Name: "processResidentMemoryBytes", ValueFunc: prometheus.FromValueWithOverriddenName("process_resident_memory_bytes", "processResidentMemoryBytes"), Type: sdkMetric.GAUGE, }, { Name: "processCpuSecondsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("process_cpu_seconds_total", "processCpuSecondsDelta"), Type: sdkMetric.DELTA, }, { Name: "goThreads", ValueFunc: prometheus.FromValueWithOverriddenName("go_threads", "goThreads"), Type: sdkMetric.GAUGE, }, { Name: "goGoroutines", ValueFunc: prometheus.FromValueWithOverriddenName("go_goroutines", "goGoroutines"), Type: sdkMetric.GAUGE, }, }, }, }
APIServerSpecs are the metric specifications we want to collect from the control plane API server.
var CadvisorQueries = []prometheus.Query{ { MetricName: "container_memory_usage_bytes", Labels: prometheus.QueryLabels{ Operator: prometheus.QueryOpNor, Labels: prometheus.Labels{ "container_name": "", }, }, }, {MetricName: "container_cpu_cfs_periods_total"}, {MetricName: "container_cpu_cfs_throttled_periods_total"}, {MetricName: "container_cpu_cfs_throttled_seconds_total"}, {MetricName: "container_memory_mapped_file"}, {MetricName: "container_oom_events_total"}, }
CadvisorQueries are the queries we will do to the kubelet metrics cadvisor endpoint in order to fetch all the raw metrics.
var ControllerManagerQueries = []prometheus.Query{
{
MetricName: "workqueue_adds_total",
},
{
MetricName: "workqueue_depth",
},
{
MetricName: "workqueue_retries_total",
},
{
MetricName: "leader_election_master_status",
},
{
MetricName: "process_resident_memory_bytes",
},
{
MetricName: "process_cpu_seconds_total",
},
{
MetricName: "go_threads",
},
{
MetricName: "go_goroutines",
},
{
MetricName: "node_collector_evictions_total",
},
}
ControllerManagerQueries are the queries we will do to the control plane controller manager in order to fetch all the raw metrics.
var ControllerManagerSpecs = definition.SpecGroups{ "controller-manager": { IDGenerator: prometheus.FromRawEntityIDGenerator, TypeGenerator: prometheus.ControlPlaneComponentTypeGenerator, Specs: []definition.Spec{ { Name: "workqueueAddsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("workqueue_adds_total", "workqueueAddsDelta"), Type: sdkMetric.DELTA, Optional: true, }, { Name: "workqueueDepth", ValueFunc: prometheus.FromValueWithOverriddenName("workqueue_depth", "workqueueDepth"), Type: sdkMetric.GAUGE, Optional: true, }, { Name: "workqueueRetriesDelta", ValueFunc: prometheus.FromValueWithOverriddenName("workqueue_retries_total", "workqueueRetriesDelta"), Type: sdkMetric.DELTA, Optional: true, }, { Name: "leaderElectionMasterStatus", ValueFunc: prometheus.FromValueWithOverriddenName( "leader_election_master_status", "leaderElectionMasterStatus", prometheus.IgnoreLabelsFilter("name"), ), Type: sdkMetric.GAUGE, }, { Name: "processResidentMemoryBytes", ValueFunc: prometheus.FromValueWithOverriddenName("process_resident_memory_bytes", "processResidentMemoryBytes"), Type: sdkMetric.GAUGE, }, { Name: "processCpuSecondsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("process_cpu_seconds_total", "processCpuSecondsDelta"), Type: sdkMetric.DELTA, }, { Name: "goThreads", ValueFunc: prometheus.FromValueWithOverriddenName("go_threads", "goThreads"), Type: sdkMetric.GAUGE, }, { Name: "goGoroutines", ValueFunc: prometheus.FromValueWithOverriddenName("go_goroutines", "goGoroutines"), Type: sdkMetric.GAUGE, }, { Name: "nodeCollectorEvictionsDelta", ValueFunc: prometheus.FromValueWithOverriddenName( "node_collector_evictions_total", "nodeCollectorEvictionsDelta", prometheus.IgnoreLabelsFilter("zone"), ), Type: sdkMetric.PDELTA, }, }, }, }
ControllerManagerSpecs are the metric specifications we want to collect from the control plane controller manager.
var EtcdQueries = []prometheus.Query{
{
MetricName: "etcd_server_has_leader",
},
{
MetricName: "etcd_server_leader_changes_seen_total",
},
{
MetricName: "etcd_mvcc_db_total_size_in_bytes",
},
{
MetricName: "etcd_server_proposals_committed_total",
},
{
MetricName: "etcd_server_proposals_applied_total",
},
{
MetricName: "etcd_server_proposals_pending",
},
{
MetricName: "etcd_server_proposals_failed_total",
},
{
MetricName: "process_open_fds",
},
{
MetricName: "process_max_fds",
},
{
MetricName: "etcd_network_client_grpc_received_bytes_total",
},
{
MetricName: "etcd_network_client_grpc_sent_bytes_total",
},
{
MetricName: "process_resident_memory_bytes",
},
{
MetricName: "process_cpu_seconds_total",
},
{
MetricName: "go_threads",
},
{
MetricName: "go_goroutines",
},
}
EtcdQueries are the queries we will do to the control plane etcd instances in order to fetch all the raw metrics.
var EtcdSpecs = definition.SpecGroups{ "etcd": { IDGenerator: prometheus.FromRawEntityIDGenerator, TypeGenerator: prometheus.ControlPlaneComponentTypeGenerator, Specs: []definition.Spec{ { Name: "etcdServerHasLeader", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_has_leader", "etcdServerHasLeader"), Type: sdkMetric.GAUGE, }, { Name: "etcdServerLeaderChangesSeenDelta", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_leader_changes_seen_total", "etcdServerLeaderChangesSeenDelta"), Type: sdkMetric.DELTA, }, { Name: "etcdMvccDbTotalSizeInBytes", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_mvcc_db_total_size_in_bytes", "etcdMvccDbTotalSizeInBytes"), Type: sdkMetric.GAUGE, }, { Name: "etcdServerProposalsCommittedRate", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_committed_total", "etcdServerProposalsCommittedRate"), Type: sdkMetric.RATE, }, { Name: "etcdServerProposalsCommittedDelta", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_committed_total", "etcdServerProposalsCommittedDelta"), Type: sdkMetric.DELTA, }, { Name: "etcdServerProposalsAppliedRate", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_applied_total", "etcdServerProposalsAppliedRate"), Type: sdkMetric.RATE, }, { Name: "etcdServerProposalsAppliedDelta", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_applied_total", "etcdServerProposalsAppliedDelta"), Type: sdkMetric.DELTA, }, { Name: "etcdServerProposalsPending", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_pending", "etcdServerProposalsPending"), Type: sdkMetric.GAUGE, }, { Name: "etcdServerProposalsFailedRate", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_failed_total", "etcdServerProposalsFailedRate"), Type: sdkMetric.RATE, }, { Name: "etcdServerProposalsFailedDelta", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_server_proposals_failed_total", "etcdServerProposalsFailedDelta"), Type: sdkMetric.DELTA, }, { Name: "processOpenFds", ValueFunc: processOpenFds, Type: sdkMetric.GAUGE, }, { Name: "processMaxFds", ValueFunc: processMaxFds, Type: sdkMetric.GAUGE, }, { Name: "etcdNetworkClientGrpcReceivedBytesRate", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_network_client_grpc_received_bytes_total", "etcdNetworkClientGrpcReceivedBytesRate"), Type: sdkMetric.RATE, }, { Name: "etcdNetworkClientGrpcSentBytesRate", ValueFunc: prometheus.FromValueWithOverriddenName("etcd_network_client_grpc_sent_bytes_total", "etcdNetworkClientGrpcSentBytesRate"), Type: sdkMetric.RATE, }, { Name: "processResidentMemoryBytes", ValueFunc: prometheus.FromValueWithOverriddenName("process_resident_memory_bytes", "processResidentMemoryBytes"), Type: sdkMetric.GAUGE, }, { Name: "processCpuSecondsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("process_cpu_seconds_total", "processCpuSecondsDelta"), Type: sdkMetric.DELTA, }, { Name: "goThreads", ValueFunc: prometheus.FromValueWithOverriddenName("go_threads", "goThreads"), Type: sdkMetric.GAUGE, }, { Name: "goGoroutines", ValueFunc: prometheus.FromValueWithOverriddenName("go_goroutines", "goGoroutines"), Type: sdkMetric.GAUGE, }, { Name: "processFdsUtilization", ValueFunc: toUtilization(processOpenFds, processMaxFds), Type: sdkMetric.GAUGE, }, }, }, }
EtcdSpecs are the metric specifications we want to collect from ETCD.
var KSMQueries = []prometheus.Query{}/* 116 elements not displayed */
KSMQueries are the queries we will do to KSM in order to fetch all the raw metrics.
var KSMSpecs = definition.SpecGroups{ "persistentvolume": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_persistentvolume_info", "persistentvolume"), TypeGenerator: prometheus.FromLabelValueEntityTypeGeneratorWithCustomGroup("kube_persistentvolume_info", "PersistentVolume"), NamespaceGetter: prometheus.FromLabelGetNamespace, MsTypeGuesser: metricSetTypeGuesserWithCustomGroup("PersistentVolume"), Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_persistentvolume_created"), Type: sdkMetric.GAUGE}, {Name: "capacityBytes", ValueFunc: prometheus.FromValue("kube_persistentvolume_capacity_bytes"), Type: sdkMetric.GAUGE}, {Name: "statusPhase", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_status_phase", "phase"), Type: sdkMetric.ATTRIBUTE}, {Name: "volumeName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "persistentvolume"), Type: sdkMetric.ATTRIBUTE}, {Name: "pvcName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_claim_ref", "name"), Type: sdkMetric.ATTRIBUTE}, {Name: "pvcNamespace", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_claim_ref", "claim_namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("persistentvolume", "kube_persistentvolume_labels"), Type: sdkMetric.ATTRIBUTE}, {Name: "storageClass", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "storageclass"), Type: sdkMetric.ATTRIBUTE}, {Name: "hostPath", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "host_path"), Type: sdkMetric.ATTRIBUTE}, {Name: "hostPathType", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "host_path_type"), Type: sdkMetric.ATTRIBUTE}, {Name: "localFs", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "local_fs"), Type: sdkMetric.ATTRIBUTE}, {Name: "localPath", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "local_path"), Type: sdkMetric.ATTRIBUTE}, {Name: "csiVolumeHandle", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "csi_volume_handle"), Type: sdkMetric.ATTRIBUTE}, {Name: "csiDriver", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "csi_driver"), Type: sdkMetric.ATTRIBUTE}, {Name: "nfsPath", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "nfs_path"), Type: sdkMetric.ATTRIBUTE}, {Name: "nfsServer", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "nfs_server"), Type: sdkMetric.ATTRIBUTE}, {Name: "iscsiInitiatorName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "iscsi_initiator_name"), Type: sdkMetric.ATTRIBUTE}, {Name: "iscsiLun", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "iscsi_lun"), Type: sdkMetric.ATTRIBUTE}, {Name: "iscsiIqn", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "iscsi_iqn"), Type: sdkMetric.ATTRIBUTE}, {Name: "iscsiTargetPortal", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "iscsi_target_portal"), Type: sdkMetric.ATTRIBUTE}, {Name: "fcTargetWwns", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "fc_target_wwns"), Type: sdkMetric.ATTRIBUTE}, {Name: "fcLun", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "fc_lun"), Type: sdkMetric.ATTRIBUTE}, {Name: "fcWwids", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "fc_wwids"), Type: sdkMetric.ATTRIBUTE}, {Name: "azureDiskName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "azure_disk_name"), Type: sdkMetric.ATTRIBUTE}, {Name: "ebsVolumeId", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "ebs_volume_id"), Type: sdkMetric.ATTRIBUTE}, {Name: "gcePersistentDiskName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolume_info", "gce_persistent_disk_name"), Type: sdkMetric.ATTRIBUTE}, }, }, "cronjob": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_cronjob_created", "cronjob"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_cronjob_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_cronjob_created"), Type: sdkMetric.GAUGE}, {Name: "isActive", ValueFunc: prometheus.FromValue("kube_cronjob_status_active"), Type: sdkMetric.GAUGE}, {Name: "nextScheduledTime", ValueFunc: prometheus.FromValue("kube_cronjob_next_schedule_time"), Type: sdkMetric.GAUGE}, {Name: "lastScheduledTime", ValueFunc: prometheus.FromValue("kube_cronjob_status_last_schedule_time"), Type: sdkMetric.GAUGE}, {Name: "isSuspended", ValueFunc: prometheus.FromValue("kube_cronjob_spec_suspend"), Type: sdkMetric.GAUGE}, {Name: "specStartingDeadlineSeconds", ValueFunc: prometheus.FromValue("kube_cronjob_spec_starting_deadline_seconds"), Type: sdkMetric.GAUGE}, {Name: "metadataResourceVersion", ValueFunc: prometheus.FromValue("kube_cronjob_metadata_resource_version"), Type: sdkMetric.GAUGE}, {Name: "cronjobName", ValueFunc: prometheus.FromLabelValue("kube_cronjob_created", "cronjob"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_cronjob_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_cronjob_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("cronjob", "kube_cronjob_labels"), Type: sdkMetric.ATTRIBUTE}, {Name: "schedule", ValueFunc: prometheus.FromLabelValue("kube_cronjob_info", "schedule"), Type: sdkMetric.ATTRIBUTE}, {Name: "concurrencyPolicy", ValueFunc: prometheus.FromLabelValue("kube_cronjob_info", "concurrency_policy"), Type: sdkMetric.ATTRIBUTE}, }, }, "job_name": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_job_created", "job_name"), TypeGenerator: prometheus.FromLabelValueEntityTypeGeneratorWithCustomGroup("kube_job_created", "job"), NamespaceGetter: prometheus.FromLabelGetNamespace, MsTypeGuesser: metricSetTypeGuesserWithCustomGroup("job"), Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_job_created"), Type: sdkMetric.GAUGE}, {Name: "startedAt", ValueFunc: prometheus.FromValue("kube_job_status_start_time"), Type: sdkMetric.GAUGE}, {Name: "completedAt", ValueFunc: prometheus.FromValue("kube_job_status_completion_time"), Type: sdkMetric.GAUGE}, {Name: "specParallelism", ValueFunc: prometheus.FromValue("kube_job_spec_parallelism"), Type: sdkMetric.GAUGE}, {Name: "specCompletions", ValueFunc: prometheus.FromValue("kube_job_spec_completions"), Type: sdkMetric.GAUGE}, {Name: "specActiveDeadlineSeconds", ValueFunc: prometheus.FromValue("kube_job_spec_active_deadline_seconds"), Type: sdkMetric.GAUGE}, {Name: "activePods", ValueFunc: prometheus.FromValue("kube_job_status_active"), Type: sdkMetric.GAUGE}, {Name: "succeededPods", ValueFunc: prometheus.FromValue("kube_job_status_succeeded"), Type: sdkMetric.GAUGE}, {Name: "failedPods", ValueFunc: prometheus.FromValue("kube_job_status_failed"), Type: sdkMetric.GAUGE}, {Name: "isComplete", ValueFunc: prometheus.FromLabelValue("kube_job_complete", "condition"), Type: sdkMetric.ATTRIBUTE}, {Name: "failed", ValueFunc: prometheus.FromLabelValue("kube_job_failed", "condition"), Type: sdkMetric.ATTRIBUTE}, {Name: "failedPodsReason", ValueFunc: prometheus.FromLabelValue("kube_job_status_failed", "reason"), Type: sdkMetric.ATTRIBUTE}, {Name: "ownerName", ValueFunc: prometheus.FromLabelValue("kube_job_owner", "owner_name"), Type: sdkMetric.ATTRIBUTE}, {Name: "ownerKind", ValueFunc: prometheus.FromLabelValue("kube_job_owner", "owner_kind"), Type: sdkMetric.ATTRIBUTE}, {Name: "ownerIsController", ValueFunc: prometheus.FromLabelValue("kube_job_owner", "owner_is_controller"), Type: sdkMetric.ATTRIBUTE}, {Name: "jobName", ValueFunc: prometheus.FromLabelValue("kube_job_created", "job_name"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_job_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_job_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("job_name", "kube_job_labels"), Type: sdkMetric.ATTRIBUTE}, }, }, "persistentvolumeclaim": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_persistentvolumeclaim_info", "persistentvolumeclaim"), TypeGenerator: prometheus.FromLabelValueEntityTypeGeneratorWithCustomGroup("kube_persistentvolumeclaim_info", "PersistentVolumeClaim"), NamespaceGetter: prometheus.FromLabelGetNamespace, MsTypeGuesser: metricSetTypeGuesserWithCustomGroup("PersistentVolumeClaim"), Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_persistentvolumeclaim_created"), Type: sdkMetric.GAUGE}, {Name: "requestedStorageBytes", ValueFunc: prometheus.FromValue("kube_persistentvolumeclaim_resource_requests_storage_bytes"), Type: sdkMetric.GAUGE}, {Name: "accessMode", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_access_mode", "access_mode"), Type: sdkMetric.ATTRIBUTE}, {Name: "statusPhase", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_status_phase", "phase"), Type: sdkMetric.ATTRIBUTE}, {Name: "storageClass", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_info", "storageclass"), Type: sdkMetric.ATTRIBUTE}, {Name: "pvcName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_info", "persistentvolumeclaim"), Type: sdkMetric.ATTRIBUTE}, {Name: "volumeName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_info", "volumename"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_info", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_persistentvolumeclaim_info", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("persistentvolumeclaim", "kube_persistentvolumeclaim_labels"), Type: sdkMetric.ATTRIBUTE}, }, }, "replicaset": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_replicaset_created", "replicaset"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_replicaset_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_replicaset_created"), Type: sdkMetric.GAUGE}, {Name: "podsDesired", ValueFunc: prometheus.FromValue("kube_replicaset_spec_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsReady", ValueFunc: prometheus.FromValue("kube_replicaset_status_ready_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsTotal", ValueFunc: prometheus.FromValue("kube_replicaset_status_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsFullyLabeled", ValueFunc: prometheus.FromValue("kube_replicaset_status_fully_labeled_replicas"), Type: sdkMetric.GAUGE}, {Name: "observedGeneration", ValueFunc: prometheus.FromValue("kube_replicaset_status_observed_generation"), Type: sdkMetric.GAUGE}, {Name: "metadataGeneration", ValueFunc: prometheus.FromValue("kube_replicaset_metadata_generation"), Type: sdkMetric.GAUGE}, {Name: "replicasetName", ValueFunc: prometheus.FromLabelValue("kube_replicaset_created", "replicaset"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_replicaset_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_replicaset_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "deploymentName", ValueFunc: ksmMetric.GetDeploymentNameForReplicaSet(), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("replicaset", "kube_replicaset_labels"), Type: sdkMetric.ATTRIBUTE}, {Name: "ownerName", ValueFunc: prometheus.FromLabelValue("kube_replicaset_owner", "owner_name"), Type: sdkMetric.ATTRIBUTE}, {Name: "ownerKind", ValueFunc: prometheus.FromLabelValue("kube_replicaset_owner", "owner_kind"), Type: sdkMetric.ATTRIBUTE}, {Name: "ownerIsController", ValueFunc: prometheus.FromLabelValue("kube_replicaset_owner", "owner_is_controller"), Type: sdkMetric.ATTRIBUTE}, { Name: "podsMissing", ValueFunc: Subtract( definition.Transform(prometheus.FromValue("kube_replicaset_spec_replicas"), fromPrometheusNumeric), definition.Transform(prometheus.FromValue("kube_replicaset_status_ready_replicas"), fromPrometheusNumeric)), Type: sdkMetric.GAUGE, }, }, }, "statefulset": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_statefulset_created", "statefulset"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_statefulset_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_statefulset_created"), Type: sdkMetric.GAUGE}, {Name: "podsDesired", ValueFunc: prometheus.FromValue("kube_statefulset_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsReady", ValueFunc: prometheus.FromValue("kube_statefulset_status_replicas_ready"), Type: sdkMetric.GAUGE}, {Name: "podsCurrent", ValueFunc: prometheus.FromValue("kube_statefulset_status_replicas_current"), Type: sdkMetric.GAUGE}, {Name: "podsTotal", ValueFunc: prometheus.FromValue("kube_statefulset_status_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsUpdated", ValueFunc: prometheus.FromValue("kube_statefulset_status_replicas_updated"), Type: sdkMetric.GAUGE}, {Name: "observedGeneration", ValueFunc: prometheus.FromValue("kube_statefulset_status_observed_generation"), Type: sdkMetric.GAUGE}, {Name: "metadataGeneration", ValueFunc: prometheus.FromValue("kube_statefulset_metadata_generation"), Type: sdkMetric.GAUGE}, {Name: "currentRevision", ValueFunc: prometheus.FromValue("kube_statefulset_status_current_revision"), Type: sdkMetric.GAUGE}, {Name: "updateRevision", ValueFunc: prometheus.FromValue("kube_statefulset_status_update_revision"), Type: sdkMetric.GAUGE}, {Name: "statefulsetName", ValueFunc: prometheus.FromLabelValue("kube_statefulset_created", "statefulset"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_statefulset_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("statefulset", "kube_statefulset_labels"), Type: sdkMetric.ATTRIBUTE}, { Name: "podsMissing", ValueFunc: Subtract( definition.Transform(prometheus.FromValue("kube_statefulset_replicas"), fromPrometheusNumeric), definition.Transform(prometheus.FromValue("kube_statefulset_status_replicas_ready"), fromPrometheusNumeric)), Type: sdkMetric.GAUGE, }, }, }, "daemonset": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_daemonset_created", "daemonset"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_daemonset_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_daemonset_created"), Type: sdkMetric.GAUGE}, {Name: "podsDesired", ValueFunc: prometheus.FromValue("kube_daemonset_status_desired_number_scheduled"), Type: sdkMetric.GAUGE}, {Name: "podsScheduled", ValueFunc: prometheus.FromValue("kube_daemonset_status_current_number_scheduled"), Type: sdkMetric.GAUGE}, {Name: "podsAvailable", ValueFunc: prometheus.FromValue("kube_daemonset_status_number_available"), Type: sdkMetric.GAUGE}, {Name: "podsReady", ValueFunc: prometheus.FromValue("kube_daemonset_status_number_ready"), Type: sdkMetric.GAUGE}, {Name: "podsUnavailable", ValueFunc: prometheus.FromValue("kube_daemonset_status_number_unavailable"), Type: sdkMetric.GAUGE}, {Name: "podsMisscheduled", ValueFunc: prometheus.FromValue("kube_daemonset_status_number_misscheduled"), Type: sdkMetric.GAUGE}, {Name: "podsUpdatedScheduled", ValueFunc: prometheus.FromValue("kube_daemonset_status_updated_number_scheduled"), Type: sdkMetric.GAUGE}, {Name: "observedGeneration", ValueFunc: prometheus.FromValue("kube_daemonset_status_observed_generation"), Type: sdkMetric.GAUGE}, {Name: "metadataGeneration", ValueFunc: prometheus.FromValue("kube_daemonset_metadata_generation"), Type: sdkMetric.GAUGE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_daemonset_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "daemonsetName", ValueFunc: prometheus.FromLabelValue("kube_daemonset_created", "daemonset"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("daemonset", "kube_daemonset_labels"), Type: sdkMetric.ATTRIBUTE}, { Name: "podsMissing", ValueFunc: Subtract( definition.Transform(prometheus.FromValue("kube_daemonset_status_desired_number_scheduled"), fromPrometheusNumeric), definition.Transform(prometheus.FromValue("kube_daemonset_status_number_ready"), fromPrometheusNumeric)), Type: sdkMetric.GAUGE, }, }, }, "namespace": { TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_namespace_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_namespace_created"), Type: sdkMetric.GAUGE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_namespace_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_namespace_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "status", ValueFunc: prometheus.FromLabelValue("kube_namespace_status_phase", "phase"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("namespace", "kube_namespace_labels"), Type: sdkMetric.ATTRIBUTE}, }, }, "deployment": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_deployment_created", "deployment"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_deployment_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_deployment_created"), Type: sdkMetric.GAUGE}, {Name: "podsDesired", ValueFunc: prometheus.FromValue("kube_deployment_spec_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsTotal", ValueFunc: prometheus.FromValue("kube_deployment_status_replicas"), Type: sdkMetric.GAUGE}, {Name: "podsReady", ValueFunc: prometheus.FromValue("kube_deployment_status_replicas_ready"), Type: sdkMetric.GAUGE}, {Name: "podsAvailable", ValueFunc: prometheus.FromValue("kube_deployment_status_replicas_available"), Type: sdkMetric.GAUGE}, {Name: "podsUnavailable", ValueFunc: prometheus.FromValue("kube_deployment_status_replicas_unavailable"), Type: sdkMetric.GAUGE}, {Name: "podsUpdated", ValueFunc: prometheus.FromValue("kube_deployment_status_replicas_updated"), Type: sdkMetric.GAUGE}, {Name: "observedGeneration", ValueFunc: prometheus.FromValue("kube_deployment_status_observed_generation"), Type: sdkMetric.GAUGE}, {Name: "isPaused", ValueFunc: prometheus.FromValue("kube_deployment_spec_paused"), Type: sdkMetric.GAUGE}, {Name: "rollingUpdateMaxPodsSurge", ValueFunc: prometheus.FromValue("kube_deployment_spec_strategy_rollingupdate_max_surge"), Type: sdkMetric.GAUGE}, {Name: "metadataGeneration", ValueFunc: prometheus.FromValue("kube_deployment_metadata_generation"), Type: sdkMetric.GAUGE}, {Name: "conditionAvailable", ValueFunc: prometheus.FromLabelValue("kube_deployment_status_condition_available", "status"), Type: sdkMetric.ATTRIBUTE}, {Name: "conditionProgressing", ValueFunc: prometheus.FromLabelValue("kube_deployment_status_condition_progressing", "status"), Type: sdkMetric.ATTRIBUTE}, {Name: "conditionReplicaFailure", ValueFunc: prometheus.FromLabelValue("kube_deployment_status_condition_replica_failure", "status"), Type: sdkMetric.ATTRIBUTE}, {Name: "podsMaxUnavailable", ValueFunc: prometheus.FromValue("kube_deployment_spec_strategy_rollingupdate_max_unavailable"), Type: sdkMetric.GAUGE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_deployment_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_deployment_created", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "deploymentName", ValueFunc: prometheus.FromLabelValue("kube_deployment_created", "deployment"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("namespace", "kube_namespace_labels"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("deployment", "kube_deployment_labels"), Type: sdkMetric.ATTRIBUTE}, { Name: "podsMissing", ValueFunc: Subtract( definition.Transform(prometheus.FromValue("kube_deployment_spec_replicas"), fromPrometheusNumeric), definition.Transform(prometheus.FromValue("kube_deployment_status_replicas"), fromPrometheusNumeric)), Type: sdkMetric.GAUGE, }, }, }, "service": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_service_created", "service"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_service_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ { Name: "createdAt", ValueFunc: prometheus.FromValue("kube_service_created"), Type: sdkMetric.GAUGE, }, { Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_service_created", "namespace"), Type: sdkMetric.ATTRIBUTE, }, { Name: "serviceName", ValueFunc: prometheus.FromLabelValue("kube_service_created", "service"), Type: sdkMetric.ATTRIBUTE, }, { Name: "loadBalancerIP", ValueFunc: prometheus.FromLabelValue("kube_service_info", "load_balancer_ip"), Type: sdkMetric.ATTRIBUTE, Optional: true, }, { Name: "externalName", ValueFunc: prometheus.FromLabelValue("kube_service_info", "external_name"), Type: sdkMetric.ATTRIBUTE, Optional: true, }, { Name: "clusterIP", ValueFunc: prometheus.FromLabelValue("kube_service_info", "cluster_ip"), Type: sdkMetric.ATTRIBUTE, Optional: true, }, { Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("service", "kube_service_labels"), Type: sdkMetric.ATTRIBUTE, }, { Name: "specType", ValueFunc: prometheus.FromLabelValue("kube_service_spec_type", "type"), Type: sdkMetric.ATTRIBUTE, }, { Name: "selector.*", ValueFunc: prometheus.InheritAllSelectorsFrom("service", "apiserver_kube_service_spec_selectors"), Type: sdkMetric.ATTRIBUTE, }, }, }, "endpoint": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_endpoint_created", "endpoint"), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_endpoint_created"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ { Name: "createdAt", ValueFunc: prometheus.FromValue("kube_endpoint_created"), Type: sdkMetric.GAUGE, }, { Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_endpoint_created", "namespace"), Type: sdkMetric.ATTRIBUTE, }, { Name: "endpointName", ValueFunc: prometheus.FromLabelValue("kube_endpoint_created", "endpoint"), Type: sdkMetric.ATTRIBUTE, }, { Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("endpoint", "kube_endpoint_labels"), Type: sdkMetric.ATTRIBUTE, }, { Name: "addressNotReady", ValueFunc: prometheus.FromValue("kube_endpoint_address_not_ready"), Type: sdkMetric.GAUGE, }, { Name: "addressAvailable", ValueFunc: prometheus.FromValue("kube_endpoint_address_available"), Type: sdkMetric.GAUGE, }, }, }, "pod": { IDGenerator: prometheus.FromLabelsValueEntityIDGeneratorForPendingPods(), TypeGenerator: prometheus.FromLabelValueEntityTypeGenerator("kube_pod_status_phase"), NamespaceGetter: prometheus.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "createdAt", ValueFunc: prometheus.FromValue("kube_pod_created"), Type: sdkMetric.GAUGE}, {Name: "createdKind", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "created_by_kind"), Type: sdkMetric.ATTRIBUTE}, {Name: "createdBy", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "created_by_name"), Type: sdkMetric.ATTRIBUTE}, {Name: "nodeIP", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "host_ip"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespace", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "nodeName", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "node"), Type: sdkMetric.ATTRIBUTE}, {Name: "podName", ValueFunc: prometheus.FromLabelValue("kube_pod_info", "pod"), Type: sdkMetric.ATTRIBUTE}, {Name: "isReady", ValueFunc: definition.Transform(fetchWithDefault(prometheus.FromLabelValue("kube_pod_status_ready", "condition"), "false"), toNumericBoolean), Type: sdkMetric.GAUGE}, {Name: "status", ValueFunc: prometheus.FromLabelValue("kube_pod_status_phase", "phase"), Type: sdkMetric.ATTRIBUTE}, {Name: "isScheduled", ValueFunc: definition.Transform(prometheus.FromLabelValue("kube_pod_status_scheduled", "condition"), toNumericBoolean), Type: sdkMetric.GAUGE}, {Name: "deploymentName", ValueFunc: ksmMetric.GetDeploymentNameForPod(), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("pod", "kube_pod_labels"), Type: sdkMetric.ATTRIBUTE}, }, }, "horizontalpodautoscaler": { IDGenerator: prometheus.FromLabelValueEntityIDGenerator("kube_horizontalpodautoscaler_status_current_replicas", "horizontalpodautoscaler"), TypeGenerator: prometheus.FromLabelValueEntityTypeGeneratorWithCustomGroup("kube_horizontalpodautoscaler_status_current_replicas", "hpa"), NamespaceGetter: prometheus.FromLabelGetNamespace, MsTypeGuesser: metricSetTypeGuesserWithCustomGroup("hpa"), Specs: []definition.Spec{ {Name: "metadataGeneration", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_metadata_generation"), Type: sdkMetric.GAUGE}, {Name: "maxReplicas", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_spec_max_replicas"), Type: sdkMetric.GAUGE}, {Name: "minReplicas", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_spec_min_replicas"), Type: sdkMetric.GAUGE}, {Name: "targetMetric", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_spec_target_metric"), Type: sdkMetric.GAUGE}, {Name: "currentReplicas", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_status_current_replicas"), Type: sdkMetric.GAUGE}, {Name: "desiredReplicas", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_status_desired_replicas"), Type: sdkMetric.GAUGE}, {Name: "namespaceName", ValueFunc: prometheus.FromLabelValue("kube_horizontalpodautoscaler_metadata_generation", "namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "label.*", ValueFunc: prometheus.InheritAllLabelsFrom("horizontalpodautoscaler", "kube_horizontalpodautoscaler_labels"), Type: sdkMetric.ATTRIBUTE}, {Name: "isActive", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_status_condition_active")}, {Name: "isAble", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_status_condition_able")}, {Name: "isLimited", ValueFunc: prometheus.FromValue("kube_horizontalpodautoscaler_status_condition_limited")}, }, }, }
KSMSpecs are the metric specifications we want to collect from KSM.
var KubeletSpecs = definition.SpecGroups{ "pod": { IDGenerator: kubeletMetric.FromRawEntityIDGroupEntityIDGenerator("namespace"), TypeGenerator: kubeletMetric.FromRawGroupsEntityTypeGenerator, NamespaceGetter: kubeletMetric.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "net.rxBytesPerSecond", ValueFunc: kubeletMetric.FromRawWithFallbackToDefaultInterface("rxBytes"), Type: sdkMetric.RATE}, {Name: "net.txBytesPerSecond", ValueFunc: kubeletMetric.FromRawWithFallbackToDefaultInterface("txBytes"), Type: sdkMetric.RATE}, {Name: "net.errorsPerSecond", ValueFunc: kubeletMetric.FromRawWithFallbackToDefaultInterface("errors"), Type: sdkMetric.RATE}, {Name: "createdAt", ValueFunc: definition.Transform(definition.FromRaw("createdAt"), toTimestamp), Type: sdkMetric.GAUGE, Optional: true}, {Name: "scheduledAt", ValueFunc: definition.Transform(definition.FromRaw("scheduledAt"), toTimestamp), Type: sdkMetric.GAUGE, Optional: true}, {Name: "initializedAt", ValueFunc: definition.Transform(definition.FromRaw("initializedAt"), toTimestamp), Type: sdkMetric.GAUGE, Optional: true}, {Name: "containersReadyAt", ValueFunc: definition.Transform(definition.FromRaw("containersReadyAt"), toTimestamp), Type: sdkMetric.GAUGE, Optional: true}, {Name: "readyAt", ValueFunc: definition.Transform(definition.FromRaw("readyAt"), toTimestamp), Type: sdkMetric.GAUGE, Optional: true}, {Name: "startTime", ValueFunc: definition.Transform(definition.FromRaw("startTime"), toTimestamp), Type: sdkMetric.GAUGE}, {Name: "createdKind", ValueFunc: definition.FromRaw("createdKind"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "createdBy", ValueFunc: definition.FromRaw("createdBy"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "nodeIP", ValueFunc: definition.FromRaw("nodeIP"), Type: sdkMetric.ATTRIBUTE}, {Name: "podIP", ValueFunc: definition.FromRaw("podIP"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "namespace", ValueFunc: definition.FromRaw("namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: definition.FromRaw("namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "nodeName", ValueFunc: definition.FromRaw("nodeName"), Type: sdkMetric.ATTRIBUTE}, {Name: "podName", ValueFunc: definition.FromRaw("podName"), Type: sdkMetric.ATTRIBUTE}, {Name: "isReady", ValueFunc: definition.Transform(definition.FromRaw("isReady"), toNumericBoolean), Type: sdkMetric.GAUGE}, {Name: "status", ValueFunc: definition.FromRaw("status"), Type: sdkMetric.ATTRIBUTE}, {Name: "isScheduled", ValueFunc: definition.Transform(definition.FromRaw("isScheduled"), toNumericBoolean), Type: sdkMetric.GAUGE}, {Name: "deploymentName", ValueFunc: definition.FromRaw("deploymentName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "daemonsetName", ValueFunc: definition.FromRaw("daemonsetName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "jobName", ValueFunc: definition.FromRaw("jobName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "replicasetName", ValueFunc: definition.FromRaw("replicasetName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "statefulsetName", ValueFunc: definition.FromRaw("statefulsetName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "label.*", ValueFunc: definition.Transform(definition.FromRaw("labels"), kubeletMetric.OneMetricPerLabel), Type: sdkMetric.ATTRIBUTE}, {Name: "reason", ValueFunc: definition.FromRaw("reason"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "message", ValueFunc: definition.FromRaw("message"), Type: sdkMetric.ATTRIBUTE, Optional: true}, }, }, "container": { IDGenerator: kubeletMetric.FromRawGroupsEntityIDGenerator("containerName"), TypeGenerator: kubeletMetric.FromRawGroupsEntityTypeGenerator, NamespaceGetter: kubeletMetric.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "memoryUsedBytes", ValueFunc: definition.FromRaw("usageBytes"), Type: sdkMetric.GAUGE}, {Name: "memoryWorkingSetBytes", ValueFunc: workingSetBytes, Type: sdkMetric.GAUGE}, {Name: "cpuUsedCores", ValueFunc: _cpuUsedCores, Type: sdkMetric.GAUGE}, {Name: "fsAvailableBytes", ValueFunc: definition.FromRaw("fsAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "fsCapacityBytes", ValueFunc: definition.FromRaw("fsCapacityBytes"), Type: sdkMetric.GAUGE}, {Name: "fsUsedBytes", ValueFunc: definition.FromRaw("fsUsedBytes"), Type: sdkMetric.GAUGE}, {Name: "fsUsedPercent", ValueFunc: toComplementPercentage("fsUsedBytes", "fsAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "fsInodesFree", ValueFunc: definition.FromRaw("fsInodesFree"), Type: sdkMetric.GAUGE}, {Name: "fsInodes", ValueFunc: definition.FromRaw("fsInodes"), Type: sdkMetric.GAUGE}, {Name: "fsInodesUsed", ValueFunc: definition.FromRaw("fsInodesUsed"), Type: sdkMetric.GAUGE}, {Name: "containerID", ValueFunc: definition.FromRaw("containerID"), Type: sdkMetric.ATTRIBUTE}, {Name: "containerImageID", ValueFunc: definition.FromRaw("containerImageID"), Type: sdkMetric.ATTRIBUTE}, {Name: "containerMemoryMappedFileBytes", ValueFunc: definition.FromRaw("container_memory_mapped_file"), Type: sdkMetric.GAUGE, Optional: true}, {Name: "containerOOMEventsDelta", ValueFunc: definition.FromRaw("container_oom_events_total"), Type: sdkMetric.PDELTA, Optional: true}, {Name: "containerCpuCfsPeriodsDelta", ValueFunc: definition.FromRaw("container_cpu_cfs_periods_total"), Type: sdkMetric.DELTA, Optional: true}, {Name: "containerCpuCfsThrottledPeriodsDelta", ValueFunc: definition.FromRaw("container_cpu_cfs_throttled_periods_total"), Type: sdkMetric.DELTA, Optional: true}, {Name: "containerCpuCfsThrottledSecondsDelta", ValueFunc: definition.FromRaw("container_cpu_cfs_throttled_seconds_total"), Type: sdkMetric.DELTA, Optional: true}, {Name: "containerCpuCfsPeriodsTotal", ValueFunc: definition.FromRaw("container_cpu_cfs_periods_total"), Type: sdkMetric.GAUGE, Optional: true}, {Name: "containerCpuCfsThrottledPeriodsTotal", ValueFunc: definition.FromRaw("container_cpu_cfs_throttled_periods_total"), Type: sdkMetric.GAUGE, Optional: true}, {Name: "containerCpuCfsThrottledSecondsTotal", ValueFunc: definition.FromRaw("container_cpu_cfs_throttled_seconds_total"), Type: sdkMetric.GAUGE, Optional: true}, {Name: "containerName", ValueFunc: definition.FromRaw("containerName"), Type: sdkMetric.ATTRIBUTE}, {Name: "containerImage", ValueFunc: definition.FromRaw("containerImage"), Type: sdkMetric.ATTRIBUTE}, {Name: "deploymentName", ValueFunc: definition.FromRaw("deploymentName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "daemonsetName", ValueFunc: definition.FromRaw("daemonsetName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "jobName", ValueFunc: definition.FromRaw("jobName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "replicasetName", ValueFunc: definition.FromRaw("replicasetName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "statefulsetName", ValueFunc: definition.FromRaw("statefulsetName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "namespace", ValueFunc: definition.FromRaw("namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: definition.FromRaw("namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "podName", ValueFunc: definition.FromRaw("podName"), Type: sdkMetric.ATTRIBUTE}, {Name: "nodeName", ValueFunc: definition.FromRaw("nodeName"), Type: sdkMetric.ATTRIBUTE}, {Name: "nodeIP", ValueFunc: definition.FromRaw("nodeIP"), Type: sdkMetric.ATTRIBUTE}, {Name: "restartCount", ValueFunc: definition.FromRaw("restartCount"), Type: sdkMetric.GAUGE}, {Name: "restartCountDelta", ValueFunc: definition.FromRaw("restartCount"), Type: sdkMetric.PDELTA}, {Name: "cpuRequestedCores", ValueFunc: cpuRequestedCores, Type: sdkMetric.GAUGE, Optional: true}, {Name: "cpuLimitCores", ValueFunc: cpuLimitCores, Type: sdkMetric.GAUGE, Optional: true}, {Name: "memoryRequestedBytes", ValueFunc: definition.FromRaw("memoryRequestedBytes"), Type: sdkMetric.GAUGE, Optional: true}, {Name: "memoryLimitBytes", ValueFunc: definition.FromRaw("memoryLimitBytes"), Type: sdkMetric.GAUGE, Optional: true}, {Name: "status", ValueFunc: definition.FromRaw("status"), Type: sdkMetric.ATTRIBUTE}, {Name: "isReady", ValueFunc: definition.Transform(definition.FromRaw("isReady"), toNumericBoolean), Type: sdkMetric.GAUGE}, {Name: "reason", ValueFunc: definition.FromRaw("reason"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "label.*", ValueFunc: definition.Transform(definition.FromRaw("labels"), kubeletMetric.OneMetricPerLabel), Type: sdkMetric.ATTRIBUTE}, {Name: "cpuCoresUtilization", ValueFunc: toUtilization(_cpuUsedCores, cpuLimitCores), Type: sdkMetric.GAUGE, Optional: true}, {Name: "requestedCpuCoresUtilization", ValueFunc: toUtilization(_cpuUsedCores, cpuRequestedCores), Type: sdkMetric.GAUGE, Optional: true}, {Name: "memoryUtilization", ValueFunc: toUtilization(definition.FromRaw("usageBytes"), definition.FromRaw("memoryLimitBytes")), Type: sdkMetric.GAUGE, Optional: true}, {Name: "requestedMemoryUtilization", ValueFunc: toUtilization(definition.FromRaw("usageBytes"), definition.FromRaw("memoryRequestedBytes")), Type: sdkMetric.GAUGE, Optional: true}, }, }, "node": { TypeGenerator: kubeletMetric.FromRawGroupsEntityTypeGenerator, Specs: []definition.Spec{ {Name: "nodeName", ValueFunc: definition.FromRaw("nodeName"), Type: sdkMetric.ATTRIBUTE}, {Name: "cpuUsedCores", ValueFunc: _cpuUsedCores, Type: sdkMetric.GAUGE}, {Name: "cpuUsedCoreMilliseconds", ValueFunc: definition.Transform(definition.FromRaw("usageCoreNanoSeconds"), fromNanoToMilli), Type: sdkMetric.GAUGE}, {Name: "memoryUsedBytes", ValueFunc: definition.FromRaw("memoryUsageBytes"), Type: sdkMetric.GAUGE}, {Name: "memoryAvailableBytes", ValueFunc: definition.FromRaw("memoryAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "memoryWorkingSetBytes", ValueFunc: definition.FromRaw("memoryWorkingSetBytes"), Type: sdkMetric.GAUGE}, {Name: "memoryRssBytes", ValueFunc: definition.FromRaw("memoryRssBytes"), Type: sdkMetric.GAUGE}, {Name: "memoryPageFaults", ValueFunc: definition.FromRaw("memoryPageFaults"), Type: sdkMetric.GAUGE}, {Name: "memoryMajorPageFaultsPerSecond", ValueFunc: definition.FromRaw("memoryMajorPageFaults"), Type: sdkMetric.RATE}, {Name: "net.rxBytesPerSecond", ValueFunc: kubeletMetric.FromRawWithFallbackToDefaultInterface("rxBytes"), Type: sdkMetric.RATE}, {Name: "net.txBytesPerSecond", ValueFunc: kubeletMetric.FromRawWithFallbackToDefaultInterface("txBytes"), Type: sdkMetric.RATE}, {Name: "net.errorsPerSecond", ValueFunc: kubeletMetric.FromRawWithFallbackToDefaultInterface("errors"), Type: sdkMetric.RATE}, {Name: "fsAvailableBytes", ValueFunc: definition.FromRaw("fsAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "fsCapacityBytes", ValueFunc: definition.FromRaw("fsCapacityBytes"), Type: sdkMetric.GAUGE}, {Name: "fsUsedBytes", ValueFunc: definition.FromRaw("fsUsedBytes"), Type: sdkMetric.GAUGE}, {Name: "fsInodesFree", ValueFunc: definition.FromRaw("fsInodesFree"), Type: sdkMetric.GAUGE}, {Name: "fsInodes", ValueFunc: definition.FromRaw("fsInodes"), Type: sdkMetric.GAUGE}, {Name: "fsInodesUsed", ValueFunc: definition.FromRaw("fsInodesUsed"), Type: sdkMetric.GAUGE}, {Name: "runtimeAvailableBytes", ValueFunc: definition.FromRaw("runtimeAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "runtimeCapacityBytes", ValueFunc: definition.FromRaw("runtimeCapacityBytes"), Type: sdkMetric.GAUGE}, {Name: "runtimeUsedBytes", ValueFunc: definition.FromRaw("runtimeUsedBytes"), Type: sdkMetric.GAUGE}, {Name: "runtimeInodesFree", ValueFunc: definition.FromRaw("runtimeInodesFree"), Type: sdkMetric.GAUGE}, {Name: "runtimeInodes", ValueFunc: definition.FromRaw("runtimeInodes"), Type: sdkMetric.GAUGE}, {Name: "runtimeInodesUsed", ValueFunc: definition.FromRaw("runtimeInodesUsed"), Type: sdkMetric.GAUGE}, {Name: "label.*", ValueFunc: definition.Transform(definition.FromRaw("labels"), kubeletMetric.OneMetricPerLabel), Type: sdkMetric.ATTRIBUTE}, {Name: "allocatable.*", ValueFunc: definition.Transform(definition.FromRaw("allocatable"), kubeletMetric.OneAttributePerAllocatable), Type: sdkMetric.GAUGE}, {Name: "capacity.*", ValueFunc: definition.Transform(definition.FromRaw("capacity"), kubeletMetric.OneAttributePerCapacity), Type: sdkMetric.GAUGE}, {Name: "condition.*", ValueFunc: definition.Transform(definition.FromRaw("conditions"), kubeletMetric.PrefixFromMapInt("condition.")), Type: sdkMetric.GAUGE}, {Name: "unschedulable", ValueFunc: definition.Transform(definition.FromRaw("unschedulable"), toNumericBoolean), Type: sdkMetric.GAUGE}, {Name: "memoryRequestedBytes", ValueFunc: definition.FromRaw("memoryRequestedBytes"), Type: sdkMetric.GAUGE}, {Name: "cpuRequestedCores", ValueFunc: cpuRequestedCores, Type: sdkMetric.GAUGE}, {Name: "kubeletVersion", ValueFunc: definition.FromRaw("kubeletVersion"), Type: sdkMetric.ATTRIBUTE}, {Name: "fsCapacityUtilization", ValueFunc: toUtilization(definition.FromRaw("fsUsedBytes"), definition.FromRaw("fsCapacityBytes")), Type: sdkMetric.GAUGE}, {Name: "allocatableCpuCoresUtilization", ValueFunc: toUtilization(_cpuUsedCores, definition.FromRaw("allocatableCpuCores")), Type: sdkMetric.GAUGE}, {Name: "allocatableMemoryUtilization", ValueFunc: toUtilization(workingSetBytes, definition.FromRaw("allocatableMemoryBytes")), Type: sdkMetric.GAUGE}, }, }, "volume": { TypeGenerator: kubeletMetric.FromRawGroupsEntityTypeGenerator, NamespaceGetter: kubeletMetric.FromLabelGetNamespace, Specs: []definition.Spec{ {Name: "volumeName", ValueFunc: definition.FromRaw("volumeName"), Type: sdkMetric.ATTRIBUTE}, {Name: "podName", ValueFunc: definition.FromRaw("podName"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespace", ValueFunc: definition.FromRaw("namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "namespaceName", ValueFunc: definition.FromRaw("namespace"), Type: sdkMetric.ATTRIBUTE}, {Name: "persistent", ValueFunc: isPersistentVolume(), Type: sdkMetric.ATTRIBUTE}, {Name: "pvcName", ValueFunc: definition.FromRaw("pvcName"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "pvcNamespace", ValueFunc: definition.FromRaw("pvcNamespace"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "pvcNamespaceName", ValueFunc: definition.FromRaw("pvcNamespace"), Type: sdkMetric.ATTRIBUTE, Optional: true}, {Name: "fsAvailableBytes", ValueFunc: definition.FromRaw("fsAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "fsCapacityBytes", ValueFunc: definition.FromRaw("fsCapacityBytes"), Type: sdkMetric.GAUGE}, {Name: "fsUsedBytes", ValueFunc: definition.FromRaw("fsUsedBytes"), Type: sdkMetric.GAUGE}, {Name: "fsUsedPercent", ValueFunc: toComplementPercentage("fsUsedBytes", "fsAvailableBytes"), Type: sdkMetric.GAUGE}, {Name: "fsInodesFree", ValueFunc: definition.FromRaw("fsInodesFree"), Type: sdkMetric.GAUGE}, {Name: "fsInodes", ValueFunc: definition.FromRaw("fsInodes"), Type: sdkMetric.GAUGE}, {Name: "fsInodesUsed", ValueFunc: definition.FromRaw("fsInodesUsed"), Type: sdkMetric.GAUGE}, }, }, }
KubeletSpecs are the metric specifications we want to collect from Kubelet.
var SchedulerQueries = []prometheus.Query{
{
MetricName: "leader_election_master_status",
},
{
MetricName: "rest_client_requests_total",
},
{
MetricName: "scheduler_schedule_attempts_total",
},
{
MetricName: "scheduler_scheduling_duration_seconds",
},
{
MetricName: "scheduler_total_preemption_attempts",
},
{
MetricName: "scheduler_pending_pods",
},
{
MetricName: "scheduler_pod_preemption_victims",
},
{
MetricName: "process_resident_memory_bytes",
},
{
MetricName: "process_cpu_seconds_total",
},
{
MetricName: "go_threads",
},
{
MetricName: "go_goroutines",
},
}
SchedulerQueries are the queries we will do to the control plane scheduler in order to fetch all the raw metrics.
var SchedulerSpecs = definition.SpecGroups{ "scheduler": { IDGenerator: prometheus.FromRawEntityIDGenerator, TypeGenerator: prometheus.ControlPlaneComponentTypeGenerator, Specs: []definition.Spec{ { Name: "leaderElectionMasterStatus", ValueFunc: prometheus.FromValueWithOverriddenName( "leader_election_master_status", "leaderElectionMasterStatus", prometheus.IgnoreLabelsFilter("name"), ), Type: sdkMetric.GAUGE, }, { Name: "restClientRequestsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("rest_client_requests_total", "restClientRequestsDelta"), Type: sdkMetric.DELTA, }, { Name: "restClientRequestsRate", ValueFunc: prometheus.FromValueWithOverriddenName("rest_client_requests_total", "restClientRequestsRate"), Type: sdkMetric.RATE, }, { Name: "schedulerScheduleAttemptsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("scheduler_schedule_attempts_total", "schedulerScheduleAttemptsDelta"), Type: sdkMetric.DELTA, }, { Name: "schedulerScheduleAttemptsRate", ValueFunc: prometheus.FromValueWithOverriddenName("scheduler_schedule_attempts_total", "schedulerScheduleAttemptsRate"), Type: sdkMetric.RATE, }, { Name: "schedulerSchedulingDurationSeconds", ValueFunc: prometheus.FromSummary("scheduler_scheduling_duration_seconds"), Type: sdkMetric.GAUGE, Optional: true, }, { Name: "schedulerPreemptionAttemptsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("scheduler_total_preemption_attempts", "schedulerPreemptionAttemptsDelta"), Type: sdkMetric.DELTA, }, { Name: "schedulerPendingPodsActive", ValueFunc: prometheus.FromValueWithLabelsFilter( "scheduler_pending_pods", "schedulerPendingPodsActive", prometheus.IncludeOnlyWhenLabelMatchFilter(map[string]string{ "queue": "active", }), ), Type: sdkMetric.GAUGE, }, { Name: "schedulerPendingPodsBackoff", ValueFunc: prometheus.FromValueWithLabelsFilter( "scheduler_pending_pods", "schedulerPendingPodsBackoff", prometheus.IncludeOnlyWhenLabelMatchFilter(map[string]string{ "queue": "backoff", }), ), Type: sdkMetric.GAUGE, }, { Name: "schedulerPendingPodsUnschedulable", ValueFunc: prometheus.FromValueWithLabelsFilter( "scheduler_pending_pods", "schedulerPendingPodsUnschedulable", prometheus.IncludeOnlyWhenLabelMatchFilter(map[string]string{ "queue": "unschedulable", }), ), Type: sdkMetric.GAUGE, }, { Name: "schedulerPodPreemptionVictims", ValueFunc: prometheus.FromValueWithOverriddenName("scheduler_pod_preemption_victims", "schedulerPodPreemptionVictims"), Type: sdkMetric.GAUGE, }, { Name: "processResidentMemoryBytes", ValueFunc: prometheus.FromValueWithOverriddenName("process_resident_memory_bytes", "processResidentMemoryBytes"), Type: sdkMetric.GAUGE, }, { Name: "processCpuSecondsDelta", ValueFunc: prometheus.FromValueWithOverriddenName("process_cpu_seconds_total", "processCpuSecondsDelta"), Type: sdkMetric.DELTA, }, { Name: "goThreads", ValueFunc: prometheus.FromValueWithOverriddenName("go_threads", "goThreads"), Type: sdkMetric.GAUGE, }, { Name: "goGoroutines", ValueFunc: prometheus.FromValueWithOverriddenName("go_goroutines", "goGoroutines"), Type: sdkMetric.GAUGE, }, }, }, }
SchedulerSpecs are the metric specifications we want to collect from the control plane scheduler.
Functions ¶
func Subtract ¶
func Subtract(left definition.FetchFunc, right definition.FetchFunc) definition.FetchFunc
Subtract returns a new FetchFunc that subtracts 2 values. It expects that the values are float64
Types ¶
This section is empty.