@SuppressWarnings(value = "unchecked")
    public SampleFamily tag(Closure<?> cl) {
        if (this == EMPTY) {
            return EMPTY;
        }
        return SampleFamily.build(
            this.context,
            Arrays.stream(samples)
                  .map(sample -> {
                      Object delegate = new Object();
                      Closure<?> c = cl.rehydrate(delegate, sample, delegate);
                      Map<String, String> arg = Maps.newHashMap(sample.labels);
                      Object r = c.call(arg);
                      return sample.toBuilder()
                                   .labels(
                                       ImmutableMap.copyOf(
                                           Optional.ofNullable((r instanceof Map) ? (Map<String, String>) r : null)
                                                   .orElse(arg)))
                                   .build();
                  }).toArray(Sample[]::new)
        );
    }
Following operations are used in DSL
oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java