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
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
path: bin/
- name: Set bin as executable
run: chmod +x bin/*
- run: go mod download
- run: go mod tidy
- name: Run generate
run: make generate
- name: Porcelain
Expand Down
5 changes: 5 additions & 0 deletions cmd/fetch-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ import (
func main() {
settingsFile := flag.String("env", ".env", "env file")
flag.Parse()

ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()

logger := logging.GetAndSetDefaultLogger("fetch-api")

settings, err := env.LoadSettings[config.Settings](*settingsFile)
if err != nil {
logger.Fatal().Err(err).Msg("Couldn't load settings.")
}

webServer, err := app.CreateWebServer(&settings)
if err != nil {
logger.Fatal().Err(err).Msg("Failed to create web server.")
Expand All @@ -41,6 +45,7 @@ func main() {
if err != nil {
logger.Fatal().Err(err).Msg("Failed to create RPC server.")
}

group, gCtx := errgroup.WithContext(ctx)

monApp := monserver.NewMonitoringServer(&logger, settings.EnablePprof)
Expand Down
18 changes: 16 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,13 @@ const docTemplate = `{
"description": "Subject is an optional field identifying the subject of the event within\nthe context of the event producer. In practice, we always set this.",
"type": "string"
},
"tags": {
"description": "Tags are a list of tags that can be used to filter events.",
"type": "array",
"items": {
"type": "string"
}
},
"time": {
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
"type": "string"
Expand All @@ -443,7 +450,7 @@ const docTemplate = `{
}
}
},
"eventrepo.ObjectInfo": {
"github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo": {
"type": "object",
"properties": {
"key": {
Expand All @@ -458,7 +465,7 @@ const docTemplate = `{
"description": "Data contains domain-specific information about the event.",
"allOf": [
{
"$ref": "#/definitions/eventrepo.ObjectInfo"
"$ref": "#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo"
}
]
},
Expand Down Expand Up @@ -498,6 +505,13 @@ const docTemplate = `{
"description": "Subject is an optional field identifying the subject of the event within\nthe context of the event producer. In practice, we always set this.",
"type": "string"
},
"tags": {
"description": "Tags are a list of tags that can be used to filter events.",
"type": "array",
"items": {
"type": "string"
}
},
"time": {
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
"type": "string"
Expand Down
18 changes: 16 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@
"description": "Subject is an optional field identifying the subject of the event within\nthe context of the event producer. In practice, we always set this.",
"type": "string"
},
"tags": {
"description": "Tags are a list of tags that can be used to filter events.",
"type": "array",
"items": {
"type": "string"
}
},
"time": {
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
"type": "string"
Expand All @@ -434,7 +441,7 @@
}
}
},
"eventrepo.ObjectInfo": {
"github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo": {
"type": "object",
"properties": {
"key": {
Expand All @@ -449,7 +456,7 @@
"description": "Data contains domain-specific information about the event.",
"allOf": [
{
"$ref": "#/definitions/eventrepo.ObjectInfo"
"$ref": "#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo"
}
]
},
Expand Down Expand Up @@ -489,6 +496,13 @@
"description": "Subject is an optional field identifying the subject of the event within\nthe context of the event producer. In practice, we always set this.",
"type": "string"
},
"tags": {
"description": "Tags are a list of tags that can be used to filter events.",
"type": "array",
"items": {
"type": "string"
}
},
"time": {
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
"type": "string"
Expand Down
14 changes: 12 additions & 2 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ definitions:
Subject is an optional field identifying the subject of the event within
the context of the event producer. In practice, we always set this.
type: string
tags:
description: Tags are a list of tags that can be used to filter events.
items:
type: string
type: array
time:
description: |-
Time is an optional field giving the time at which the event occurred. In
Expand All @@ -56,7 +61,7 @@ definitions:
name.
type: string
type: object
eventrepo.ObjectInfo:
github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo:
properties:
key:
type: string
Expand All @@ -65,7 +70,7 @@ definitions:
properties:
data:
allOf:
- $ref: '#/definitions/eventrepo.ObjectInfo'
- $ref: '#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo'
description: Data contains domain-specific information about the event.
datacontenttype:
description: |-
Expand Down Expand Up @@ -106,6 +111,11 @@ definitions:
Subject is an optional field identifying the subject of the event within
the context of the event producer. In practice, we always set this.
type: string
tags:
description: Tags are a list of tags that can be used to filter events.
items:
type: string
type: array
time:
description: |-
Time is an optional field giving the time at which the event occurred. In
Expand Down
63 changes: 56 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.25
require (
github.com/ClickHouse/clickhouse-go/v2 v2.40.1
github.com/DIMO-Network/clickhouse-infra v0.0.5
github.com/DIMO-Network/cloudevent v0.1.3
github.com/DIMO-Network/cloudevent v0.1.4
github.com/DIMO-Network/server-garage v0.0.4
github.com/DIMO-Network/shared v1.0.7
github.com/aws/aws-sdk-go-v2 v1.38.0
Expand All @@ -19,19 +19,23 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/prometheus/client_golang v1.23.0
github.com/rs/zerolog v1.34.0
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
github.com/swaggo/swag v1.16.6
github.com/volatiletech/sqlboiler/v4 v4.19.1
go.uber.org/mock v0.6.0
golang.org/x/sync v0.16.0
google.golang.org/grpc v1.74.2
google.golang.org/protobuf v1.36.7
google.golang.org/protobuf v1.36.8
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/ClickHouse/ch-go v0.67.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
Expand All @@ -46,54 +50,98 @@ require (
github.com/aws/smithy-go v1.22.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/caarlos0/env/v11 v11.3.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v28.3.3+incompatible // indirect
github.com/docker/go-connections v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.8.4 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/friendsofgo/errors v0.9.2 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.7.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mdelapenya/tlscert v0.2.0 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.1.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/paulmach/orb v0.11.1 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/pressly/goose/v3 v3.24.3 // indirect
github.com/prometheus/client_golang v1.23.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.65.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/swaggo/files/v2 v2.0.2 // indirect
github.com/testcontainers/testcontainers-go v0.38.0 // indirect
github.com/testcontainers/testcontainers-go/modules/clickhouse v0.38.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/urfave/cli/v2 v2.27.5 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
github.com/volatiletech/inflect v0.0.1 // indirect
github.com/volatiletech/sqlboiler/v4 v4.19.1 // indirect
github.com/volatiletech/strmangle v0.0.7-0.20240503230658-86517898275a // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.uber.org/mock v0.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
golang.org/x/mod v0.27.0 // indirect
Expand All @@ -102,7 +150,8 @@ require (
golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.36.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading