### Question:
TaskMetricGroup extends ComponentMetricGroup<TaskManagerJobMetricGroup> { public OperatorMetricGroup getOrAddOperator(String name) { return getOrAddOperator(OperatorID.fromJobVertexID(vertexId), name); } TaskMetricGroup(
			MetricRegistry registry,
			TaskManagerJobMetricGroup parent,
			@Nullable JobVertexID vertexId,
			AbstractID executionId,
			@Nullable String taskName,
			int subtaskIndex,
			int attemptNumber); final TaskManagerJobMetricGroup parent(); AbstractID executionId(); @Nullable AbstractID vertexId(); @Nullable String taskName(); int subtaskIndex(); int attemptNumber(); TaskIOMetricGroup getIOMetricGroup(); OperatorMetricGroup getOrAddOperator(String name); OperatorMetricGroup getOrAddOperator(OperatorID operatorID, String name); @Override void close();  }### Answer:
@Test public void testOperatorNameTruncation() throws Exception { Configuration cfg = new Configuration(); cfg.setString(MetricOptions.SCOPE_NAMING_OPERATOR, ScopeFormat.SCOPE_OPERATOR_NAME); MetricRegistryImpl registry = new MetricRegistryImpl(MetricRegistryConfiguration.fromConfiguration(cfg)); TaskManagerMetricGroup tm = new TaskManagerMetricGroup(registry, "host", "id"); TaskManagerJobMetricGroup job = new TaskManagerJobMetricGroup(registry, tm, new JobID(), "jobname"); TaskMetricGroup taskMetricGroup = new TaskMetricGroup(registry, job, new JobVertexID(), new AbstractID(), "task", 0, 0); String originalName = new String(new char[100]).replace("\0", "-"); OperatorMetricGroup operatorMetricGroup = taskMetricGroup.getOrAddOperator(originalName); String storedName = operatorMetricGroup.getScopeComponents()[0]; Assert.assertEquals(TaskMetricGroup.METRICS_OPERATOR_NAME_MAX_LENGTH, storedName.length()); Assert.assertEquals(originalName.substring(0, TaskMetricGroup.METRICS_OPERATOR_NAME_MAX_LENGTH), storedName); registry.shutdown().get(); }