From 422e38500062689cbe2c35175f79b5455971f25a Mon Sep 17 00:00:00 2001 From: Pavel <177363085+pkcll@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:04:00 -0500 Subject: [PATCH] INFOPLAT-1468 Enable batching for beholder emitter (#15173) * 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 --- core/cmd/shell.go | 2 ++ core/config/docs/core.toml | 4 ++++ core/config/telemetry_config.go | 4 ++++ core/config/toml/types.go | 20 +++++++++++++------ core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- core/services/chainlink/config_telemetry.go | 16 +++++++++++++++ core/services/chainlink/config_test.go | 14 +++++++------ .../testdata/config-empty-effective.toml | 2 ++ .../chainlink/testdata/config-full.toml | 2 ++ .../config-multi-chain-effective.toml | 2 ++ .../testdata/config-empty-effective.toml | 2 ++ core/web/resolver/testdata/config-full.toml | 2 ++ .../config-multi-chain-effective.toml | 2 ++ deployment/go.mod | 2 +- deployment/go.sum | 4 ++-- docs/CONFIG.md | 14 +++++++++++++ go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- plugins/loop_registry.go | 2 ++ plugins/loop_registry_test.go | 7 +++++++ .../scripts/config/merge_raw_configs.txtar | 2 ++ testdata/scripts/node/validate/default.txtar | 2 ++ .../node/validate/defaults-override.txtar | 2 ++ .../disk-based-logging-disabled.txtar | 2 ++ .../validate/disk-based-logging-no-dir.txtar | 2 ++ .../node/validate/disk-based-logging.txtar | 2 ++ .../node/validate/invalid-ocr-p2p.txtar | 2 ++ testdata/scripts/node/validate/invalid.txtar | 2 ++ testdata/scripts/node/validate/valid.txtar | 2 ++ testdata/scripts/node/validate/warnings.txtar | 2 ++ 35 files changed, 118 insertions(+), 27 deletions(-) diff --git a/core/cmd/shell.go b/core/cmd/shell.go index 9d92ddcf76e..966fa1a0ff8 100644 --- a/core/cmd/shell.go +++ b/core/cmd/shell.go @@ -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, } diff --git a/core/config/docs/core.toml b/core/config/docs/core.toml index dde898ed3b1..083633ab57f 100644 --- a/core/config/docs/core.toml +++ b/core/config/docs/core.toml @@ -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] diff --git a/core/config/telemetry_config.go b/core/config/telemetry_config.go index 5440e70b43b..e182e95eb6c 100644 --- a/core/config/telemetry_config.go +++ b/core/config/telemetry_config.go @@ -1,5 +1,7 @@ package config +import "time" + type Telemetry interface { Enabled() bool InsecureConnection() bool @@ -7,4 +9,6 @@ type Telemetry interface { OtelExporterGRPCEndpoint() string ResourceAttributes() map[string]string TraceSampleRatio() float64 + EmitterBatchProcessor() bool + EmitterExportTimeout() time.Duration } diff --git a/core/config/toml/types.go b/core/config/toml/types.go index 5246f0861f5..d9302b81fb0 100644 --- a/core/config/toml/types.go +++ b/core/config/toml/types.go @@ -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) { @@ -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) { diff --git a/core/scripts/go.mod b/core/scripts/go.mod index f0efc3cc962..314e88a9b7f 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -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 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 8606d483969..5a30edb6c83 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -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= diff --git a/core/services/chainlink/config_telemetry.go b/core/services/chainlink/config_telemetry.go index 2021af6100a..125eeed64e5 100644 --- a/core/services/chainlink/config_telemetry.go +++ b/core/services/chainlink/config_telemetry.go @@ -1,6 +1,8 @@ package chainlink import ( + "time" + "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/static" ) @@ -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() +} diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 19ad7529c83..10a861960ac 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -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{ { diff --git a/core/services/chainlink/testdata/config-empty-effective.toml b/core/services/chainlink/testdata/config-empty-effective.toml index 4cfe5e2086c..cd51afac5f8 100644 --- a/core/services/chainlink/testdata/config-empty-effective.toml +++ b/core/services/chainlink/testdata/config-empty-effective.toml @@ -286,3 +286,5 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' diff --git a/core/services/chainlink/testdata/config-full.toml b/core/services/chainlink/testdata/config-full.toml index f6cb497f7c8..c5d79dbe5bc 100644 --- a/core/services/chainlink/testdata/config-full.toml +++ b/core/services/chainlink/testdata/config-full.toml @@ -296,6 +296,8 @@ CACertFile = 'cert-file' Endpoint = 'example.com/collector' InsecureConnection = true TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [Telemetry.ResourceAttributes] Baz = 'test' diff --git a/core/services/chainlink/testdata/config-multi-chain-effective.toml b/core/services/chainlink/testdata/config-multi-chain-effective.toml index 4d25d23c333..d71ebc4a2d5 100644 --- a/core/services/chainlink/testdata/config-multi-chain-effective.toml +++ b/core/services/chainlink/testdata/config-multi-chain-effective.toml @@ -286,6 +286,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/core/web/resolver/testdata/config-empty-effective.toml b/core/web/resolver/testdata/config-empty-effective.toml index 4cfe5e2086c..cd51afac5f8 100644 --- a/core/web/resolver/testdata/config-empty-effective.toml +++ b/core/web/resolver/testdata/config-empty-effective.toml @@ -286,3 +286,5 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' diff --git a/core/web/resolver/testdata/config-full.toml b/core/web/resolver/testdata/config-full.toml index 8fbe07f97f9..3ae24d81f40 100644 --- a/core/web/resolver/testdata/config-full.toml +++ b/core/web/resolver/testdata/config-full.toml @@ -296,6 +296,8 @@ CACertFile = 'cert-file' Endpoint = 'example.com/collector' InsecureConnection = true TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [Telemetry.ResourceAttributes] Baz = 'test' diff --git a/core/web/resolver/testdata/config-multi-chain-effective.toml b/core/web/resolver/testdata/config-multi-chain-effective.toml index adc1394e654..ea8022fa6ae 100644 --- a/core/web/resolver/testdata/config-multi-chain-effective.toml +++ b/core/web/resolver/testdata/config-multi-chain-effective.toml @@ -286,6 +286,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/deployment/go.mod b/deployment/go.mod index c659795a77f..cde3a01968c 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -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 diff --git a/deployment/go.sum b/deployment/go.sum index 08402cd426d..32d78868a01 100644 --- a/deployment/go.sum +++ b/deployment/go.sum @@ -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= diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 10177f9e4bb..2592e48b642 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -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. @@ -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] diff --git a/go.mod b/go.mod index 2aa832aaf25..ca0250d2917 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 08609453b6c..db766c87c1a 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 96e35773812..7bf5a0e1c36 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -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 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 849746c7262..a1f42b16aea 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -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= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 0af0a8339fc..441c6eaa4e1 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -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 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 2f574a6a744..a2c8cc52ba4 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -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= diff --git a/plugins/loop_registry.go b/plugins/loop_registry.go index c0c2bc909bf..82ef219566a 100644 --- a/plugins/loop_registry.go +++ b/plugins/loop_registry.go @@ -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) diff --git a/plugins/loop_registry_test.go b/plugins/loop_registry_test.go index 1ce293e6a76..c7484b7aca9 100644 --- a/plugins/loop_registry_test.go +++ b/plugins/loop_registry_test.go @@ -2,6 +2,7 @@ package plugins import ( "testing" + "time" "github.com/stretchr/testify/require" @@ -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{} @@ -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) } diff --git a/testdata/scripts/config/merge_raw_configs.txtar b/testdata/scripts/config/merge_raw_configs.txtar index dbdc1657e0f..b3d50f22b36 100644 --- a/testdata/scripts/config/merge_raw_configs.txtar +++ b/testdata/scripts/config/merge_raw_configs.txtar @@ -433,6 +433,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[Aptos]] ChainID = '1' diff --git a/testdata/scripts/node/validate/default.txtar b/testdata/scripts/node/validate/default.txtar index ad923919e08..5e8b847ceda 100644 --- a/testdata/scripts/node/validate/default.txtar +++ b/testdata/scripts/node/validate/default.txtar @@ -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 diff --git a/testdata/scripts/node/validate/defaults-override.txtar b/testdata/scripts/node/validate/defaults-override.txtar index 14c26bf85cd..bf8bece28bf 100644 --- a/testdata/scripts/node/validate/defaults-override.txtar +++ b/testdata/scripts/node/validate/defaults-override.txtar @@ -359,6 +359,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar index bff1c74c97b..2e72ed7e9bb 100644 --- a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar @@ -342,6 +342,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar index 6b0b5db9eaf..7b27328f7a6 100644 --- a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar @@ -342,6 +342,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/testdata/scripts/node/validate/disk-based-logging.txtar b/testdata/scripts/node/validate/disk-based-logging.txtar index 59c8d7b1c5d..83d23546175 100644 --- a/testdata/scripts/node/validate/disk-based-logging.txtar +++ b/testdata/scripts/node/validate/disk-based-logging.txtar @@ -342,6 +342,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/testdata/scripts/node/validate/invalid-ocr-p2p.txtar b/testdata/scripts/node/validate/invalid-ocr-p2p.txtar index d3e56f97fbb..3fccffc4e69 100644 --- a/testdata/scripts/node/validate/invalid-ocr-p2p.txtar +++ b/testdata/scripts/node/validate/invalid-ocr-p2p.txtar @@ -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. diff --git a/testdata/scripts/node/validate/invalid.txtar b/testdata/scripts/node/validate/invalid.txtar index 739f427317e..5ea0aa289a8 100644 --- a/testdata/scripts/node/validate/invalid.txtar +++ b/testdata/scripts/node/validate/invalid.txtar @@ -332,6 +332,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/testdata/scripts/node/validate/valid.txtar b/testdata/scripts/node/validate/valid.txtar index 6543a53c43d..26641c0ef76 100644 --- a/testdata/scripts/node/validate/valid.txtar +++ b/testdata/scripts/node/validate/valid.txtar @@ -339,6 +339,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' [[EVM]] ChainID = '1' diff --git a/testdata/scripts/node/validate/warnings.txtar b/testdata/scripts/node/validate/warnings.txtar index ac8489f3246..51b3e897741 100644 --- a/testdata/scripts/node/validate/warnings.txtar +++ b/testdata/scripts/node/validate/warnings.txtar @@ -321,6 +321,8 @@ CACertFile = '' Endpoint = '' InsecureConnection = false TraceSampleRatio = 0.01 +EmitterBatchProcessor = true +EmitterExportTimeout = '1s' # Configuration warning: Tracing.TLSCertPath: invalid value (something): must be empty when Tracing.Mode is 'unencrypted'