diff --git a/source/plugins/go/src/oms.go b/source/plugins/go/src/oms.go index 8c7695346..fbee1dd75 100644 --- a/source/plugins/go/src/oms.go +++ b/source/plugins/go/src/oms.go @@ -1229,6 +1229,10 @@ func PostDataHelper(tailPluginRecords []map[interface{}]interface{}) int { maxLatencyContainer = name + "=" + id } } + } else { + ContainerLogTelemetryMutex.Lock() + ContainerLogRecordCountWithEmptyTimeStamp += 1 + ContainerLogTelemetryMutex.Unlock() } } diff --git a/source/plugins/go/src/telemetry.go b/source/plugins/go/src/telemetry.go index 31818dbb3..b344f4ac8 100644 --- a/source/plugins/go/src/telemetry.go +++ b/source/plugins/go/src/telemetry.go @@ -50,6 +50,8 @@ var ( ContainerLogsSendErrorsToADXFromFluent float64 //Tracks the number of ADX client create errors for containerlogs (uses ContainerLogTelemetryTicker) ContainerLogsADXClientCreateErrors float64 + //Tracks the number of container log records with empty Timestamp (uses ContainerLogTelemetryTicker) + ContainerLogRecordCountWithEmptyTimeStamp float64 //Tracks the number of OSM namespaces and sent only from prometheus sidecar (uses ContainerLogTelemetryTicker) OSMNamespaceCount int //Tracks whether monitor kubernetes pods is set to true and sent only from prometheus sidecar (uses ContainerLogTelemetryTicker) @@ -82,6 +84,7 @@ const ( metricNameErrorCountKubeMonEventsMDSDClientCreateError = "KubeMonEventsMDSDClientCreateErrorsCount" metricNameErrorCountContainerLogsSendErrorsToADXFromFluent = "ContainerLogs2ADXSendErrorCount" metricNameErrorCountContainerLogsADXClientCreateError = "ContainerLogsADXClientCreateErrorCount" + metricNameContainerLogRecordCountWithEmptyTimeStamp = "ContainerLogRecordCountWithEmptyTimeStamp" defaultTelemetryPushIntervalSeconds = 300 @@ -125,6 +128,7 @@ func SendContainerLogPluginMetrics(telemetryPushIntervalProperty string) { promMonitorPodsNamespaceLength := PromMonitorPodsNamespaceLength promMonitorPodsLabelSelectorLength := PromMonitorPodsLabelSelectorLength promMonitorPodsFieldSelectorLength := PromMonitorPodsFieldSelectorLength + containerLogRecordCountWithEmptyTimeStamp := ContainerLogRecordCountWithEmptyTimeStamp TelegrafMetricsSentCount = 0.0 TelegrafMetricsSendErrorCount = 0.0 @@ -142,6 +146,7 @@ func SendContainerLogPluginMetrics(telemetryPushIntervalProperty string) { ContainerLogsADXClientCreateErrors = 0.0 InsightsMetricsMDSDClientCreateErrors = 0.0 KubeMonEventsMDSDClientCreateErrors = 0.0 + ContainerLogRecordCountWithEmptyTimeStamp = 0.0 ContainerLogTelemetryMutex.Unlock() if strings.Compare(strings.ToLower(os.Getenv("CONTROLLER_TYPE")), "daemonset") == 0 { @@ -222,6 +227,9 @@ func SendContainerLogPluginMetrics(telemetryPushIntervalProperty string) { if kubeMonEventsMDSDClientCreateErrors > 0.0 { TelemetryClient.Track(appinsights.NewMetricTelemetry(metricNameErrorCountKubeMonEventsMDSDClientCreateError, kubeMonEventsMDSDClientCreateErrors)) } + if ContainerLogRecordCountWithEmptyTimeStamp > 0.0 { + TelemetryClient.Track(appinsights.NewMetricTelemetry(metricNameContainerLogRecordCountWithEmptyTimeStamp, containerLogRecordCountWithEmptyTimeStamp)) + } start = time.Now() }