Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions capabilities/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ require (
github.com/google/uuid v1.6.0
github.com/jpillora/backoff v1.0.0
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250618162808-a5a42ee8701b
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250702142954-f9ce5ef305d1
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250626141212-e50b2e7ffe2d
github.com/stretchr/testify v1.10.0
go.opentelemetry.io/otel v1.35.0
go.opentelemetry.io/otel/metric v1.35.0
Expand All @@ -23,16 +24,16 @@ require (
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.15.2 // indirect
github.com/cloudevents/sdk-go/v2 v2.16.0 // indirect
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.16.1 // indirect
github.com/cloudevents/sdk-go/v2 v2.16.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.25.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
22 changes: 12 additions & 10 deletions capabilities/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK3
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.15.2 h1:FIvfKlS2mcuP0qYY6yzdIU9xdrRd/YMP0bNwFjXd0u8=
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.15.2/go.mod h1:POsdVp/08Mki0WD9QvvgRRpg9CQ6zhjfRrBoEY8JFS8=
github.com/cloudevents/sdk-go/v2 v2.16.0 h1:wnunjgiLQCfYlyo+E4+mFlZtAh7pKn7vT8MMD3lSwCg=
github.com/cloudevents/sdk-go/v2 v2.16.0/go.mod h1:5YWqklyhDSmGzBK/JENKKXdulbPq0JFf3c/KEnMLqgg=
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.16.1 h1:nLaJZcVAnaqch3K83AyzHfY2DmQM18/L7jvkmKSfkpI=
github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.16.1/go.mod h1:6Q+F2puKpJ6zWv+R02BVnizJICf7++oRT5zwpZQAsbk=
github.com/cloudevents/sdk-go/v2 v2.16.1 h1:G91iUdqvl88BZ1GYYr9vScTj5zzXSyEuqbfE63gbu9Q=
github.com/cloudevents/sdk-go/v2 v2.16.1/go.mod h1:v/kVOaWjNfbvc6tkhhlkhvLapj8Aa8kvXiH5GiOHCKI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand All @@ -31,8 +31,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=
github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-viper/mapstructure/v2 v2.3.0 h1:27XbWsHIqhbdR5TIC911OfYvgSaW93HM+dX7970Q7jk=
github.com/go-viper/mapstructure/v2 v2.3.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
Expand Down Expand Up @@ -89,8 +89,10 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.2.0 h1:WCcC4vZDS1tYNxjWlwRJZQy28r8CM
github.com/santhosh-tekuri/jsonschema/v5 v5.2.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250618162808-a5a42ee8701b h1:nS5njF5W9lY1LnTITt3V2M35dT19JPpuVg6//vlzFiU=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250618162808-a5a42ee8701b/go.mod h1:1ntZ0rtQpPx6h+xlcOJp0ccqHFaxTzW2Z62FJG358q0=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250702142954-f9ce5ef305d1 h1:XI7dErChGcWbbv9vOrSyhXhkkkvROuGpfLj2vwnP6gY=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250702142954-f9ce5ef305d1/go.mod h1:kNOevuC9e+gJXT3+bbJKX0svJal6QCxJVSTrW5e36uM=
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250626141212-e50b2e7ffe2d h1:86gp4tIXRb6ccSrjcm4gV8iA5wJN6er3rJY9f2UxRLU=
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250626141212-e50b2e7ffe2d/go.mod h1:QUEPHdSkH19Or+E1iMGG+rDQ6jpCTIbm//9Osa6MXDE=
github.com/smartcontractkit/libocr v0.0.0-20250328171017-609ec10a5510 h1:gm8Jli0sdkrZYnrWBngAkPSDzFDkdNCy1/Dj86kVtYk=
github.com/smartcontractkit/libocr v0.0.0-20250328171017-609ec10a5510/go.mod h1:Mb7+/LC4edz7HyHxX4QkE42pSuov4AV68+AxBXAap0o=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -157,8 +159,8 @@ golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
google.golang.org/genproto/googleapis/api v0.0.0-20250219182151-9fdb1cabc7b2 h1:35ZFtrCgaAjF7AFAK0+lRSf+4AyYnWRbH7og13p7rZ4=
google.golang.org/genproto/googleapis/api v0.0.0-20250219182151-9fdb1cabc7b2/go.mod h1:W9ynFDP/shebLB1Hl/ESTOap2jHd6pmLXPNZC7SVDbA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 h1:e0AIkUUhxyBKh6ssZNrAMeqhA7RKUj42346d1y02i2g=
Expand Down
16 changes: 8 additions & 8 deletions capabilities/writetarget/beholder/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ import (
// MetricInfo is a struct for metrics information
type MetricsInfoCapBasic struct {
// common
count MetricInfo
capTimestampStart MetricInfo
capTimestampEmit MetricInfo
capDuration MetricInfo // ts.emit - ts.start
count beholder.MetricInfo
capTimestampStart beholder.MetricInfo
capTimestampEmit beholder.MetricInfo
capDuration beholder.MetricInfo // ts.emit - ts.start
}

// NewMetricsInfoCapBasic creates a new MetricsInfoCapBasic using the provided event/metric information
func NewMetricsInfoCapBasic(metricPrefix, eventRef string) MetricsInfoCapBasic {
return MetricsInfoCapBasic{
count: MetricInfo{
count: beholder.MetricInfo{
Name: fmt.Sprintf("%s_count", metricPrefix),
Unit: "",
Description: fmt.Sprintf("The count of message: '%s' emitted", eventRef),
},
capTimestampStart: MetricInfo{
capTimestampStart: beholder.MetricInfo{
Name: fmt.Sprintf("%s_cap_timestamp_start", metricPrefix),
Unit: "ms",
Description: fmt.Sprintf("The timestamp (local) at capability exec start that resulted in message: '%s' emit", eventRef),
},
capTimestampEmit: MetricInfo{
capTimestampEmit: beholder.MetricInfo{
Name: fmt.Sprintf("%s_cap_timestamp_emit", metricPrefix),
Unit: "ms",
Description: fmt.Sprintf("The timestamp (local) at message: '%s' emit", eventRef),
},
capDuration: MetricInfo{
capDuration: beholder.MetricInfo{
Name: fmt.Sprintf("%s_cap_duration", metricPrefix),
Unit: "ms",
Description: fmt.Sprintf("The duration (local) since capability exec start to message: '%s' emit", eventRef),
Expand Down
47 changes: 0 additions & 47 deletions capabilities/writetarget/beholder/info.go

This file was deleted.

6 changes: 2 additions & 4 deletions capabilities/writetarget/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/capabilities"
"github.com/smartcontractkit/chainlink-common/pkg/types"
monitor "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/beholder"

commonpb "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/monitoring/pb/common"
wt "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/monitoring/pb/platform"
)

// messageBuilder is a helper component to build monitoring messages
type messageBuilder struct {
ChainInfo monitor.ChainInfo
ChainInfo types.ChainInfo
CapInfo capabilities.CapabilityInfo
}

// NewMessageBuilder creates a new message builder
func NewMessageBuilder(chainInfo monitor.ChainInfo, capInfo capabilities.CapabilityInfo) *messageBuilder {
func NewMessageBuilder(chainInfo types.ChainInfo, capInfo capabilities.CapabilityInfo) *messageBuilder {
return &messageBuilder{
ChainInfo: chainInfo,
CapInfo: capInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,34 @@ func NewMetrics() (*Metrics, error) {
feedUpdated := struct {
basic beholder.MetricsInfoCapBasic
// specific to FeedUpdated
observationsTimestamp beholder.MetricInfo
duration beholder.MetricInfo // ts.emit - ts.observation
benchmark beholder.MetricInfo
blockTimestamp beholder.MetricInfo
blockNumber beholder.MetricInfo
observationsTimestamp beholdercommon.MetricInfo
duration beholdercommon.MetricInfo // ts.emit - ts.observation
benchmark beholdercommon.MetricInfo
blockTimestamp beholdercommon.MetricInfo
blockNumber beholdercommon.MetricInfo
}{
basic: beholder.NewMetricsInfoCapBasic(ns("feed_updated"), beholdercommon.ToSchemaFullName(&FeedUpdated{})),
observationsTimestamp: beholder.MetricInfo{
observationsTimestamp: beholdercommon.MetricInfo{
Name: ns("feed_updated_observations_timestamp"),
Unit: "ms",
Description: "The observations timestamp for the latest confirmed update (as reported)",
},
duration: beholder.MetricInfo{
duration: beholdercommon.MetricInfo{
Name: ns("feed_updated_duration"),
Unit: "ms",
Description: "The duration (local) since observation to message: 'datafeeds.on-chain.registry.FeedUpdated' emit",
},
benchmark: beholder.MetricInfo{
benchmark: beholdercommon.MetricInfo{
Name: ns("feed_updated_benchmark"),
Unit: "",
Description: "The benchmark value for the latest confirmed update (as reported)",
},
blockTimestamp: beholder.MetricInfo{
blockTimestamp: beholdercommon.MetricInfo{
Name: ns("feed_updated_block_timestamp"),
Unit: "ms",
Description: "The block timestamp at the latest confirmed update (as observed)",
},
blockNumber: beholder.MetricInfo{
blockNumber: beholdercommon.MetricInfo{
Name: ns("feed_updated_block_number"),
Unit: "",
Description: "The block number at the latest confirmed update (as observed)",
Expand Down
20 changes: 10 additions & 10 deletions capabilities/writetarget/monitoring/pb/platform/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ func NewMetrics() (*Metrics, error) {
writeSent := struct {
basic beholder.MetricsInfoCapBasic
// specific to WriteSent
blockTimestamp beholder.MetricInfo
blockNumber beholder.MetricInfo
blockTimestamp beholdercommon.MetricInfo
blockNumber beholdercommon.MetricInfo
}{
basic: beholder.NewMetricsInfoCapBasic(ns("write_sent"), beholdercommon.ToSchemaFullName(&WriteSent{})),
blockTimestamp: beholder.MetricInfo{
blockTimestamp: beholdercommon.MetricInfo{
Name: ns("write_sent_block_timestamp"),
Unit: "ms",
Description: "The block timestamp at the latest sent write (as observed)",
},
blockNumber: beholder.MetricInfo{
blockNumber: beholdercommon.MetricInfo{
Name: ns("write_sent_block_number"),
Unit: "",
Description: "The block number at the latest sent write (as observed)",
Expand All @@ -86,22 +86,22 @@ func NewMetrics() (*Metrics, error) {
writeConfirmed := struct {
basic beholder.MetricsInfoCapBasic
// specific to WriteSent
blockTimestamp beholder.MetricInfo
blockNumber beholder.MetricInfo
signersNumber beholder.MetricInfo
blockTimestamp beholdercommon.MetricInfo
blockNumber beholdercommon.MetricInfo
signersNumber beholdercommon.MetricInfo
}{
basic: beholder.NewMetricsInfoCapBasic(ns("write_confirmed"), beholdercommon.ToSchemaFullName(&WriteConfirmed{})),
blockTimestamp: beholder.MetricInfo{
blockTimestamp: beholdercommon.MetricInfo{
Name: ns("write_confirmed_block_timestamp"),
Unit: "ms",
Description: "The block timestamp for latest confirmed write (as observed)",
},
blockNumber: beholder.MetricInfo{
blockNumber: beholdercommon.MetricInfo{
Name: ns("write_confirmed_block_number"),
Unit: "",
Description: "The block number for latest confirmed write (as observed)",
},
signersNumber: beholder.MetricInfo{
signersNumber: beholdercommon.MetricInfo{
Name: ns("write_confirmed_signers_number"),
Unit: "",
Description: "The number of signers attached to the processed and confirmed write request",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ func NewMetrics() (*Metrics, error) {
reportProcessed := struct {
basic beholder.MetricsInfoCapBasic
// specific to ReportProcessed
blockTimestamp beholder.MetricInfo
blockNumber beholder.MetricInfo
blockTimestamp beholdercommon.MetricInfo
blockNumber beholdercommon.MetricInfo
}{
basic: beholder.NewMetricsInfoCapBasic(ns("report_processed"), beholdercommon.ToSchemaFullName(&ReportProcessed{})),
blockTimestamp: beholder.MetricInfo{
blockTimestamp: beholdercommon.MetricInfo{
Name: ns("report_processed_block_timestamp"),
Unit: "ms",
Description: "The block timestamp at the latest confirmed write (as observed)",
},
blockNumber: beholder.MetricInfo{
blockNumber: beholdercommon.MetricInfo{
Name: ns("report_processed_block_number"),
Unit: "",
Description: "The block number at the latest confirmed write (as observed)",
Expand Down
5 changes: 2 additions & 3 deletions capabilities/writetarget/write_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services"
commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"

monitor "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/beholder"
"github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/report/platform"
"github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/retry"

Expand Down Expand Up @@ -86,7 +85,7 @@ type writeTarget struct {
capabilities.CapabilityInfo

config Config
chainInfo monitor.ChainInfo
chainInfo commontypes.ChainInfo

lggr logger.Logger
// Local beholder client, also hosting the protobuf emitter
Expand All @@ -108,7 +107,7 @@ type WriteTargetOpts struct {
Config Config
// ChainInfo contains the chain information (used as execution context)
// TODO: simplify by passing via ChainService.GetChainStatus fn
ChainInfo monitor.ChainInfo
ChainInfo commontypes.ChainInfo

Logger logger.Logger
Beholder *beholder.BeholderClient
Expand Down
7 changes: 3 additions & 4 deletions capabilities/writetarget/write_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
"github.com/smartcontractkit/chainlink-common/pkg/values"

writetarget "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget"
monitor "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/beholder"
"github.com/smartcontractkit/chainlink-framework/capabilities/writetarget"
utils "github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/monitoring/pb/platform/on-chain/forwarder"
"github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/report/platform"
"github.com/smartcontractkit/chainlink-framework/capabilities/writetarget/report/platform/processor"
Expand Down Expand Up @@ -59,7 +58,7 @@ func setupWriteTarget(
PollPeriod: pollPeriod,
AcceptanceTimeout: timeout,
},
ChainInfo: monitor.ChainInfo{ChainID: "1"},
ChainInfo: commontypes.ChainInfo{ChainID: "1"},
Logger: lggr,
Beholder: monClient,
ChainService: chainSvc,
Expand Down Expand Up @@ -313,7 +312,7 @@ func TestWriteTarget_Execute(t *testing.T) {
opts := writetarget.WriteTargetOpts{
ID: "[email protected]",
Config: writetarget.Config{},
ChainInfo: monitor.ChainInfo{},
ChainInfo: commontypes.ChainInfo{},
Logger: lggr,
Beholder: monClient,
ChainService: chainSvc,
Expand Down
Loading