code: public Metric createMetric(String metricName) {
      // [START createMetric]
      MetricInfo metricInfo = MetricInfo.of(metricName, "severity>=ERROR");
      Metric metric = logging.create(metricInfo);
      // [END createMetric]
      return metric;
    }
docs: [VARIABLE "my_metric_name"]