Skip to content

Commit

Permalink
INFOPLAT-1468 Enable batching for beholder emitter (#15173)
Browse files Browse the repository at this point in the history
* Enable batching for beholder emitter

* Set defaults for Telemetry Emitter config

* MockCfgTelemetry implements Telemetry interface

* make config-docs

* Fix TestScripts

* Pull latest chainlink-common

* make gomodtidy

* Golang lint

* Fix tests
  • Loading branch information
pkcll authored Nov 11, 2024
1 parent 9ac601d commit 422e385
Show file tree
Hide file tree
Showing 35 changed files with 118 additions and 27 deletions.
2 changes: 2 additions & 0 deletions core/cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ func initGlobals(cfgProm config.Prometheus, cfgTracing config.Tracing, cfgTeleme
OtelExporterGRPCEndpoint: cfgTelemetry.OtelExporterGRPCEndpoint(),
ResourceAttributes: attributes,
TraceSampleRatio: cfgTelemetry.TraceSampleRatio(),
EmitterBatchProcessor: cfgTelemetry.EmitterBatchProcessor(),
EmitterExportTimeout: cfgTelemetry.EmitterExportTimeout(),
AuthPublicKeyHex: csaPubKeyHex,
AuthHeaders: beholderAuthHeaders,
}
Expand Down
4 changes: 4 additions & 0 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,10 @@ CACertFile = 'cert-file' # Example
InsecureConnection = false # Default
# TraceSampleRatio is the rate at which to sample traces. Must be between 0 and 1.
TraceSampleRatio = 0.01 # Default
# EmitterBatchProcessor enables batching for telemetry events
EmitterBatchProcessor = true # Default
# EmitterExportTimeout sets timeout for exporting telemetry events
EmitterExportTimeout = '1s' # Default

# ResourceAttributes are global metadata to include with all telemetry.
[Telemetry.ResourceAttributes]
Expand Down
4 changes: 4 additions & 0 deletions core/config/telemetry_config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package config

import "time"

type Telemetry interface {
Enabled() bool
InsecureConnection() bool
CACertFile() string
OtelExporterGRPCEndpoint() string
ResourceAttributes() map[string]string
TraceSampleRatio() float64
EmitterBatchProcessor() bool
EmitterExportTimeout() time.Duration
}
20 changes: 14 additions & 6 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1657,12 +1657,14 @@ func (t *Tracing) ValidateConfig() (err error) {
}

type Telemetry struct {
Enabled *bool
CACertFile *string
Endpoint *string
InsecureConnection *bool
ResourceAttributes map[string]string `toml:",omitempty"`
TraceSampleRatio *float64
Enabled *bool
CACertFile *string
Endpoint *string
InsecureConnection *bool
ResourceAttributes map[string]string `toml:",omitempty"`
TraceSampleRatio *float64
EmitterBatchProcessor *bool
EmitterExportTimeout *commonconfig.Duration
}

func (b *Telemetry) setFrom(f *Telemetry) {
Expand All @@ -1684,6 +1686,12 @@ func (b *Telemetry) setFrom(f *Telemetry) {
if v := f.TraceSampleRatio; v != nil {
b.TraceSampleRatio = v
}
if v := f.EmitterBatchProcessor; v != nil {
b.EmitterBatchProcessor = v
}
if v := f.EmitterExportTimeout; v != nil {
b.EmitterExportTimeout = v
}
}

func (b *Telemetry) ValidateConfig() (err error) {
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4
github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2 h1:sm8dL6NSFHmu2Bl17KhhfIwLQYWauxAFpBZ/w8WHuAA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4 h1:e+uFsxQ21tMQKRu4oBXKycNzoR30vO/7STBtqtDvQJQ=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
16 changes: 16 additions & 0 deletions core/services/chainlink/config_telemetry.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package chainlink

import (
"time"

"github.com/smartcontractkit/chainlink/v2/core/config/toml"
"github.com/smartcontractkit/chainlink/v2/core/static"
)
Expand Down Expand Up @@ -58,3 +60,17 @@ func (b *telemetryConfig) TraceSampleRatio() float64 {
}
return *b.s.TraceSampleRatio
}

func (b *telemetryConfig) EmitterBatchProcessor() bool {
if b.s.EmitterBatchProcessor == nil {
return false
}
return *b.s.EmitterBatchProcessor
}

func (b *telemetryConfig) EmitterExportTimeout() time.Duration {
if b.s.EmitterExportTimeout == nil {
return 0
}
return b.s.EmitterExportTimeout.Duration()
}
14 changes: 8 additions & 6 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,14 @@ func TestConfig_Marshal(t *testing.T) {
Release: ptr("v1.2.3"),
}
full.Telemetry = toml.Telemetry{
Enabled: ptr(true),
CACertFile: ptr("cert-file"),
Endpoint: ptr("example.com/collector"),
InsecureConnection: ptr(true),
ResourceAttributes: map[string]string{"Baz": "test", "Foo": "bar"},
TraceSampleRatio: ptr(0.01),
Enabled: ptr(true),
CACertFile: ptr("cert-file"),
Endpoint: ptr("example.com/collector"),
InsecureConnection: ptr(true),
ResourceAttributes: map[string]string{"Baz": "test", "Foo": "bar"},
TraceSampleRatio: ptr(0.01),
EmitterBatchProcessor: ptr(true),
EmitterExportTimeout: commoncfg.MustNewDuration(1 * time.Second),
}
full.EVM = []*evmcfg.EVMConfig{
{
Expand Down
2 changes: 2 additions & 0 deletions core/services/chainlink/testdata/config-empty-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,5 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'
2 changes: 2 additions & 0 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ CACertFile = 'cert-file'
Endpoint = 'example.com/collector'
InsecureConnection = true
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[Telemetry.ResourceAttributes]
Baz = 'test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
2 changes: 2 additions & 0 deletions core/web/resolver/testdata/config-empty-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,5 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'
2 changes: 2 additions & 0 deletions core/web/resolver/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ CACertFile = 'cert-file'
Endpoint = 'example.com/collector'
InsecureConnection = true
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[Telemetry.ResourceAttributes]
Baz = 'test'
Expand Down
2 changes: 2 additions & 0 deletions core/web/resolver/testdata/config-multi-chain-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
2 changes: 1 addition & 1 deletion deployment/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86
github.com/smartcontractkit/chain-selectors v1.0.27
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4
github.com/smartcontractkit/chainlink-protos/job-distributor v0.4.0
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions deployment/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2 h1:sm8dL6NSFHmu2Bl17KhhfIwLQYWauxAFpBZ/w8WHuAA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4 h1:e+uFsxQ21tMQKRu4oBXKycNzoR30vO/7STBtqtDvQJQ=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
14 changes: 14 additions & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,8 @@ Endpoint = 'example.com/collector' # Example
CACertFile = 'cert-file' # Example
InsecureConnection = false # Default
TraceSampleRatio = 0.01 # Default
EmitterBatchProcessor = true # Default
EmitterExportTimeout = '1s' # Default
```
Telemetry holds OTEL settings.
This data includes open telemetry metrics, traces, & logs.
Expand Down Expand Up @@ -1942,6 +1944,18 @@ TraceSampleRatio = 0.01 # Default
```
TraceSampleRatio is the rate at which to sample traces. Must be between 0 and 1.

### EmitterBatchProcessor
```toml
EmitterBatchProcessor = true # Default
```
EmitterBatchProcessor enables batching for telemetry events

### EmitterExportTimeout
```toml
EmitterExportTimeout = '1s' # Default
```
EmitterExportTimeout sets timeout for exporting telemetry events

## Telemetry.ResourceAttributes
```toml
[Telemetry.ResourceAttributes]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.27
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e
github.com/smartcontractkit/chainlink-feeds v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2 h1:sm8dL6NSFHmu2Bl17KhhfIwLQYWauxAFpBZ/w8WHuAA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4 h1:e+uFsxQ21tMQKRu4oBXKycNzoR30vO/7STBtqtDvQJQ=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.27
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4
github.com/smartcontractkit/chainlink-protos/job-distributor v0.4.0
github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1405,8 +1405,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2 h1:sm8dL6NSFHmu2Bl17KhhfIwLQYWauxAFpBZ/w8WHuAA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4 h1:e+uFsxQ21tMQKRu4oBXKycNzoR30vO/7STBtqtDvQJQ=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/slack-go/slack v0.15.0
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.5
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422 h1:VfH/AW5NtTmroY9zz6OYCPFbFTqpMyJ2ubgT9ahYf3U=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241106140121-4c9ee21ab422/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2 h1:sm8dL6NSFHmu2Bl17KhhfIwLQYWauxAFpBZ/w8WHuAA=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241108204352-914b88b62cf2/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4 h1:e+uFsxQ21tMQKRu4oBXKycNzoR30vO/7STBtqtDvQJQ=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241109002240-af894848b3b4/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e h1:JiETqdNM0bktAUGMc62COwXIaw3rR3M77Me6bBLG0Fg=
Expand Down
2 changes: 2 additions & 0 deletions plugins/loop_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func (m *LoopRegistry) Register(id string) (*RegisteredLoop, error) {
envCfg.TelemetryCACertFile = m.cfgTelemetry.CACertFile()
envCfg.TelemetryAttributes = m.cfgTelemetry.ResourceAttributes()
envCfg.TelemetryTraceSampleRatio = m.cfgTelemetry.TraceSampleRatio()
envCfg.TelemetryEmitterBatchProcessor = m.cfgTelemetry.EmitterBatchProcessor()
envCfg.TelemetryEmitterExportTimeout = m.cfgTelemetry.EmitterExportTimeout()
envCfg.TelemetryAuthPubKeyHex = m.telemetryAuthPubKeyHex
}
m.lggr.Debugf("Registered loopp %q with config %v, port %d", id, envCfg, envCfg.PrometheusPort)
Expand Down
7 changes: 7 additions & 0 deletions plugins/loop_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugins

import (
"testing"
"time"

"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -55,6 +56,10 @@ func (m mockCfgTelemetry) ResourceAttributes() map[string]string {

func (m mockCfgTelemetry) TraceSampleRatio() float64 { return 0.42 }

func (m mockCfgTelemetry) EmitterBatchProcessor() bool { return true }

func (m mockCfgTelemetry) EmitterExportTimeout() time.Duration { return 1 * time.Second }

func TestLoopRegistry_Register(t *testing.T) {
mockCfgTracing := &mockCfgTracing{}
mockCfgTelemetry := &mockCfgTelemetry{}
Expand Down Expand Up @@ -86,4 +91,6 @@ func TestLoopRegistry_Register(t *testing.T) {
require.Equal(t, "http://localhost:9001", envCfg.TelemetryEndpoint)
require.Equal(t, loop.OtelAttributes{"foo": "bar"}, envCfg.TelemetryAttributes)
require.Equal(t, 0.42, envCfg.TelemetryTraceSampleRatio)
require.True(t, envCfg.TelemetryEmitterBatchProcessor)
require.Equal(t, 1*time.Second, envCfg.TelemetryEmitterExportTimeout)
}
2 changes: 2 additions & 0 deletions testdata/scripts/config/merge_raw_configs.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[Aptos]]
ChainID = '1'
Expand Down
2 changes: 2 additions & 0 deletions testdata/scripts/node/validate/default.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

Invalid configuration: invalid secrets: 2 errors:
- Database.URL: empty: must be provided and non-empty
Expand Down
2 changes: 2 additions & 0 deletions testdata/scripts/node/validate/defaults-override.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
2 changes: 2 additions & 0 deletions testdata/scripts/node/validate/disk-based-logging.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
2 changes: 2 additions & 0 deletions testdata/scripts/node/validate/invalid-ocr-p2p.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

Invalid configuration: invalid configuration: P2P.V2.Enabled: invalid value (false): P2P required for OCR or OCR2. Please enable P2P or disable OCR/OCR2.

Expand Down
2 changes: 2 additions & 0 deletions testdata/scripts/node/validate/invalid.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ CACertFile = ''
Endpoint = ''
InsecureConnection = false
TraceSampleRatio = 0.01
EmitterBatchProcessor = true
EmitterExportTimeout = '1s'

[[EVM]]
ChainID = '1'
Expand Down
Loading

0 comments on commit 422e385

Please sign in to comment.