All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.signalfx.metrics.connection.HttpEventProtobufReceiverConnectionV2 Maven / Gradle / Ivy

The newest version!
package com.signalfx.metrics.connection;

import java.util.List;

import com.signalfx.shaded.apache.http.HttpEntity;
import com.signalfx.shaded.apache.http.conn.HttpClientConnectionManager;
import com.signalfx.shaded.apache.http.entity.ByteArrayEntity;

import com.signalfx.endpoint.SignalFxReceiverEndpoint;
import com.signalfx.metrics.protobuf.SignalFxProtocolBuffers;

public class HttpEventProtobufReceiverConnectionV2
        extends AbstractHttpEventProtobufReceiverConnection {
    public HttpEventProtobufReceiverConnectionV2(
            SignalFxReceiverEndpoint endpoint, int timeoutMs,
            HttpClientConnectionManager httpClientConnectionManager) {
        super(endpoint, timeoutMs, httpClientConnectionManager);
    }

    public HttpEventProtobufReceiverConnectionV2(
            SignalFxReceiverEndpoint endpoint, int timeoutMs, int maxRetries,
            HttpClientConnectionManager httpClientConnectionManager) {
        super(endpoint, timeoutMs, maxRetries, httpClientConnectionManager);
    }

    @Override
    protected String getEndpointForAddEvents() {
        return "/v2/event";
    }

    @Override
    protected HttpEntity getEntityForVersion(List events) {
        byte[] bodyBytes = SignalFxProtocolBuffers.EventUploadMessage.newBuilder()
                .addAllEvents(events).build().toByteArray();
        return new ByteArrayEntity(bodyBytes, PROTO_TYPE);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy