Skip to content

Commit ad85898

Browse files
committed
add custom on-chain-metrics target for both local and Dockerized version, add container name field for blockchains
1 parent 8464b77 commit ad85898

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

framework/.changeset/v0.10.24.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- On chain metrics scrape targets
2+
- Allow to specify custom names for blockchain containers

framework/components/blockchain/blockchain.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ const (
3434
// Input is a blockchain network configuration params
3535
type Input struct {
3636
// Common EVM fields
37-
Type string `toml:"type" validate:"required,oneof=anvil geth besu solana aptos tron sui ton" envconfig:"net_type"`
38-
Image string `toml:"image"`
39-
PullImage bool `toml:"pull_image"`
40-
Port string `toml:"port"`
37+
Type string `toml:"type" validate:"required,oneof=anvil geth besu solana aptos tron sui ton" envconfig:"net_type"`
38+
Image string `toml:"image"`
39+
PullImage bool `toml:"pull_image"`
40+
Port string `toml:"port"`
41+
ContainerName string `toml:"container_name"`
4142
// Not applicable to Solana, ws port for Solana is +1 of port
4243
WSPort string `toml:"port_ws"`
4344
ChainID string `toml:"chain_id"`

framework/components/blockchain/containers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const (
2424

2525
func baseRequest(in *Input, useWS ExposeWs) testcontainers.ContainerRequest {
2626
containerName := framework.DefaultTCName("blockchain-node")
27+
if in.ContainerName != "" {
28+
containerName = in.ContainerName
29+
}
2730
bindPort := fmt.Sprintf("%s/tcp", in.Port)
2831
exposedPorts := []string{bindPort}
2932
if useWS {

framework/observability/compose/conf/prometheus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ global:
44
scrape_configs:
55
- job_name: 'on-chain-metrics'
66
metrics_path: /on-chain-metrics
7-
scrape_interval: 10s
7+
scrape_interval: 2s
88
static_configs:
9-
- targets: [ 'host.docker.internal:9112', 'on-chain-metrics:9112']
9+
- targets: [ 'host.docker.internal:9112', '172.17.0.1:9112']
1010
- job_name: 'otel-collector'
1111
scrape_interval: 10s
1212
static_configs:

0 commit comments

Comments
 (0)