Sha256: edc42e1f570644ccb835ef499a1723c269cebc346f8a3c2d5fc88ef01e94868e
Contents?: true
Size: 875 Bytes
Versions: 4
Compression:
Stored size: 875 Bytes
Contents
# frozen_string_literal: true module ElasticAPM module Transport module Serializers # @api private class MetricsetSerializer < Serializer def build(metricset) payload = { timestamp: metricset.timestamp.to_i, samples: build_samples(metricset.samples) } if metricset.tags? payload[:tags] = mixed_object(metricset.tags) end if metricset.transaction payload[:transaction] = metricset.transaction end if metricset.span payload[:span] = metricset.span end { metricset: payload } end private def build_samples(samples) samples.each_with_object({}) do |(key, value), hsh| hsh[key] = { value: value } end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems