code: private static ReportingRule fromService(Service s, ReportingRule.MetricTest checkMetrics,
        ReportingRule.LabelTest checkLabels) {
      List<MonitoredResourceDescriptor> resourceDescs = s.getMonitoredResourcesList();
      Map<String, LabelDescriptor> labels = Maps.newHashMap();
      Set<String> logs = Sets.newHashSet();
      if (s.hasLogging()) {
        List<LoggingDestination> producers = s.getLogging().getProducerDestinationsList();
        logs = addLoggingDestinations(producers, resourceDescs, s.getLogsList(), labels, checkLabels);
      }
      Set<String> metrics = Sets.newHashSet();
      if (s.hasMonitoring()) {
        Monitoring monitoring = s.getMonitoring();
        addMonitoringDestinations(monitoring.getConsumerDestinationsList(), resourceDescs,
            s.getMetricsList(), metrics, checkMetrics, labels, checkLabels);
        addMonitoringDestinations(monitoring.getProducerDestinationsList(), resourceDescs,
            s.getMetricsList(), metrics, checkMetrics, labels, checkLabels);
      }
      return ReportingRule.fromKnownInputs(logs.toArray(new String[logs.size()]), metrics,
          labels.keySet());
    }
docs: 'Constructor' that uses a {@code Service}.
  
  @param s the {@code Service} whose metric, labels and logs configurations are used to configure
  the {@code ReportingRule}
  
  @param checkMetrics used to determine which {@code MetricDescriptors} are allowed
  @param checkLabels used to determine which {@code LabelDescriptors} are allowed
  
  @return {@code ReportingRule}