Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAMZA-2412 : Adding SamzaContainer metric that is 0 when container-starting, 1 when started. #1228

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ class SamzaContainer(
containerListener.afterStart()
}
metrics.containerStartupTime.set((System.nanoTime() - startTime)/1000000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use (container-startup-time) metric instead to infer if the container has started?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can but its relatively harder to automate since we need to look for changes

metrics.containerStarted.set(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but curious what will be the behavior of the auto sizing controller if this metric is broken. Wondering if it can differentiate between metrics broken vs container not started.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this (or another similar metric) the controller has no way of figuring out that a container has finished state-restore, upto which point any input-lag increase does not warrant scale-up

if (taskInstances.size > 0)
runLoop.run
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SamzaContainerMetrics(
val diskQuotaBytes = newGauge("disk-quota-bytes", Long.MaxValue)
val executorWorkFactor = newGauge("executor-work-factor", 1.0)
val physicalMemoryMb = newGauge[Double]("physical-memory-mb", 0.0F)
val containerStarted = newGauge[Long]("container-started", 0L)

val taskStoreRestorationMetrics: util.Map[TaskName, Gauge[Long]] = new util.HashMap[TaskName, Gauge[Long]]()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class TestSamzaContainer extends AssertionsForJUnit with MockitoSugar {
MockitoAnnotations.initMocks(this)
setupSamzaContainer(Some(this.applicationContainerContext))
when(this.metrics.containerStartupTime).thenReturn(mock[Gauge[Long]])
when(this.metrics.containerStarted).thenReturn(mock[Gauge[Long]])
}

@Test
Expand Down