Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multichain telemetry support #10623

Merged
merged 32 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0acb5ab
Initial draft
george-dorin Sep 13, 2023
2af09a8
Merge remote-tracking branch 'origin/develop' into feature/BCF-2393-m…
george-dorin Sep 14, 2023
5103517
Add manager
george-dorin Sep 14, 2023
39acd32
Update config TOML
george-dorin Sep 14, 2023
00cc2b9
Update config tests
george-dorin Sep 15, 2023
232197d
Add telemetry manager tests
george-dorin Sep 17, 2023
f2a1431
Fix lint
george-dorin Sep 17, 2023
944779a
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 18, 2023
fd34362
Add CHANGELOG.md
george-dorin Sep 18, 2023
47032d4
Update TelemetryService Send interface
george-dorin Sep 19, 2023
b804919
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 19, 2023
6ecb218
Fix bad merge
george-dorin Sep 19, 2023
9ec9706
Fix hanging tests
george-dorin Sep 20, 2023
01d1326
Change config from TelemetryIngressEndpoint to TelemetryIngress.Endpo…
george-dorin Sep 20, 2023
9fdf74d
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 20, 2023
aeb4595
- Fix wrong context being passed
george-dorin Sep 21, 2023
75ef748
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 21, 2023
8f3bde1
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 22, 2023
73fcb44
- Remove protocol prefix from telemetry URL
george-dorin Sep 25, 2023
583e360
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 25, 2023
44c47f9
- Fix context in tests
george-dorin Sep 26, 2023
2e78ab5
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 26, 2023
760b4b5
- Update CHANGELOG.md
george-dorin Sep 26, 2023
f85236a
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Sep 27, 2023
592a051
- Add fields back and show error
george-dorin Oct 3, 2023
af67041
- Fix failing tests
george-dorin Oct 4, 2023
6125405
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Oct 4, 2023
bd0d75f
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Oct 10, 2023
5575784
Move changelog entry to [dev]
george-dorin Oct 12, 2023
1f6896d
Update so that telemetry can still be configured the old way
george-dorin Oct 12, 2023
58cf793
Update CONFIG.md
george-dorin Oct 12, 2023
7420f2b
Merge branch 'develop' into feature/BCF-2393-multichain-telemetry-sup…
george-dorin Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ LeaseRefreshInterval = '1s' # Default
UniConn = true # Default
# Logging toggles verbose logging of the raw telemetry messages being sent.
Logging = false # Default
# ServerPubKey is the public key of the telemetry server.
ServerPubKey = 'test-pub-key' # Example
# URL is where to send telemetry.
URL = 'https://prom.test' # Example
# BufferSize is the number of telemetry messages to buffer before dropping new ones.
BufferSize = 100 # Default
# MaxBatchSize is the maximum number of messages to batch into one telemetry request.
Expand All @@ -103,6 +99,16 @@ SendTimeout = '10s' # Default
# UseBatchSend toggles sending telemetry to the ingress server using the batch client.
UseBatchSend = true # Default

[[TelemetryIngress.Endpoints]] # Example
# Network aka EVM, Solana, Starknet
Network = 'EVM' # Example
# ChainID of the network
ChainID = '111551111' # Example
george-dorin marked this conversation as resolved.
Show resolved Hide resolved
# ServerPubKey is the public key of the telemetry server.
ServerPubKey = 'test-pub-key-111551111-evm' # Example
# URL is where to send telemetry.
URL = 'localhost-111551111-evm:9000' # Example

[AuditLogger]
# Enabled determines if this logger should be configured at all
Enabled = false # Default
Expand Down
22 changes: 22 additions & 0 deletions core/config/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ func newTable(line string, desc lines) *table {
return t
}

func newArrayOfTables(line string, desc lines) *table {
t := &table{
name: strings.Trim(strings.Trim(line, fieldExample), "[]"),
codes: []string{line},
desc: desc,
}
if len(desc) > 0 {
if strings.HasPrefix(strings.TrimSpace(desc[0]), tokenAdvanced) {
t.adv = true
t.desc = t.desc[1:]
} else if strings.HasPrefix(strings.TrimSpace(desc[len(desc)-1]), tokenExtended) {
t.ext = true
t.desc = t.desc[:len(desc)-1]
}
}
return t
}

func (t table) advanced() string {
if t.adv {
return advancedWarning("Do not change these settings unless you know what you are doing.")
Expand Down Expand Up @@ -217,6 +235,10 @@ func parseTOMLDocs(s string) (items []fmt.Stringer, err error) {
items = append(items, desc)
desc = nil
}
} else if strings.HasPrefix(line, "[[") {
currentTable = newArrayOfTables(line, desc)
items = append(items, currentTable)
desc = nil
} else if strings.HasPrefix(line, "[") {
currentTable = newTable(line, desc)
items = append(items, currentTable)
Expand Down
7 changes: 7 additions & 0 deletions core/config/docs/docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink/cfgtest"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
"github.com/smartcontractkit/chainlink/v2/core/utils/config"
)

Expand All @@ -37,6 +38,12 @@ func TestDoc(t *testing.T) {
require.NoError(t, err)
}

// Except for TelemetryIngress.ServerPubKey and TelemetryIngress.URL as this will be removed in the future
// and its only use is to signal to NOPs that these fields are no longer allowed
emptyString := ""
c.TelemetryIngress.ServerPubKey = &emptyString
c.TelemetryIngress.URL = new(models.URL)

cfgtest.AssertFieldsNotNil(t, c)

var defaults chainlink.Config
Expand Down
176 changes: 176 additions & 0 deletions core/config/mocks/telemetry_ingress.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 87 additions & 0 deletions core/config/mocks/telemetry_ingress_endpoint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions core/config/telemetry_ingress_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@ import (
"time"
)

//go:generate mockery --quiet --name TelemetryIngress --output ./mocks/ --case=underscore --filename telemetry_ingress.go

type TelemetryIngress interface {
Logging() bool
UniConn() bool
ServerPubKey() string
URL() *url.URL
BufferSize() uint
MaxBatchSize() uint
SendInterval() time.Duration
SendTimeout() time.Duration
UseBatchSend() bool
Endpoints() []TelemetryIngressEndpoint

ServerPubKey() string // Deprecated: Use TelemetryIngressEndpoint.ServerPubKey instead, if this field is set it will trigger an error, only used to warn NOPs of change
URL() *url.URL // Deprecated: Use TelemetryIngressEndpoint.URL instead, if this field is set it will trigger an error, only used to warn NOPs of change
}

//go:generate mockery --quiet --name TelemetryIngressEndpoint --output ./mocks/ --case=underscore --filename telemetry_ingress_endpoint.go
type TelemetryIngressEndpoint interface {
Network() string
ChainID() string
ServerPubKey() string
URL() *url.URL
}
Loading
Loading