Skip to content

Commit 2f2f2fa

Browse files
authored
[receiver/discovery] Remove log_endpoints config option (#4692)
The entity events now emitted regardless of log_endpoints config option. This helps to unify entity events reporting from one place instead of emitting them separately from the endpoint tracker (controlled by log_endpoints) and evaluators (emitted regardless)
1 parent 4a35536 commit 2f2f2fa

File tree

10 files changed

+7
-34
lines changed

10 files changed

+7
-34
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Emit entity events for discovered endpoints with log_endpoints: true ([#4684](https://github.com/signalfx/splunk-otel-collector/pull/4684))
99
- Ensure active endpoints emitted as entity events periodically ([#4684](https://github.com/signalfx/splunk-otel-collector/pull/4684))
1010
- Emit entity events only for matching receivers ([#4691](https://github.com/signalfx/splunk-otel-collector/pull/4691))
11+
- Remove `log_endpoints` config option ([#4692](https://github.com/signalfx/splunk-otel-collector/pull/4692))
1112

1213
### 💡 Enhancements 💡
1314

internal/receiver/discoveryreceiver/README.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,9 @@ component-level log statements are similarly intercepted by a log evaluator, and
1818
records based on the `status: statements` rules you define. The matching rules SHOULD NOT conflict with each other.
1919
The first matching rule in the list will be used to determine the status of the receiver.
2020

21-
The receiver also allows you to emit entity events for all
22-
[Endpoint](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/observer/endpoints.go)
23-
events from the specified `watch_observers`. This way you can report your environment as observed by platform-specific
24-
observers in real time, with or without discovering receiver statuses:
25-
26-
```yaml
27-
extensions:
28-
docker_observer:
29-
receivers:
30-
discovery:
31-
watch_observers: [docker_observer]
32-
log_endpoints: true
33-
exporters:
34-
debug:
35-
verbosity: detailed
36-
service:
37-
extensions: [docker_observer]
38-
pipelines:
39-
logs:
40-
receivers: [discovery]
41-
exporters: [debug]
42-
```
21+
The receiver emits entity events for
22+
[Endpoints](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/observer/endpoints.go)
23+
discovered by the specified `watch_observers` if they match a rule for any configured receiver.
4324

4425
```
4526
2024-04-17T19:53:24.285Z info LogsExporter {"kind": "exporter", "data_type": "logs", "name": "debug", "resource logs": 1, "log records": 2}
@@ -231,7 +212,6 @@ Flags: 0
231212
| Name | Type | Default | Docs |
232213
|------------------------------|---------------------------|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
233214
| `watch_observers` (required) | []string | <no value> | The array of Observer extensions to receive Endpoint events from |
234-
| `log_endpoints` | bool | false | Whether to emit all endpoint activity as entity events |
235215
| `embed_receiver_config` | bool | false | Whether to embed a base64-encoded, minimal Receiver Creator config for the generated receiver as a reported metrics `discovery.receiver.rule` resource attribute value for status log record matches |
236216
| `receivers` | map[string]ReceiverConfig | <no value> | The mapping of receiver names to their Receiver sub-config |
237217

internal/receiver/discoveryreceiver/config.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ type Config struct {
4646
// The configured Observer extensions from which to receive Endpoint events.
4747
// Must implement the observer.Observable interface.
4848
WatchObservers []component.ID `mapstructure:"watch_observers"`
49-
// Whether to emit all endpoint activity as entity events.
50-
LogEndpoints bool `mapstructure:"log_endpoints"`
5149
// Whether to include the receiver config as a base64-encoded "discovery.receiver.config"
5250
// resource attribute string value. Will also contain the configured observer that
5351
// produced the endpoint leading to receiver creation in `watch_observers`.

internal/receiver/discoveryreceiver/config_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func TestValidConfig(t *testing.T) {
100100
Rule: mustNewRule(`type == "container" && name matches "(?i)redis"`),
101101
},
102102
},
103-
LogEndpoints: false,
104103
EmbedReceiverConfig: true,
105104
CorrelationTTL: 25 * time.Second,
106105
WatchObservers: []component.ID{

internal/receiver/discoveryreceiver/endpoint_tracker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (et *endpointTracker) stop() {
113113
}
114114

115115
func (et *endpointTracker) emitEntityStateEvents(observerCID component.ID, endpoints []observer.Endpoint) {
116-
if et.config.LogEndpoints && et.pLogs != nil {
116+
if et.pLogs != nil {
117117
entityEvents, numFailed, err := entityStateEvents(observerCID, endpoints, time.Now())
118118
if err != nil {
119119
et.logger.Warn(fmt.Sprintf("failed converting %v endpoints to log records", numFailed), zap.Error(err))
@@ -125,7 +125,7 @@ func (et *endpointTracker) emitEntityStateEvents(observerCID component.ID, endpo
125125
}
126126

127127
func (et *endpointTracker) emitEntityDeleteEvents(endpoints []observer.Endpoint) {
128-
if et.config.LogEndpoints && et.pLogs != nil {
128+
if et.pLogs != nil {
129129
entityEvents := entityDeleteEvents(endpoints, time.Now())
130130
if entityEvents.Len() > 0 {
131131
et.pLogs <- entityEvents.ConvertAndMoveToLogs()

internal/receiver/discoveryreceiver/endpoint_tracker_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func TestUpdateEndpoints(t *testing.T) {
608608
require.NoError(t, component.UnmarshalConfig(cm, cfg))
609609

610610
logger := zap.NewNop()
611-
et := newEndpointTracker(nil, cfg, logger, make(chan plog.Logs), newCorrelationStore(logger, cfg.CorrelationTTL))
611+
et := newEndpointTracker(nil, cfg, logger, nil, newCorrelationStore(logger, cfg.CorrelationTTL))
612612
et.updateEndpoints(tt.endpoints, component.MustNewIDWithName("observer_type", "observer.name"))
613613

614614
var correlationsCount int
@@ -624,7 +624,6 @@ func TestUpdateEndpoints(t *testing.T) {
624624
func TestEntityEmittingLifecycle(t *testing.T) {
625625
logger := zap.NewNop()
626626
cfg := createDefaultConfig().(*Config)
627-
cfg.LogEndpoints = true
628627
cfg.Receivers = map[component.ID]ReceiverEntry{
629628
component.MustNewIDWithName("fake_receiver", ""): {
630629
Rule: mustNewRule(`type == "port" && pod.name == "pod.name" && port == 1`),

internal/receiver/discoveryreceiver/factory.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func NewFactory() receiver.Factory {
3636

3737
func createDefaultConfig() component.Config {
3838
return &Config{
39-
LogEndpoints: false,
4039
EmbedReceiverConfig: false,
4140
CorrelationTTL: 10 * time.Minute,
4241
}

internal/receiver/discoveryreceiver/factory_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ func TestCreateDefaultConfig(t *testing.T) {
3232
assert.NotNil(t, cfg, "failed to create default config")
3333
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
3434
require.Equal(t, &Config{
35-
LogEndpoints: false,
3635
EmbedReceiverConfig: false,
3736
CorrelationTTL: 10 * time.Minute,
3837
}, cfg)

internal/receiver/discoveryreceiver/testdata/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ discovery:
22
watch_observers:
33
- an_observer
44
- another_observer/with_name
5-
log_endpoints: false
65
embed_receiver_config: true
76
correlation_ttl: 25s
87
receivers:

tests/receivers/discovery/testdata/host_observer_endpoints_config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ extensions:
55

66
receivers:
77
discovery:
8-
log_endpoints: true
98
receivers:
109
hostmetrics:
1110
rule: type == "hostport"

0 commit comments

Comments
 (0)