Skip to content

Commit ec69667

Browse files
committed
Update to latest version of libbeat
1 parent cb0c046 commit ec69667

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

client.go

+12-10
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"net/url"
1111
"time"
1212

13-
"github.com/elastic/beats/libbeat/common"
1413
"github.com/elastic/beats/libbeat/logp"
14+
"github.com/elastic/beats/libbeat/outputs"
1515
"github.com/elastic/beats/libbeat/outputs/transport"
1616
)
1717

@@ -140,23 +140,23 @@ func (conn *Connection) Close() error {
140140
// PublishEvents posts all events to the http endpoint. On error a slice with all
141141
// events not published will be returned.
142142
func (client *Client) PublishEvents(
143-
events []common.MapStr,
144-
) ([]common.MapStr, error) {
143+
data []outputs.Data,
144+
) ([]outputs.Data, error) {
145145
begin := time.Now()
146146
publishEventsCallCount.Add(1)
147147

148-
if len(events) == 0 {
148+
if len(data) == 0 {
149149
return nil, nil
150150
}
151151

152152
if !client.connected {
153-
return events, ErrNotConnected
153+
return data, ErrNotConnected
154154
}
155155

156-
var failedEvents []common.MapStr
156+
var failedEvents []outputs.Data
157157

158158
sendErr := error(nil)
159-
for _, event := range events {
159+
for _, event := range data {
160160
sendErr = client.PublishEvent(event)
161161
// TODO more gracefully handle failures return the failed events
162162
// below instead of bailing out directly here:
@@ -166,10 +166,10 @@ func (client *Client) PublishEvents(
166166
}
167167

168168
debugf("PublishEvents: %d metrics have been published over HTTP in %v.",
169-
len(events),
169+
len(data),
170170
time.Now().Sub(begin))
171171

172-
ackedEvents.Add(int64(len(events) - len(failedEvents)))
172+
ackedEvents.Add(int64(len(data) - len(failedEvents)))
173173
eventsNotAcked.Add(int64(len(failedEvents)))
174174
if len(failedEvents) > 0 {
175175
return failedEvents, sendErr
@@ -178,11 +178,13 @@ func (client *Client) PublishEvents(
178178
return nil, nil
179179
}
180180

181-
func (client *Client) PublishEvent(event common.MapStr) error {
181+
func (client *Client) PublishEvent(data outputs.Data) error {
182182
if !client.connected {
183183
return ErrNotConnected
184184
}
185185

186+
event := data.Event
187+
186188
debugf("Publish event: %s", event)
187189

188190
status, _, err := client.request("POST", "", client.params, event)

http.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,17 @@ func (out *httpOutput) Close() error {
125125
func (out *httpOutput) PublishEvent(
126126
trans op.Signaler,
127127
opts outputs.Options,
128-
event common.MapStr,
128+
data outputs.Data,
129129
) error {
130-
return out.mode.PublishEvent(trans, opts, event)
130+
return out.mode.PublishEvent(trans, opts, data)
131131
}
132132

133133
func (out *httpOutput) BulkPublish(
134134
trans op.Signaler,
135135
opts outputs.Options,
136-
events []common.MapStr,
136+
data []outputs.Data,
137137
) error {
138-
return out.mode.PublishEvents(trans, opts, events)
138+
return out.mode.PublishEvents(trans, opts, data)
139139
}
140140

141141
func parseProxyURL(raw string) (*url.URL, error) {

0 commit comments

Comments
 (0)