Pushes all metrics in a Collector, replacing all those with the same job and no grouping key.
<p>
This is useful for pushing a single Gauge.
<p>
This uses the PUT HTTP method.
491613
public void push(Collector collector, String job) throws IOException {
    CollectorRegistry registry = new CollectorRegistry();
    collector.register(registry);
    push(registry, job);
  }
1334011
public void add(Metrics m) {
        timeCount += m.timeCount;
        readingTimeCount += m.readingTimeCount;
        nodes += m.nodes;
        backtracks += m.backtracks;
        fails += m.fails;
        restarts += m.restarts;
    }
669328
@SuppressWarnings("rawtypes")
   protected void doPushState()
   {
      final boolean debugEnabled = LOG.isDebugEnabled();

      if (debugEnabled)
      {
         LOG.debug("start pushing in-memory state to cache cacheLoader collection");
      }

      Map<String, ChangesFilterListsWrapper> changesMap = new HashMap<String, ChangesFilterListsWrapper>();
      List<ChangesKey> processedItemKeys = new ArrayList<ChangesKey>();

      DataContainer dc = ctx.getCache().getAdvancedCache().getDataContainer();
      Set keys = dc.keySet();
      InternalCacheEntry entry;
      // collect all cache entries into the following map:
      // <WS ID> : <Contracted lists of added/removed nodes>
      for (Object k : keys)
      {
         if ((entry = dc.get(k)) != null)
         {
            if (entry.getValue() instanceof ChangesFilterListsWrapper && entry.getKey() instanceof ChangesKey)
            {
               if (debugEnabled)
               {
                  LOG.debug("Received list wrapper, start indexing...");
               }
               // get stale List that was not processed
               ChangesFilterListsWrapper staleListIncache = (ChangesFilterListsWrapper)entry.getValue();
               ChangesKey key = (ChangesKey)entry.getKey();
               // get newly created wrapper instance
               ChangesFilterListsWrapper listToPush = changesMap.get(key.getWsId());
               if (listToPush == null)
               {
                  listToPush =
                     new ChangesFilterListsWrapper(new HashSet<String>(), new HashSet<String>(), new HashSet<String>(),
                        new HashSet<String>());
                  changesMap.put(key.getWsId(), listToPush);
               }
               // copying lists into the new wrapper
               if (staleListIncache.getParentAddedNodes() != null)
                  listToPush.getParentAddedNodes().addAll(staleListIncache.getParentAddedNodes());
               if (staleListIncache.getParentRemovedNodes() != null)
                  listToPush.getParentRemovedNodes().addAll(staleListIncache.getParentRemovedNodes());

               if (staleListIncache.getAddedNodes() != null)
                  listToPush.getAddedNodes().addAll(staleListIncache.getAddedNodes());
               if (staleListIncache.getRemovedNodes() != null)
                  listToPush.getRemovedNodes().addAll(staleListIncache.getRemovedNodes());
               processedItemKeys.add(key);
            }
         }

      }

      // process all lists for each workspace
      for (Entry<String, ChangesFilterListsWrapper> changesEntry : changesMap.entrySet())
      {
         // create key based on wsId and generated id
         ChangesKey changesKey = new ChangesKey(changesEntry.getKey(), IdGenerator.generate());
         ctx.getCache().putAsync(changesKey, changesEntry.getValue());
      }

      for (ChangesKey key : processedItemKeys)
      {
         ctx.getCache().removeAsync(key);
      }

      if (debugEnabled)
      {
         LOG.debug("in-memory state passed to cache cacheStore successfully");
      }
   }
1155926
def log_metrics(self, metrics_by_name, info):
        
        if self.metrics is None:
            # If, for whatever reason, the metrics collection has not been set
            # do not try to save anything there.
            return
        for key in metrics_by_name:
            query = {"run_id": self.run_entry['_id'],
                     "name": key}
            push = {"steps": {"$each": metrics_by_name[key]["steps"]},
                    "values": {"$each": metrics_by_name[key]["values"]},
                    "timestamps": {"$each": metrics_by_name[key]["timestamps"]}
                    }
            update = {"$push": push}
            result = self.metrics.update_one(query, update, upsert=True)
            if result.upserted_id is not None:
                # This is the first time we are storing this metric
                info.setdefault("metrics", []) \
                    .append({"name": key, "id": str(result.upserted_id)})
1262697
public void push(E ele) {
        if (mElements.size() > mSize)
            mElements.set(mSize, ele);
        else
            mElements.add(ele);
        mSize++;
    }
852773
def push_all(self, record_shard_pairs):
        
        # Faster than inserting one at a time; the heap is sorted once after all inserts.
        for record, shard in record_shard_pairs:
            item = heap_item(self.clock, record, shard)
            self.heap.append(item)
        heapq.heapify(self.heap)
976707
private final void push() {
    if (ptr >= stack.length) {
      // doubling here is probably overkill, but anything that needs to double more than
      // once (32 levels deep) is very atypical anyway.
      byte[] newstack = new byte[stack.length<<1];
      System.arraycopy(stack,0,newstack,0,stack.length);
      stack = newstack;
    }
    stack[ptr++] = state;
  }
503180
def put(self, data):
        
        if not isinstance(data, list):
            data = [data]

        r = collections.defaultdict(list)

        for d in data:
            metric_type = d.pop('type', None)
            if metric_type is None:
                raise HawkularError('Undefined MetricType')
            r[metric_type].append(d)

        # This isn't transactional, but .. ouh well. One can always repost everything.
        for l in r:
            self._post(self._get_metrics_raw_url(self._get_url(l)), r[l],parse_json=False)
1215476
public void release()
    {
        for(String name : allMetrics) 
        {
            Metrics.defaultRegistry().removeMetric(factory.createMetricName(name));
        }
        // latency metrics contain multiple metrics internally and need to be released manually
        readLatency.release();
        writeLatency.release();
        rangeLatency.release();
    }
127851
@Deprecated
  public void push(CollectorRegistry registry, String job, String instance) throws IOException {
    push(registry, job, Collections.singletonMap("instance", instance));
  }
593514
public void push()
    {
        Map<String, Iterable<? extends WindupVertexFrame>> newFrame = new HashMap<>();
        deque.push(newFrame);
    }
837087
public void push(long x) {
    if (this.queueSize == this.maxSize) {
      assert this.last == this.first;
      this.sumOfQueue -= this.elems.get(this.last);
      if ((++this.last) == this.maxSize)
        this.last = 0;
    } else
      this.queueSize++;
    this.sumOfQueue += x;
    this.elems.set(this.first, x);
    if ((++this.first) == this.maxSize) {
      this.first = 0;
      this.last = 0;
    }
  }
833908
@Scheduled(fixedRateString = "${hystrix.stream.queue.sendRate:${hystrix.stream.queue.send-rate:500}}")
	public void sendMetrics() {
		ArrayList<String> metrics = new ArrayList<>();
		this.jsonMetrics.drainTo(metrics);

		if (!metrics.isEmpty()) {
			if (log.isTraceEnabled()) {
				log.trace("sending stream metrics size: " + metrics.size());
			}
			for (String json : metrics) {
				// TODO: batch all metrics to one message
				try {
					// TODO: remove the explicit content type when s-c-stream can handle
					// that for us
					this.outboundChannel.send(MessageBuilder.withPayload(json)
							.setHeader(MessageHeaders.CONTENT_TYPE,
									this.properties.getContentType())
							.build());
				}
				catch (Exception ex) {
					if (log.isTraceEnabled()) {
						log.trace("failed sending stream metrics: " + ex.getMessage());
					}
				}
			}
		}
	}
218039
public synchronized void pushMetric(final MetricsRecord mr) {
    if (changed) {
      try {
        mr.setMetric(getName(), value);
      } catch (Exception e) {
        LOG.info("pushMetric failed for " + getName() + "\n" +
            StringUtils.stringifyException(e));
      }
    }
    changed = false;
  }
505706
public final void push(String s)
  {

    if ((m_firstFree + 1) >= m_mapSize)
    {
      m_mapSize += m_blocksize;

      String newMap[] = new String[m_mapSize];

      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);

      m_map = newMap;
    }

    m_map[m_firstFree] = s;

    m_firstFree++;
  }
70353
@Override
  public void doUpdates(MetricsContext unused) {
    synchronized (this) {
      for (MetricsBase metricsBase : registry.getMetricsList()) {
        metricsBase.pushMetric(metricsRecord);
      }

      metricsRecord.setMetric("aveMapSlotRefillMsecs",
        tt.getAveMapSlotRefillMsecs());
      metricsRecord.setMetric("aveReduceSlotRefillMsecs",
        tt.getAveReduceSlotRefillMsecs());
      if (checkJvms) {
        checkAndSetJvms();
      }

      metricsRecord.setMetric("cgroup_memory_oom", tt.getCGroupOOM());
      metricsRecord.setMetric("maps_running", tt.getRunningMaps());
      metricsRecord.setMetric("reduces_running", tt.getRunningReduces());
      metricsRecord.setMetric("mapTaskSlots", (short)tt.getMaxActualMapTasks());
      metricsRecord.setMetric("reduceTaskSlots",
                                   (short)tt.getMaxActualReduceTasks());
      metricsRecord.incrMetric("map_tasks_completed",
          numCompletedMapTasks);
      metricsRecord.incrMetric("reduce_tasks_completed",
          numCompletedReduceTasks);
      metricsRecord.incrMetric("tasks_completed", numCompletedTasks);
      metricsRecord.incrMetric("tasks_failed_timeout", timedoutTasks);
      metricsRecord.incrMetric("tasks_failed_ping", tasksFailedPing);
      metricsRecord.incrMetric("tasks_disk_out_of_space", 
          numDiskOutOfSpaceTasks);
      metricsRecord.setMetric("unaccounted_memory", unaccountedMemory);
      metricsRecord.incrMetric("tasks_failed_to_add_cgroup", tt.getAndResetNumFailedToAddTaskToCGroup());
      metricsRecord.incrMetric("tasks_saved_by_cgroup", tt.getAndResetAliveTaskNumInCGroup());
      metricsRecord.setMetric("rss_memory_usage", tt.getTaskTrackerRSSMem());
      metricsRecord.incrMetric("tasks_cpu_saved_by_cgroup", tt.getAndResetAliveTasksCPUMSecs());
      
      for (int index = 0; index <tt.getKilledTaskRssBucketsNum(); ++ index) {
        String metricKey = "tasks_killed_group_by_rss_" + index;
        metricsRecord.incrMetric(metricKey, tt.getAndRestNumOfKilledTasksByRssBucket(index));
      }

      numCompletedMapTasks = 0;
      numCompletedReduceTasks = 0;
      numCompletedTasks = 0;
      timedoutTasks = 0;
      tasksFailedPing = 0;
      numDiskOutOfSpaceTasks = 0;
    }
    
    metricsRecord.update();
  }
811856
public void add(Metric m) {
        final MetricName key = m.getName();
        metrics_.put(key, m);
    }