Skip to content

Commit

Permalink
Merge branch 'main' into sampling-window
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay authored Jan 4, 2024
2 parents be5008e + f75e255 commit 8a19d43
Show file tree
Hide file tree
Showing 47 changed files with 775 additions and 416 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ updates:
- renaynay
labels:
- kind:deps
ignore:
- dependency-name: "*otel*"
update-types: ["version-update:semver-patch"]
groups:
otel:
patterns:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:

- run: git fetch --force --tags

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ needs.setup.outputs.go-version }}

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

Expand All @@ -55,7 +55,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

Expand All @@ -79,15 +79,15 @@ jobs:
- uses: actions/checkout@v4

- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

- name: run unit tests
run: make test-unit ENABLE_VERBOSE=${{ needs.setup.outputs.debug }}

- name: Upload unit test output
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always() && needs.setup.outputs.debug == 'true'
with:
name: unit-test-output-${{ matrix.os }}
Expand All @@ -113,7 +113,7 @@ jobs:
- uses: actions/checkout@v4

- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

Expand All @@ -129,7 +129,7 @@ jobs:
- uses: actions/checkout@v4

- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 60
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN uname -a &&\
CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
make build && make cel-key

FROM docker.io/alpine:3.18.5
FROM docker.io/alpine:3.19.0

# Read here why UID 10001: https://github.com/hexops/dockerfile/blob/main/README.md#do-not-use-a-uid-below-10000
ARG UID=10001
Expand Down
8 changes: 0 additions & 8 deletions api/gateway/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ type Config struct {
Port string
}

func DefaultConfig() Config {
return Config{
Address: "0.0.0.0",
// do NOT expose the same port as celestia-core by default so that both can run on the same machine
Port: "26658",
}
}

func (cfg *Config) Validate() error {
if ip := net.ParseIP(cfg.Address); ip == nil {
return fmt.Errorf("service/gateway: invalid listen address format: %s", cfg.Address)
Expand Down
2 changes: 1 addition & 1 deletion cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
func PrintOutput(data interface{}, err error, formatData func(interface{}) interface{}) error {
switch {
case err != nil:
data = err
data = err.Error()
case formatData != nil:
data = formatData(data)
}
Expand Down
6 changes: 3 additions & 3 deletions core/exchange_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"time"

"go.opentelemetry.io/otel/metric"

"github.com/celestiaorg/celestia-node/libs/utils"
)

type exchangeMetrics struct {
Expand All @@ -31,9 +33,7 @@ func (m *exchangeMetrics) observe(ctx context.Context, observeFn func(ctx contex
return
}

if ctx.Err() != nil {
ctx = context.Background()
}
ctx = utils.ResetContextOnError(ctx)

observeFn(ctx)
}
Expand Down
6 changes: 3 additions & 3 deletions core/listener_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"

"github.com/celestiaorg/celestia-node/libs/utils"
)

var meter = otel.Meter("core")
Expand Down Expand Up @@ -53,9 +55,7 @@ func (m *listenerMetrics) observe(ctx context.Context, observeFn func(ctx contex
return
}

if ctx.Err() != nil {
ctx = context.Background()
}
ctx = utils.ResetContextOnError(ctx)

observeFn(ctx)
}
Expand Down
19 changes: 7 additions & 12 deletions das/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"go.opentelemetry.io/otel/metric"

"github.com/celestiaorg/celestia-node/header"
"github.com/celestiaorg/celestia-node/libs/utils"
)

const (
Expand All @@ -19,9 +20,7 @@ const (
failedLabel = "failed"
)

var (
meter = otel.Meter("das")
)
var meter = otel.Meter("das")

type metrics struct {
sampled metric.Int64Counter
Expand Down Expand Up @@ -146,9 +145,9 @@ func (m *metrics) observeSample(
if m == nil {
return
}
if ctx.Err() != nil {
ctx = context.Background()
}

ctx = utils.ResetContextOnError(ctx)

m.sampleTime.Record(ctx, sampleTime.Seconds(),
metric.WithAttributes(
attribute.Bool(failedLabel, err != nil),
Expand All @@ -171,9 +170,7 @@ func (m *metrics) observeGetHeader(ctx context.Context, d time.Duration) {
if m == nil {
return
}
if ctx.Err() != nil {
ctx = context.Background()
}
ctx = utils.ResetContextOnError(ctx)
m.getHeaderTime.Record(ctx, d.Seconds())
}

Expand All @@ -182,8 +179,6 @@ func (m *metrics) observeNewHead(ctx context.Context) {
if m == nil {
return
}
if ctx.Err() != nil {
ctx = context.Background()
}
ctx = utils.ResetContextOnError(ctx)
m.newHead.Add(ctx, 1)
}
38 changes: 19 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ go 1.21.1

require (
cosmossdk.io/errors v1.0.0
cosmossdk.io/math v1.1.2
cosmossdk.io/math v1.2.0
github.com/BurntSushi/toml v1.3.2
github.com/alecthomas/jsonschema v0.0.0-20220216202328-9eeeec9d044b
github.com/benbjohnson/clock v1.3.5
github.com/celestiaorg/celestia-app v1.4.0
github.com/celestiaorg/go-ds-badger4 v0.0.0-20230712104058-7ede1c814ac5
github.com/celestiaorg/go-fraud v0.2.0
github.com/celestiaorg/go-header v0.4.1
github.com/celestiaorg/go-header v0.5.1
github.com/celestiaorg/go-libp2p-messenger v0.2.0
github.com/celestiaorg/nmt v0.20.0
github.com/celestiaorg/rsmt2d v0.11.0
Expand All @@ -25,19 +25,19 @@ require (
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.1
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/hashicorp/go-retryablehttp v0.7.5
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/imdario/mergo v0.3.16
github.com/ipfs/boxo v0.15.0
github.com/ipfs/boxo v0.16.0
github.com/ipfs/go-block-format v0.2.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ipld-cbor v0.1.0
github.com/ipfs/go-ipld-format v0.6.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipld/go-car v0.6.2
github.com/libp2p/go-libp2p v0.32.0
github.com/libp2p/go-libp2p-kad-dht v0.25.1
github.com/libp2p/go-libp2p v0.32.1
github.com/libp2p/go-libp2p-kad-dht v0.25.2
github.com/libp2p/go-libp2p-pubsub v0.10.0
github.com/libp2p/go-libp2p-record v0.2.0
github.com/libp2p/go-libp2p-routing-helpers v0.7.3
Expand All @@ -47,7 +47,7 @@ require (
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/multiformats/go-multihash v0.2.3
github.com/open-rpc/meta-schema v0.0.0-20201029221707-1b72ef2ea333
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_golang v1.18.0
github.com/pyroscope-io/client v0.7.2
github.com/pyroscope-io/otel-profiling-go v0.4.0
github.com/spf13/cobra v1.8.0
Expand All @@ -66,12 +66,12 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0
go.uber.org/fx v1.20.1
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.14.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/sync v0.5.0
golang.org/x/text v0.14.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
)

require (
Expand All @@ -83,6 +83,7 @@ require (
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/hashicorp/golang-lru/arc/v2 v2.0.5 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
go.uber.org/mock v0.3.0 // indirect
Expand Down Expand Up @@ -251,7 +252,6 @@ require (
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.56 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
Expand Down Expand Up @@ -279,9 +279,9 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/pyroscope-io/godeltaprof v0.1.2 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.4 // indirect
Expand Down Expand Up @@ -324,16 +324,16 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/api v0.128.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit 8a19d43

Please sign in to comment.