mesosphere / marathon

Deploy and manage containers (including Docker) on top of Apache Mesos at scale.
https://mesosphere.github.io/marathon/
Apache License 2.0
4.07k stars 845 forks source link

Events are too big and hard to parse #4947

Closed janisz closed 7 years ago

janisz commented 7 years ago

Events should:

  1. be flat (without nested objects)
  2. fit in 100B JSON message

We can achieve both by removing DeploymentPlan from events and stick only with DeploymentPlan.Id.

Below you can see how we should change events. Unfortunately change won't be backward compatible.

```diff diff --git a/src/main/scala/mesosphere/marathon/core/event/Events.scala b/src/main/scala/mesosphere/marathon/core/event/Events.scala index e9995a7..3b4eaad 100644 --- a/src/main/scala/mesosphere/marathon/core/event/Events.scala +++ b/src/main/scala/mesosphere/marathon/core/event/Events.scala @@ -2,15 +2,12 @@ package mesosphere.marathon.core.event import akka.event.EventStream import mesosphere.marathon.core.condition.Condition -import mesosphere.marathon.core.health.HealthCheck +import mesosphere.marathon.core.instance.Instance import mesosphere.marathon.core.instance.update.InstanceChange import mesosphere.marathon.core.task.Task -import mesosphere.marathon.core.instance.Instance -import mesosphere.marathon.state.{ AppDefinition, PathId, Timestamp } -import mesosphere.marathon.upgrade.{ DeploymentPlan, DeploymentStep } -import org.apache.mesos.{ Protos => Mesos } - -import scala.collection.immutable.Seq +import mesosphere.marathon.state.{PathId, Timestamp} +import mesosphere.marathon.upgrade.DeploymentStep +import org.apache.mesos.{Protos => Mesos} sealed trait MarathonEvent { val eventType: String @@ -22,7 +19,6 @@ sealed trait MarathonEvent { case class ApiPostEvent( clientIp: String, uri: String, - appDefinition: AppDefinition, eventType: String = "api_post_event", timestamp: String = Timestamp.now().toString) extends MarathonEvent @@ -107,7 +103,8 @@ sealed trait MarathonHealthCheckEvent extends MarathonEvent { case class AddHealthCheck( appId: PathId, version: Timestamp, - healthCheck: HealthCheck, + healthCheckProtocol: String, + healthCheckPortIndex: Int, eventType: String = "add_health_check_event", timestamp: String = Timestamp.now().toString) extends MarathonHealthCheckEvent @@ -121,7 +118,8 @@ case class RemoveHealthCheck( case class FailedHealthCheck( appId: PathId, instanceId: Instance.Id, - healthCheck: HealthCheck, + healthCheckProtocol: String, + healthCheckPortIndex: Int, eventType: String = "failed_health_check_event", timestamp: String = Timestamp.now().toString) extends MarathonHealthCheckEvent @@ -170,31 +168,29 @@ case class GroupChangeFailed( case class DeploymentSuccess( id: String, - plan: DeploymentPlan, eventType: String = "deployment_success", timestamp: String = Timestamp.now().toString) extends UpgradeEvent case class DeploymentFailed( id: String, - plan: DeploymentPlan, eventType: String = "deployment_failed", timestamp: String = Timestamp.now().toString) extends UpgradeEvent case class DeploymentStatus( - plan: DeploymentPlan, + id: String, currentStep: DeploymentStep, eventType: String = "deployment_info", timestamp: String = Timestamp.now().toString) extends UpgradeEvent case class DeploymentStepSuccess( - plan: DeploymentPlan, - currentStep: DeploymentStep, + id: String, + currentStepId: String, eventType: String = "deployment_step_success", timestamp: String = Timestamp.now().toString) extends UpgradeEvent case class DeploymentStepFailure( - plan: DeploymentPlan, - currentStep: DeploymentStep, + id: String, + currentStepId: String, eventType: String = "deployment_step_failure", timestamp: String = Timestamp.now().toString) extends UpgradeEvent @@ -206,19 +202,6 @@ case class AppTerminatedEvent( eventType: String = "app_terminated_event", timestamp: String = Timestamp.now().toString) extends MarathonEvent -case class MesosStatusUpdateEvent( - slaveId: String, - taskId: Task.Id, - taskStatus: Mesos.TaskState, - message: String, - appId: PathId, - host: String, - ipAddresses: Seq[org.apache.mesos.Protos.NetworkInfo.IPAddress], - ports: Seq[Int], - version: String, - eventType: String = "status_update_event", - timestamp: String = Timestamp.now().toString) extends MarathonEvent - /** Event indicating a status change for a known instance */ case class InstanceChanged( id: Instance.Id, ```

Original: https://github.com/mesosphere/marathon/issues/3154

meichstedt commented 7 years ago

Note: This issue has been migrated to https://jira.mesosphere.com/browse/MARATHON-4510. For more information see https://groups.google.com/forum/#!topic/marathon-framework/khtvf-ifnp8.