Code review comment: Okay, I added a test for this case as well. But this required adding the MonitoringInfoSpec for SampledByteCount, which I was going to do in this PR which is queued up after this one. But I have pulled it into this PR.  https://github.com/apache/beam/pull/8416/files

Code under review:
public void testMonitoringInfosArePopulatedForUserDistributions() {
    MetricsContainerImpl testObject = new MetricsContainerImpl("step1");
    DistributionCell c1 = testObject.getDistribution(MetricName.named("ns", "name1"));
    DistributionCell c2 = testObject.getDistribution(MetricName.named("ns", "name2"));
    c1.update(5L);
    c2.update(4L);

    SimpleMonitoringInfoBuilder builder1 = new SimpleMonitoringInfoBuilder();
    builder1
        .setUrn(MonitoringInfoConstants.Urns.USER_DISTRIBUTION_COUNTER)
        .setLabel(MonitoringInfoConstants.Labels.NAMESPACE, "ns")
        .setLabel(MonitoringInfoConstants.Labels.NAME, "name1")
        .setLabel(MonitoringInfoConstants.Labels.PTRANSFORM, "step1")
        .setInt64DistributionValue(DistributionData.create(5, 1, 5, 5));

    SimpleMonitoringInfoBuilder builder2 = new SimpleMonitoringInfoBuilder();
    builder2
        .setUrn(MonitoringInfoConstants.Urns.USER_DISTRIBUTION_COUNTER)
        .setLabel(MonitoringInfoConstants.Labels.NAMESPACE, "ns")
        .setLabel(MonitoringInfoConstants.Labels.NAME, "name2")
        .setLabel(MonitoringInfoConstants.Labels.PTRANSFORM, "step1")
        .setInt64DistributionValue(DistributionData.create(4, 1, 4, 4));

    ArrayList<MonitoringInfo> actualMonitoringInfos = new ArrayList<MonitoringInfo>();
    for (MonitoringInfo mi : testObject.getMonitoringInfos()) {
      actualMonitoringInfos.add(SimpleMonitoringInfoBuilder.copyAndClearTimestamp(mi));
    }

    assertThat(actualMonitoringInfos, containsInAnyOrder(builder1.build(), builder2.build()));
  }

Line commented on: DistributionCell c2 = testObject.getDistribution(MetricName.named("ns", "name2"));

Revised code:
public void testMonitoringInfosArePopulatedForUserDistributions() {
    MetricsContainerImpl testObject = new MetricsContainerImpl("step1");
    DistributionCell c1 = testObject.getDistribution(MetricName.named("ns", "name1"));
    DistributionCell c2 = testObject.getDistribution(MetricName.named("ns", "name2"));
    c1.update(5L);
    c2.update(4L);

    SimpleMonitoringInfoBuilder builder1 = new SimpleMonitoringInfoBuilder();
    builder1
        .setUrn(MonitoringInfoConstants.Urns.USER_DISTRIBUTION_COUNTER)
        .setLabel(MonitoringInfoConstants.Labels.NAMESPACE, "ns")
        .setLabel(MonitoringInfoConstants.Labels.NAME, "name1")
        .setLabel(MonitoringInfoConstants.Labels.PTRANSFORM, "step1")
        .setInt64DistributionValue(DistributionData.create(5, 1, 5, 5));

    SimpleMonitoringInfoBuilder builder2 = new SimpleMonitoringInfoBuilder();
    builder2
        .setUrn(MonitoringInfoConstants.Urns.USER_DISTRIBUTION_COUNTER)
        .setLabel(MonitoringInfoConstants.Labels.NAMESPACE, "ns")
        .setLabel(MonitoringInfoConstants.Labels.NAME, "name2")
        .setLabel(MonitoringInfoConstants.Labels.PTRANSFORM, "step1")
        .setInt64DistributionValue(DistributionData.create(4, 1, 4, 4));

    ArrayList<MonitoringInfo> actualMonitoringInfos = new ArrayList<MonitoringInfo>();
    for (MonitoringInfo mi : testObject.getMonitoringInfos()) {
      actualMonitoringInfos.add(SimpleMonitoringInfoBuilder.copyAndClearTimestamp(mi));
    }

    assertThat(actualMonitoringInfos, containsInAnyOrder(builder1.build(), builder2.build()));
  }