Skip to content

Commit

Permalink
fix(core): too many metrics are created with task_id that overflow me…
Browse files Browse the repository at this point in the history
…trics server
  • Loading branch information
tchiotludo committed Apr 29, 2022
1 parent 7fe8adb commit c5e81db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
4 changes: 0 additions & 4 deletions core/src/main/java/io/kestra/core/metrics/MetricRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ public class MetricRegistry {
public final static String SCHEDULER_EXECUTION_RUNNING_DURATION = "scheduler.execution.running.duration";
public final static String SCHEDULER_EXECUTION_MISSING_DURATION = "scheduler.execution.missing.duration";

public final static String TAG_TASK_ID = "task_id";
public final static String TAG_TASK_TYPE = "task_type";
public final static String TAG_FLOW_ID = "flow_id";
public final static String TAG_NAMESPACE_ID = "namespace_id";
public final static String TAG_TRIGGER_ID = "trigger_id";
public final static String TAG_STATE = "state";
public final static String TAG_ATTEMPT_COUNT = "attempt_count";
public final static String TAG_VALUE = "value";

@Inject
private MeterRegistry meterRegistry;
Expand Down Expand Up @@ -153,7 +151,6 @@ public String[] tags(WorkerTaskResult workerTaskResult, String... tags) {
tags,
TAG_NAMESPACE_ID, workerTaskResult.getTaskRun().getNamespace(),
TAG_FLOW_ID, workerTaskResult.getTaskRun().getFlowId(),
TAG_TASK_ID, workerTaskResult.getTaskRun().getTaskId(),
TAG_STATE, workerTaskResult.getTaskRun().getState().getCurrent().name()
);
}
Expand All @@ -166,7 +163,6 @@ public String[] tags(WorkerTaskResult workerTaskResult, String... tags) {
*/
public String[] tags(Task task) {
return new String[]{
TAG_TASK_ID, task.getId(),
TAG_TASK_TYPE, task.getType(),
};
}
Expand Down
14 changes: 0 additions & 14 deletions core/src/main/java/io/kestra/core/runners/RunContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,20 +548,6 @@ private Map<String, String> metricsTags() {
.put(MetricRegistry.TAG_NAMESPACE_ID, ((Map<String, String>) this.variables.get("flow")).get("namespace"));
}

if (this.variables.containsKey("task")) {
builder
.put(MetricRegistry.TAG_TASK_ID, ((Map<String, String>) this.variables.get("task")).get("id"))
.put(MetricRegistry.TAG_TASK_TYPE, ((Map<String, String>) this.variables.get("task")).get("type"));
}

if (this.variables.containsKey("taskrun")) {
Map<String, String> taskrun = (Map<String, String>) this.variables.get("taskrun");

if (taskrun.containsValue("value")) {
builder.put(MetricRegistry.TAG_VALUE, taskrun.get("value"));
}
}

return builder.build();
}

Expand Down

0 comments on commit c5e81db

Please sign in to comment.