@Override public String getLogPartition() { return String.format("%s:%s", super.getLogPartition(), getSystemTag(TAG_WORKER_ID)); } }
public WorkerLoggingContext(String namespaceId, String appId, String workerId, String runId, String instanceId) { super(namespaceId, appId, runId); setSystemTag(TAG_WORKER_ID, workerId); setInstanceId(instanceId); }
tags.get(ServiceLoggingContext.TAG_SERVICE_ID)); } else if (tags.containsKey(WorkerLoggingContext.TAG_WORKER_ID)) { return new WorkerLoggingContext(namespaceId, applicationId, tags.get(WorkerLoggingContext.TAG_WORKER_ID), tags.get(ApplicationLoggingContext.TAG_RUN_ID), tags.get(ApplicationLoggingContext.TAG_INSTANCE_ID));
public static LoggingContext getLoggingContext(String namespaceId, String applicationId, String entityId, ProgramType programType, @Nullable String runId, @Nullable Map<String, String> systemArgs) { switch (programType) { case WORKFLOW: return new WorkflowLoggingContext(namespaceId, applicationId, entityId, runId); case MAPREDUCE: if (systemArgs != null && systemArgs.containsKey("workflowRunId")) { String workflowRunId = systemArgs.get("workflowRunId"); String workflowId = systemArgs.get("workflowName"); return new WorkflowProgramLoggingContext(namespaceId, applicationId, workflowId, workflowRunId, programType, entityId, runId); } return new MapReduceLoggingContext(namespaceId, applicationId, entityId, runId); case SPARK: if (systemArgs != null && systemArgs.containsKey("workflowRunId")) { String workflowRunId = systemArgs.get("workflowRunId"); String workflowId = systemArgs.get("workflowName"); return new WorkflowProgramLoggingContext(namespaceId, applicationId, workflowId, workflowRunId, programType, entityId, runId); } return new SparkLoggingContext(namespaceId, applicationId, entityId, runId); case SERVICE: return new UserServiceLoggingContext(namespaceId, applicationId, entityId, "", runId, null); case WORKER: return new WorkerLoggingContext(namespaceId, applicationId, entityId, runId, null); default: throw new IllegalArgumentException(String.format("Illegal entity type for logging context: %s", programType)); } }
tags.get(ServiceLoggingContext.TAG_SERVICE_ID)); } else if (tags.containsKey(WorkerLoggingContext.TAG_WORKER_ID)) { return new WorkerLoggingContext(namespaceId, applicationId, tags.get(WorkerLoggingContext.TAG_WORKER_ID), tags.get(ApplicationLoggingContext.TAG_RUN_ID), tags.get(ApplicationLoggingContext.TAG_INSTANCE_ID));
public WorkerLoggingContext(String namespaceId, String appId, String workerId, String runId, String instanceId) { super(namespaceId, appId, runId); setSystemTag(TAG_WORKER_ID, workerId); setInstanceId(instanceId); }
@Override public String getLogPartition() { return String.format("%s:%s", super.getLogPartition(), getSystemTag(TAG_WORKER_ID)); } }
return new UserServiceLoggingContext(namespaceId, applicationId, entityId, "", runId, null); case WORKER: return new WorkerLoggingContext(namespaceId, applicationId, entityId, runId, null); default: throw new IllegalArgumentException(String.format("Illegal entity type for logging context: %s", programType));
private LoggingContext createLoggingContext(Id.Program programId, RunId runId) { return new WorkerLoggingContext(programId.getNamespaceId(), programId.getApplicationId(), programId.getId(), runId.getId(), String.valueOf(getInstanceId())); }
private LoggingContext createLoggingContext(Id.Program programId, RunId runId) { return new WorkerLoggingContext(programId.getNamespaceId(), programId.getApplicationId(), programId.getId(), runId.getId(), String.valueOf(getInstanceId())); }