Skip to content

Commit

Permalink
Update config TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
george-dorin committed Sep 14, 2023
1 parent 5103517 commit 39acd32
Show file tree
Hide file tree
Showing 20 changed files with 92 additions and 53 deletions.
7 changes: 4 additions & 3 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ SendTimeout = '10s' # Default
# UseBatchSend toggles sending telemetry to the ingress server using the batch client.
UseBatchSend = true # Default

[[TelemetryIngressEndpoint]]
[[TelemetryIngressEndpoint]] # Example
# Network aka EVM, Solana, Starknet
Network = 'EVM' # Example
# Chain ID for the endpoint
ChainID = 111551111 # Example
# ChainID of the network
ChainID = '111551111' # Example
# ServerPubKey is the public key of the telemetry server.
ServerPubKey = 'test-pub-key-111551111-evm' # Example
# URL is where to send telemetry.
Expand Down
10 changes: 8 additions & 2 deletions core/services/chainlink/config_telemetry_ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ func TestTelemetryIngressConfig(t *testing.T) {
ticfg := cfg.TelemetryIngress()
assert.True(t, ticfg.Logging())
assert.True(t, ticfg.UniConn())
assert.Equal(t, "test-pub-key", ticfg.ServerPubKey())
assert.Equal(t, "https://prom.test", ticfg.URL().String())
assert.Equal(t, uint(1234), ticfg.BufferSize())
assert.Equal(t, uint(4321), ticfg.MaxBatchSize())
assert.Equal(t, time.Minute, ticfg.SendInterval())
assert.Equal(t, 5*time.Second, ticfg.SendTimeout())
assert.True(t, ticfg.UseBatchSend())

tec := cfg.TelemetryIngress().Endpoints()

assert.Equal(t, 1, len(tec))
assert.Equal(t, "EVM", tec[0].Network())
assert.Equal(t, "1", tec[0].ChainID())
assert.Equal(t, "https://prom.test", tec[0].URL().String())
assert.Equal(t, "test-pub-key", tec[0].ServerPubKey())
}
20 changes: 16 additions & 4 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,21 @@ func TestConfig_Marshal(t *testing.T) {
full.TelemetryIngress = toml.TelemetryIngress{
UniConn: ptr(true),
Logging: ptr(true),
ServerPubKey: ptr("test-pub-key"),
URL: mustURL("https://prom.test"),
BufferSize: ptr[uint16](1234),
MaxBatchSize: ptr[uint16](4321),
SendInterval: models.MustNewDuration(time.Minute),
SendTimeout: models.MustNewDuration(5 * time.Second),
UseBatchSend: ptr(true),
}

full.TelemetryIngressEndpoint = toml.TelemetryIngressEndpoints{
ptr(toml.TelemetryIngressEndpoint{
Network: ptr("test-network"),
ChainID: ptr("123123123"),
ServerPubKey: ptr("test-pub-key-111551111-test-network"),
URL: mustURL("http://localhost-123123123-test-network:9000"),
}),
}
full.Log = toml.Log{
Level: ptr(toml.LogLevel(zapcore.DPanicLevel)),
JSONConsole: ptr(true),
Expand Down Expand Up @@ -683,14 +690,19 @@ LeaseRefreshInterval = '1s'
{"TelemetryIngress", Config{Core: toml.Core{TelemetryIngress: full.TelemetryIngress}}, `[TelemetryIngress]
UniConn = true
Logging = true
ServerPubKey = 'test-pub-key'
URL = 'https://prom.test'
BufferSize = 1234
MaxBatchSize = 4321
SendInterval = '1m0s'
SendTimeout = '5s'
UseBatchSend = true
`},
{"TelemetryIngressEndpoint", Config{Core: toml.Core{TelemetryIngressEndpoint: full.TelemetryIngressEndpoint}}, `[[TelemetryIngressEndpoint]]
Network = 'test-network'
ChainID = '123123123'
URL = 'http://localhost-123123123-test-network:9000'
ServerPubKey = 'test-pub-key-111551111-test-network'
`},

{"Log", Config{Core: toml.Core{Log: full.Log}}, `[Log]
Level = 'crit'
JSONConsole = true
Expand Down
8 changes: 6 additions & 2 deletions core/services/chainlink/testdata/config-empty-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
SendTimeout = '10s'
UseBatchSend = true

[[TelemetryIngressEndpoint]]
Network = ''
ChainID = ''
ServerPubKey = ''
URL = ''

[AuditLogger]
Enabled = false
ForwardToUrl = ''
Expand Down
8 changes: 6 additions & 2 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = true
ServerPubKey = 'test-pub-key'
URL = 'https://prom.test'
BufferSize = 1234
MaxBatchSize = 4321
SendInterval = '1m0s'
SendTimeout = '5s'
UseBatchSend = true

[[TelemetryIngressEndpoint]]
Network = 'EVM'
ChainID = '1'
URL = 'https://prom.test'
ServerPubKey = 'test-pub-key'

[AuditLogger]
Enabled = true
ForwardToUrl = 'http://localhost:9898'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
SendTimeout = '10s'
UseBatchSend = true

[[TelemetryIngressEndpoint]]
Network = ''
ChainID = ''
ServerPubKey = ''
URL = ''

[AuditLogger]
Enabled = true
ForwardToUrl = 'http://localhost:9898'
Expand Down
2 changes: 1 addition & 1 deletion core/services/functions/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func NewFunctionsListenerUniverse(t *testing.T, timeoutSec int, pruneFrequencySe

ingressClient := sync_mocks.NewTelemetryIngressClient(t)
ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient)
monEndpoint := ingressAgent.GenMonitoringEndpoint(contractAddress, synchronization.FunctionsRequests)
monEndpoint := ingressAgent.GenMonitoringEndpoint(contractAddress, synchronization.FunctionsRequests, "test-network", "test-chainID")

s4Storage := s4_mocks.NewStorage(t)
client := chain.Client()
Expand Down
6 changes: 3 additions & 3 deletions core/services/ocrcommon/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func TestSendEATelemetry(t *testing.T) {
wg := sync.WaitGroup{}
ingressClient := mocks.NewTelemetryIngressClient(t)
ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.EnhancedEA)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.EnhancedEA, "test-network", "test-chainID")

var sentMessage []byte
ingressClient.On("Send", mock.AnythingOfType("synchronization.TelemPayload")).Return().Run(func(args mock.Arguments) {
Expand Down Expand Up @@ -304,7 +304,7 @@ func TestCollectAndSend(t *testing.T) {
wg := sync.WaitGroup{}
ingressClient := mocks.NewTelemetryIngressClient(t)
ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.EnhancedEA)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.EnhancedEA, "test-network", "test-chainID")
ingressClient.On("Send", mock.AnythingOfType("synchronization.TelemPayload")).Return().Run(func(args mock.Arguments) {
wg.Done()
})
Expand Down Expand Up @@ -551,7 +551,7 @@ func TestCollectMercuryEnhancedTelemetry(t *testing.T) {
wg := sync.WaitGroup{}
ingressClient := mocks.NewTelemetryIngressClient(t)
ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.EnhancedEAMercury)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.EnhancedEAMercury, "test-network", "test-chainID")

var sentMessage []byte
ingressClient.On("Send", mock.AnythingOfType("synchronization.TelemPayload")).Return().Run(func(args mock.Arguments) {
Expand Down
2 changes: 1 addition & 1 deletion core/services/telemetry/ingress_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func TestIngressAgentBatch(t *testing.T) {
telemetryBatchClient := mocks.NewTelemetryIngressBatchClient(t)
ingressAgentBatch := telemetry.NewIngressAgentWrapper(telemetryBatchClient)
monitoringEndpoint := ingressAgentBatch.GenMonitoringEndpoint("0xa", synchronization.OCR)
monitoringEndpoint := ingressAgentBatch.GenMonitoringEndpoint("0xa", synchronization.OCR, "test-network", "test-chainID")

// Handle the Send call and store the telem
var telemPayload synchronization.TelemPayload
Expand Down
2 changes: 1 addition & 1 deletion core/services/telemetry/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func TestIngressAgent(t *testing.T) {
telemetryClient := mocks.NewTelemetryIngressClient(t)
ingressAgent := telemetry.NewIngressAgentWrapper(telemetryClient)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.OCR)
monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("0xa", synchronization.OCR, "test-network", "test-chainID")

// Handle the Send call and store the telem
var telemPayload synchronization.TelemPayload
Expand Down
2 changes: 0 additions & 2 deletions core/web/resolver/testdata/config-empty-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
8 changes: 6 additions & 2 deletions core/web/resolver/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = true
ServerPubKey = 'test-pub-key'
URL = 'https://prom.test'
BufferSize = 1234
MaxBatchSize = 4321
SendInterval = '1m0s'
SendTimeout = '5s'
UseBatchSend = true

[[TelemetryIngressEndpoint]]
Network = 'EVM'
ChainID = '1'
ServerPubKey = 'test-pub-key'
URL = 'https://prom.test'

[AuditLogger]
Enabled = true
ForwardToUrl = 'http://localhost:9898'
Expand Down
2 changes: 0 additions & 2 deletions core/web/resolver/testdata/config-multi-chain-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
48 changes: 34 additions & 14 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ LeaseRefreshInterval determines how often to refresh the lease lock. Also contro
[TelemetryIngress]
UniConn = true # Default
Logging = false # Default
ServerPubKey = 'test-pub-key' # Example
URL = 'https://prom.test' # Example
BufferSize = 100 # Default
MaxBatchSize = 50 # Default
SendInterval = '500ms' # Default
Expand All @@ -266,18 +264,6 @@ Logging = false # Default
```
Logging toggles verbose logging of the raw telemetry messages being sent.

### ServerPubKey
```toml
ServerPubKey = 'test-pub-key' # Example
```
ServerPubKey is the public key of the telemetry server.

### URL
```toml
URL = 'https://prom.test' # Example
```
URL is where to send telemetry.

### BufferSize
```toml
BufferSize = 100 # Default
Expand Down Expand Up @@ -308,6 +294,40 @@ UseBatchSend = true # Default
```
UseBatchSend toggles sending telemetry to the ingress server using the batch client.

## TelemetryIngressEndpoint]] # Example
```toml
[[TelemetryIngressEndpoint]] # Example
Network = 'EVM' # Example
ChainID = '111551111' # Example
ServerPubKey = 'test-pub-key-111551111-evm' # Example
URL = 'http://localhost-111551111-evm:9000' # Example
```


### Network
```toml
Network = 'EVM' # Example
```
Network aka EVM, Solana, Starknet

### ChainID
```toml
ChainID = '111551111' # Example
```
ChainID of the network

### ServerPubKey
```toml
ServerPubKey = 'test-pub-key-111551111-evm' # Example
```
ServerPubKey is the public key of the telemetry server.

### URL
```toml
URL = 'http://localhost-111551111-evm:9000' # Example
```
URL is where to send telemetry.

## AuditLogger
```toml
[AuditLogger]
Expand Down
2 changes: 0 additions & 2 deletions testdata/scripts/node/validate/default.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
2 changes: 0 additions & 2 deletions testdata/scripts/node/validate/disk-based-logging.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
2 changes: 0 additions & 2 deletions testdata/scripts/node/validate/invalid.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down
2 changes: 0 additions & 2 deletions testdata/scripts/node/validate/valid.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ LeaseRefreshInterval = '1s'
[TelemetryIngress]
UniConn = true
Logging = false
ServerPubKey = ''
URL = ''
BufferSize = 100
MaxBatchSize = 50
SendInterval = '500ms'
Expand Down

0 comments on commit 39acd32

Please sign in to comment.