func (c *NodeStatsCollector) Collect(ch chan<- prometheus.Metric) error {
	if desc, err := c.collect(ch); err != nil {
		log.Error("Failed collecting node metrics", desc, err)
		return err
	}
	return nil
}
Collect function implements nodestats_collector collector
package collector
import (
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/common/log"
)
type NodeStatsCollector struct {
	endpoint string
	JvmThreadsCount     *prometheus.Desc
	JvmThreadsPeakCount *prometheus.Desc
	MemHeapUsedInBytes         *prometheus.Desc
	MemHeapCommittedInBytes    *prometheus.Desc
	MemHeapMaxInBytes          *prometheus.Desc
	MemNonHeapUsedInBytes      *prometheus.Desc
	MemNonHeapCommittedInBytes *prometheus.Desc
	MemPoolPeakUsedInBytes  *prometheus.Desc
	MemPoolUsedInBytes      *prometheus.Desc
	MemPoolPeakMaxInBytes   *prometheus.Desc
	MemPoolMaxInBytes       *prometheus.Desc
	MemPoolCommittedInBytes *prometheus.Desc
	GCCollectionTimeInMillis *prometheus.Desc
	GCCollectionCount        *prometheus.Desc
	ProcessOpenFileDescriptors    *prometheus.Desc
	ProcessMaxFileDescriptors     *prometheus.Desc
	ProcessMemTotalVirtualInBytes *prometheus.Desc
	ProcessCPUTotalInMillis       *prometheus.Desc
	PipelineDuration       *prometheus.Desc
	PipelineEventsIn       *prometheus.Desc
	PipelineEventsFiltered *prometheus.Desc
	PipelineEventsOut      *prometheus.Desc
	PipelinePluginEventsDuration *prometheus.Desc
	PipelinePluginEventsIn       *prometheus.Desc
	PipelinePluginEventsOut      *prometheus.Desc
	PipelinePluginMatches        *prometheus.Desc
	PipelinePluginFailures       *prometheus.Desc
	PipelineQueueEvents          *prometheus.Desc
	PipelineQueuePageCapacity    *prometheus.Desc
	PipelineQueueMaxQueueSize    *prometheus.Desc
	PipelineQueueMaxUnreadEvents *prometheus.Desc
	PipelineDeadLetterQueueSizeInBytes *prometheus.Desc
}
func NewNodeStatsCollector(logstashEndpoint string) (Collector, error) {
	const subsystem = "node"
	return &NodeStatsCollector{
		endpoint: logstashEndpoint,
		JvmThreadsCount: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "jvm_threads_count"),
			"jvm_threads_count",
			nil,
			nil,
		),
		JvmThreadsPeakCount: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "jvm_threads_peak_count"),
			"jvm_threads_peak_count",
			nil,
			nil,
		),
		MemHeapUsedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_heap_used_bytes"),
			"mem_heap_used_bytes",
			nil,
			nil,
		),
		MemHeapCommittedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_heap_committed_bytes"),
			"mem_heap_committed_bytes",
			nil,
			nil,
		),
		MemHeapMaxInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_heap_max_bytes"),
			"mem_heap_max_bytes",
			nil,
			nil,
		),
		MemNonHeapUsedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_nonheap_used_bytes"),
			"mem_nonheap_used_bytes",
			nil,
			nil,
		),
		MemNonHeapCommittedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_nonheap_committed_bytes"),
			"mem_nonheap_committed_bytes",
			nil,
			nil,
		),
		MemPoolUsedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_pool_used_bytes"),
			"mem_pool_used_bytes",
			[]string{"pool"},
			nil,
		),
		MemPoolPeakUsedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_pool_peak_used_bytes"),
			"mem_pool_peak_used_bytes",
			[]string{"pool"},
			nil,
		),
		MemPoolPeakMaxInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_pool_peak_max_bytes"),
			"mem_pool_peak_max_bytes",
			[]string{"pool"},
			nil,
		),
		MemPoolMaxInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_pool_max_bytes"),
			"mem_pool_max_bytes",
			[]string{"pool"},
			nil,
		),
		MemPoolCommittedInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "mem_pool_committed_bytes"),
			"mem_pool_committed_bytes",
			[]string{"pool"},
			nil,
		),
		GCCollectionTimeInMillis: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "gc_collection_duration_seconds_total"),
			"gc_collection_duration_seconds_total",
			[]string{"collector"},
			nil,
		),
		GCCollectionCount: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "gc_collection_total"),
			"gc_collection_total",
			[]string{"collector"},
			nil,
		),
		ProcessOpenFileDescriptors: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "process_open_filedescriptors"),
			"process_open_filedescriptors",
			nil,
			nil,
		),
		ProcessMaxFileDescriptors: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "process_max_filedescriptors"),
			"process_max_filedescriptors",
			nil,
			nil,
		),
		ProcessMemTotalVirtualInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "process_mem_total_virtual_bytes"),
			"process_mem_total_virtual_bytes",
			nil,
			nil,
		),
		ProcessCPUTotalInMillis: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "process_cpu_total_seconds_total"),
			"process_cpu_total_seconds_total",
			nil,
			nil,
		),
		PipelineDuration: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "pipeline_duration_seconds_total"),
			"pipeline_duration_seconds_total",
			[]string{"pipeline"},
			nil,
		),
		PipelineEventsIn: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "pipeline_events_in_total"),
			"pipeline_events_in_total",
			[]string{"pipeline"},
			nil,
		),
		PipelineEventsFiltered: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "pipeline_events_filtered_total"),
			"pipeline_events_filtered_total",
			[]string{"pipeline"},
			nil,
		),
		PipelineEventsOut: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "pipeline_events_out_total"),
			"pipeline_events_out_total",
			[]string{"pipeline"},
			nil,
		),
		PipelinePluginEventsDuration: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "plugin_duration_seconds_total"),
			"plugin_duration_seconds",
			[]string{"pipeline", "plugin", "plugin_id", "plugin_type"},
			nil,
		),
		PipelinePluginEventsIn: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "plugin_events_in_total"),
			"plugin_events_in",
			[]string{"pipeline", "plugin", "plugin_id", "plugin_type"},
			nil,
		),
		PipelinePluginEventsOut: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "plugin_events_out_total"),
			"plugin_events_out",
			[]string{"pipeline", "plugin", "plugin_id", "plugin_type"},
			nil,
		),
		PipelinePluginMatches: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "plugin_matches_total"),
			"plugin_matches",
			[]string{"pipeline", "plugin", "plugin_id", "plugin_type"},
			nil,
		),
		PipelinePluginFailures: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "plugin_failures_total"),
			"plugin_failures",
			[]string{"pipeline", "plugin", "plugin_id", "plugin_type"},
			nil,
		),
		PipelineQueueEvents: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "queue_events"),
			"queue_events",
			[]string{"pipeline"},
			nil,
		),
		PipelineQueuePageCapacity: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "queue_page_capacity_bytes"),
			"queue_page_capacity_bytes",
			[]string{"pipeline"},
			nil,
		),
		PipelineQueueMaxQueueSize: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "queue_max_size_bytes"),
			"queue_max_size_bytes",
			[]string{"pipeline"},
			nil,
		),
		PipelineQueueMaxUnreadEvents: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "queue_max_unread_events"),
			"queue_max_unread_events",
			[]string{"pipeline"},
			nil,
		),
		PipelineDeadLetterQueueSizeInBytes: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "dead_letter_queue_size_bytes"),
			"dead_letter_queue_size_bytes",
			[]string{"pipeline"},
			nil,
		),
	}, nil
}