Records a data point.
@param name The name of the metric.
@param value The current value for that metric.
967145
public final void record(final String name, final Number value) {
    record(name, value.longValue(), null);
  }
752318
@RequestMapping(value = "/{name}", method = RequestMethod.DELETE)
	@ResponseStatus(HttpStatus.OK)
	protected void delete(@PathVariable("name") String name) {
		Metric<Double> c = findCounter(name);
		metricRepository.reset(c.getName());
	}
976734
private void reportSampled(final String name,
                              final Sampling sampled,
                              final boolean isDuration) {
      EnumSet<MetricField> fields = reportedMetrics.get(name);
      if(fields == null) {
         return;
      }

      String nrName = isDuration ? buildDuration(name) : buildName(name);

      if(fields.contains(MetricField.MEDIAN)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().getMedian());
      }

      if(fields.contains(MetricField.MAX)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().getMax());
      }

      if(fields.contains(MetricField.MIN)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().getMin());
      }

      if(fields.contains(MetricField.P75)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().get75thPercentile());
      }

      if(fields.contains(MetricField.P95)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().get95thPercentile());
      }

      if(fields.contains(MetricField.P98)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().get98thPercentile());
      }

      if(fields.contains(MetricField.P99)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().get99thPercentile());
      }

      if(fields.contains(MetricField.P999)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().get999thPercentile());
      }

      if(fields.contains(MetricField.STD)) {
         NewRelic.recordMetric(nrName, (float)sampled.getSnapshot().getStdDev());
      }
   }
82068
public static void label(final String name, final String value) {
        final Label label = new Label().setName(name).setValue(value);
        getLifecycle().updateTestCase(testResult -> testResult.getLabels().add(label));
    }
24472
public void addParameter( String name, String value )
    {
        if ( _additionalParameters == null )
        {
            _additionalParameters = new HashMap();
        }
        
        _additionalParameters.put( name, value );
    }
1089511
public static void set(String name, double value) {
    set(MonitorConfig.builder(name).build(), value);
  }
217788
public void setAttribute(String name, Object value) {
        createSessionIfNecessary();
        synchronized (this) {
            adaptee.setAttribute(name, value);
        }
    }
709177
protected void addMetric(String name, Metric metric) {
		if (metric == null) {
			LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name);
			return;
		}
		// add the metric only if the group is still open
		synchronized (this) {
			if (!closed) {
				// immediately put without a 'contains' check to optimize the common case (no collision)
				// collisions are resolved later
				Metric prior = metrics.put(name, metric);

				// check for collisions with other metric names
				if (prior == null) {
					// no other metric with this name yet

					if (groups.containsKey(name)) {
						// we warn here, rather than failing, because metrics are tools that should not fail the
						// program when used incorrectly
						LOG.warn("Name collision: Adding a metric with the same name as a metric subgroup: '" +
								name + "'. Metric might not get properly reported. " + Arrays.toString(scopeComponents));
					}

					registry.register(metric, name, this);
				}
				else {
					// we had a collision. put back the original value
					metrics.put(name, prior);

					// we warn here, rather than failing, because metrics are tools that should not fail the
					// program when used incorrectly
					LOG.warn("Name collision: Group already contains a Metric with the name '" +
							name + "'. Metric will not be reported." + Arrays.toString(scopeComponents));
				}
			}
		}
	}
500392
public void setParameter(String name, Object value) {
        parameters.put(name, value);
        transformation.addParameter(name, value);
    }
737222
public void setAttribute(String name, Object value) {
        if (attributes == null) {
            synchronized (this) {
                if (attributes == null) {
                    attributes = new ConcurrentHashMap<String, Object>(4);
                }
            }
        }
        this.attributes.put(name, value);
    }
1220372
public void add(String name, Object value) {
		if (value != null) {
			this.content.put(name, value);
		}
	}
1137216
synchronized void setProperty(final String name, final String value) {
        Hashtable<String, String> properties = new Hashtable<String, String>(this.properties);
        properties.put(name, value);

        this.properties = properties;
    }
1159972
@RequestMapping(value = "/{name}", method = RequestMethod.DELETE)
	@ResponseStatus(HttpStatus.OK)
	protected void delete(@PathVariable("name") String name) {
		FieldValueCounter counter = repository.findOne(name);
		if (counter == null) {
			throw new NoSuchMetricException(name);
		}
		repository.reset(name);
	}
1279050
public static void writeValue(JsonWriter writer, String name, String value) throws IOException {
        writer.name(name).value(value);
    }
547572
public void registerNewMetrics(MetricName name, Metric metric) {
		final Set<MetricName> registeredNames = getNames();
		if (!registeredNames.contains(name)) {
			try {
				register(name, metric);
			} catch (IllegalArgumentException e){/* exception due to race condition*/}
		}
	}
1135849
@SuppressWarnings("unchecked")
    public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
        if (metric instanceof MetricSet) {
            registerAll(name, (MetricSet) metric);
        } else {
            final Metric existing = metrics.putIfAbsent(name, metric);
            if (existing == null) {
                onMetricAdded(name, metric);
            } else {
                throw new IllegalArgumentException("A metric named " + name + " already exists");
            }
        }
        return metric;
    }
456839
public void writeNameValuePair(String name, Date value) throws IOException
   {
      internalWriteNameValuePair(name, m_format.format(value));
   }