forked from newrelic/go-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_events.go
36 lines (28 loc) · 966 Bytes
/
custom_events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package internal
import "time"
type customEvents struct {
*analyticsEvents
}
func newCustomEvents(max int) *customEvents {
return &customEvents{
analyticsEvents: newAnalyticsEvents(max),
}
}
func (cs *customEvents) Add(e *CustomEvent) {
// For the Go Agent, customEvents are added to the application, not the transaction.
// As a result, customEvents do not inherit their priority from the transaction, though
// they are still sampled according to priority sampling.
priority := NewPriority()
cs.addEvent(analyticsEvent{priority, e})
}
func (cs *customEvents) MergeIntoHarvest(h *Harvest) {
h.CustomEvents.mergeFailed(cs.analyticsEvents)
}
func (cs *customEvents) Data(agentRunID string, harvestStart time.Time) ([]byte, error) {
return cs.CollectorJSON(agentRunID)
}
func (cs *customEvents) EndpointMethod() string {
return cmdCustomEvents
}