123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- #pragma once
- #include <util/generic/strbuf.h>
- namespace NMonitoring {
- namespace NFormatContenType {
- constexpr TStringBuf TEXT = "application/x-solomon-txt";
- constexpr TStringBuf JSON = "application/json";
- constexpr TStringBuf PROTOBUF = "application/x-solomon-pb";
- constexpr TStringBuf SPACK = "application/x-solomon-spack";
- constexpr TStringBuf PROMETHEUS = "text/plain";
- constexpr TStringBuf UNISTAT = "text/json";
- }
- namespace NFormatContentEncoding {
- constexpr TStringBuf IDENTITY = "identity";
- constexpr TStringBuf ZLIB = "zlib";
- constexpr TStringBuf LZ4 = "lz4";
- constexpr TStringBuf ZSTD = "zstd";
- }
- /**
- * Defines format types for metric encoders.
- */
- enum class EFormat {
- /**
- * Special case when it was not possible to determine format.
- */
- UNKNOWN,
- /**
- * Read more https://wiki.yandex-team.ru/solomon/api/dataformat/spackv1
- */
- SPACK,
- /**
- * Read more https://wiki.yandex-team.ru/solomon/api/dataformat/json
- */
- JSON,
- /**
- * Read more https://wiki.yandex-team.ru/golovan/userdocs/stat-handle
- */
- UNISTAT,
- /**
- * Simple protobuf format, only for testing purposes.
- */
- PROTOBUF,
- /**
- * Simple text representation, only for debug purposes.
- */
- TEXT,
- /**
- * Prometheus text-based format
- */
- PROMETHEUS,
- };
- /**
- * Defines compression algorithms for metric encoders.
- */
- enum class ECompression {
- /**
- * Special case when it was not possible to determine compression.
- */
- UNKNOWN,
- /**
- * Means no compression.
- */
- IDENTITY,
- /**
- * Using the zlib structure (defined in RFC 1950), with the
- * deflate compression algorithm and Adler32 checkums.
- */
- ZLIB,
- /**
- * Using LZ4 compression algorithm (read http://lz4.org for more info)
- * with XxHash32 checksums.
- */
- LZ4,
- /**
- * Using Zstandard compression algorithm (read http://zstd.net for more
- * info) with XxHash32 checksums.
- */
- ZSTD,
- };
- enum class EMetricsMergingMode {
- /**
- * Do not merge metric batches. If several points of the same metric were
- * added multiple times accross different writes, paste them as
- * separate metrics.
- *
- * Example:
- * COUNTER [(ts1, val1)] | COUNTER [(ts1, val1)]
- * COUNTER [(ts2, val2)] | --> COUNTER [(ts2, val2)]
- * COUNTER [(ts3, val3)] | COUNTER [(ts3, val3)]
- */
- DEFAULT,
- /**
- * If several points of the same metric were added multiple times across
- * different writes, merge all values to one timeseries.
- *
- * Example:
- * COUNTER [(ts1, val1)] |
- * COUNTER [(ts2, val2)] | --> COUNTER [(ts1, val1), (ts2, val2), (ts3, val3)]
- * COUNTER [(ts3, val3)] |
- */
- MERGE_METRICS,
- };
- /**
- * Matches serialization format by the given "Accept" header value.
- *
- * @param value value of the "Accept" header.
- * @return most preffered serialization format type
- */
- EFormat FormatFromAcceptHeader(TStringBuf value);
- /**
- * Matches serialization format by the given "Content-Type" header value
- *
- * @param value value of the "Content-Type" header
- * @return message format
- */
- EFormat FormatFromContentType(TStringBuf value);
- /**
- * Returns value for "Content-Type" header determined by the given
- * format type.
- *
- * @param format serialization format type
- * @return mime-type indentificator
- * or empty string if format is UNKNOWN
- */
- TStringBuf ContentTypeByFormat(EFormat format);
- /**
- * Matches compression algorithm by the given "Accept-Encoding" header value.
- *
- * @param value value of the "Accept-Encoding" header.
- * @return most preffered compression algorithm
- */
- ECompression CompressionFromAcceptEncodingHeader(TStringBuf value);
- /**
- * Matches compression algorithm by the given "Content-Encoding" header value.
- *
- * @param value value of the "Accept-Encoding" header.
- * @return most preffered compression algorithm
- */
- ECompression CompressionFromContentEncodingHeader(TStringBuf value);
- /**
- * Returns value for "Content-Encoding" header determined by the given
- * compression algorithm.
- *
- * @param compression encoding compression alg
- * @return media-type compresion algorithm
- * or empty string if compression is UNKNOWN
- */
- TStringBuf ContentEncodingByCompression(ECompression compression);
- }
|