public <T> OutputSampler<T> sampleOutput(String pcollectionId, Coder<T> coder) {
    return (OutputSampler<T>)
        outputSamplers.computeIfAbsent(
            pcollectionId,
            k ->
                new OutputSampler<>(
                    coder, this.maxSamples, this.sampleEveryN, this.onlySampleExceptions));
  }
@Test
  public void testMultipleOutputs() throws Exception {
    DataSampler sampler = new DataSampler();

    VarIntCoder coder = VarIntCoder.of();
    sampler.sampleOutput("pcollection-id-1", coder).sample(globalWindowedValue(1));
    sampler.sampleOutput("pcollection-id-2", coder).sample(globalWindowedValue(2));

    BeamFnApi.InstructionResponse samples = getAllSamples(sampler);
    assertHasSamples(samples, "pcollection-id-1", Collections.singleton(encodeInt(1)));
    assertHasSamples(samples, "pcollection-id-2", Collections.singleton(encodeInt(2)));
  }