Skip to content

Commit ecca97e

Browse files
authored
Merge pull request #41 from DIMO-Network/pr-3870-add-by-tag-query-to-fetch-api
feat: Advanced search options.
2 parents d09d48f + fb528ce commit ecca97e

19 files changed

Lines changed: 2226 additions & 229 deletions

File tree

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
path: bin/
7474
- name: Set bin as executable
7575
run: chmod +x bin/*
76-
- run: go mod download
76+
- run: go mod tidy
7777
- name: Run generate
7878
run: make generate
7979
- name: Porcelain

cmd/fetch-api/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ import (
2626
func main() {
2727
settingsFile := flag.String("env", ".env", "env file")
2828
flag.Parse()
29+
2930
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
3031
defer cancel()
32+
3133
logger := logging.GetAndSetDefaultLogger("fetch-api")
34+
3235
settings, err := env.LoadSettings[config.Settings](*settingsFile)
3336
if err != nil {
3437
logger.Fatal().Err(err).Msg("Couldn't load settings.")
3538
}
39+
3640
webServer, err := app.CreateWebServer(&settings)
3741
if err != nil {
3842
logger.Fatal().Err(err).Msg("Failed to create web server.")
@@ -41,6 +45,7 @@ func main() {
4145
if err != nil {
4246
logger.Fatal().Err(err).Msg("Failed to create RPC server.")
4347
}
48+
4449
group, gCtx := errgroup.WithContext(ctx)
4550

4651
monApp := monserver.NewMonitoringServer(&logger, settings.EnablePprof)

docs/docs.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,13 @@ const docTemplate = `{
433433
"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.",
434434
"type": "string"
435435
},
436+
"tags": {
437+
"description": "Tags are a list of tags that can be used to filter events.",
438+
"type": "array",
439+
"items": {
440+
"type": "string"
441+
}
442+
},
436443
"time": {
437444
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
438445
"type": "string"
@@ -443,7 +450,7 @@ const docTemplate = `{
443450
}
444451
}
445452
},
446-
"eventrepo.ObjectInfo": {
453+
"github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo": {
447454
"type": "object",
448455
"properties": {
449456
"key": {
@@ -458,7 +465,7 @@ const docTemplate = `{
458465
"description": "Data contains domain-specific information about the event.",
459466
"allOf": [
460467
{
461-
"$ref": "#/definitions/eventrepo.ObjectInfo"
468+
"$ref": "#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo"
462469
}
463470
]
464471
},
@@ -498,6 +505,13 @@ const docTemplate = `{
498505
"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.",
499506
"type": "string"
500507
},
508+
"tags": {
509+
"description": "Tags are a list of tags that can be used to filter events.",
510+
"type": "array",
511+
"items": {
512+
"type": "string"
513+
}
514+
},
501515
"time": {
502516
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
503517
"type": "string"

docs/swagger.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,13 @@
424424
"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.",
425425
"type": "string"
426426
},
427+
"tags": {
428+
"description": "Tags are a list of tags that can be used to filter events.",
429+
"type": "array",
430+
"items": {
431+
"type": "string"
432+
}
433+
},
427434
"time": {
428435
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
429436
"type": "string"
@@ -434,7 +441,7 @@
434441
}
435442
}
436443
},
437-
"eventrepo.ObjectInfo": {
444+
"github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo": {
438445
"type": "object",
439446
"properties": {
440447
"key": {
@@ -449,7 +456,7 @@
449456
"description": "Data contains domain-specific information about the event.",
450457
"allOf": [
451458
{
452-
"$ref": "#/definitions/eventrepo.ObjectInfo"
459+
"$ref": "#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo"
453460
}
454461
]
455462
},
@@ -489,6 +496,13 @@
489496
"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.",
490497
"type": "string"
491498
},
499+
"tags": {
500+
"description": "Tags are a list of tags that can be used to filter events.",
501+
"type": "array",
502+
"items": {
503+
"type": "string"
504+
}
505+
},
492506
"time": {
493507
"description": "Time is an optional field giving the time at which the event occurred. In\npractice, we always set this.",
494508
"type": "string"

docs/swagger.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ definitions:
4545
Subject is an optional field identifying the subject of the event within
4646
the context of the event producer. In practice, we always set this.
4747
type: string
48+
tags:
49+
description: Tags are a list of tags that can be used to filter events.
50+
items:
51+
type: string
52+
type: array
4853
time:
4954
description: |-
5055
Time is an optional field giving the time at which the event occurred. In
@@ -56,7 +61,7 @@ definitions:
5661
name.
5762
type: string
5863
type: object
59-
eventrepo.ObjectInfo:
64+
github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo:
6065
properties:
6166
key:
6267
type: string
@@ -65,7 +70,7 @@ definitions:
6570
properties:
6671
data:
6772
allOf:
68-
- $ref: '#/definitions/eventrepo.ObjectInfo'
73+
- $ref: '#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo'
6974
description: Data contains domain-specific information about the event.
7075
datacontenttype:
7176
description: |-
@@ -106,6 +111,11 @@ definitions:
106111
Subject is an optional field identifying the subject of the event within
107112
the context of the event producer. In practice, we always set this.
108113
type: string
114+
tags:
115+
description: Tags are a list of tags that can be used to filter events.
116+
items:
117+
type: string
118+
type: array
109119
time:
110120
description: |-
111121
Time is an optional field giving the time at which the event occurred. In

go.mod

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25
55
require (
66
github.com/ClickHouse/clickhouse-go/v2 v2.40.1
77
github.com/DIMO-Network/clickhouse-infra v0.0.5
8-
github.com/DIMO-Network/cloudevent v0.1.3
8+
github.com/DIMO-Network/cloudevent v0.1.4
99
github.com/DIMO-Network/server-garage v0.0.4
1010
github.com/DIMO-Network/shared v1.0.7
1111
github.com/aws/aws-sdk-go-v2 v1.38.0
@@ -19,19 +19,23 @@ require (
1919
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
2020
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
2121
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
22-
github.com/prometheus/client_golang v1.23.0
2322
github.com/rs/zerolog v1.34.0
24-
github.com/stretchr/testify v1.10.0
23+
github.com/stretchr/testify v1.11.1
2524
github.com/swaggo/swag v1.16.6
25+
github.com/volatiletech/sqlboiler/v4 v4.19.1
26+
go.uber.org/mock v0.6.0
2627
golang.org/x/sync v0.16.0
2728
google.golang.org/grpc v1.74.2
28-
google.golang.org/protobuf v1.36.7
29+
google.golang.org/protobuf v1.36.8
2930
)
3031

3132
require (
33+
dario.cat/mergo v1.0.1 // indirect
34+
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
3235
github.com/ClickHouse/ch-go v0.67.0 // indirect
3336
github.com/KyleBanks/depth v1.2.1 // indirect
3437
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
38+
github.com/Microsoft/go-winio v0.6.2 // indirect
3539
github.com/PuerkitoBio/purell v1.1.1 // indirect
3640
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
3741
github.com/andybalholm/brotli v1.2.0 // indirect
@@ -46,54 +50,98 @@ require (
4650
github.com/aws/smithy-go v1.22.5 // indirect
4751
github.com/beorn7/perks v1.0.1 // indirect
4852
github.com/caarlos0/env/v11 v11.3.1 // indirect
53+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
4954
github.com/cespare/xxhash/v2 v2.3.0 // indirect
55+
github.com/containerd/errdefs v1.0.0 // indirect
56+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
57+
github.com/containerd/log v0.1.0 // indirect
58+
github.com/containerd/platforms v0.2.1 // indirect
59+
github.com/cpuguy83/dockercfg v0.3.2 // indirect
5060
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
5161
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
5262
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
63+
github.com/distribution/reference v0.6.0 // indirect
64+
github.com/docker/docker v28.3.3+incompatible // indirect
65+
github.com/docker/go-connections v0.6.0 // indirect
66+
github.com/docker/go-units v0.5.0 // indirect
67+
github.com/ebitengine/purego v0.8.4 // indirect
68+
github.com/felixge/httpsnoop v1.0.4 // indirect
5369
github.com/friendsofgo/errors v0.9.2 // indirect
5470
github.com/go-faster/city v1.0.1 // indirect
5571
github.com/go-faster/errors v0.7.1 // indirect
72+
github.com/go-logr/logr v1.4.3 // indirect
73+
github.com/go-logr/stdr v1.2.2 // indirect
74+
github.com/go-ole/go-ole v1.3.0 // indirect
5675
github.com/go-openapi/jsonpointer v0.19.5 // indirect
5776
github.com/go-openapi/jsonreference v0.19.6 // indirect
5877
github.com/go-openapi/spec v0.20.4 // indirect
5978
github.com/go-openapi/swag v0.19.15 // indirect
79+
github.com/gogo/protobuf v1.3.2 // indirect
6080
github.com/google/uuid v1.6.0 // indirect
6181
github.com/holiman/uint256 v1.3.2 // indirect
6282
github.com/joho/godotenv v1.5.1 // indirect
6383
github.com/josharian/intern v1.0.0 // indirect
6484
github.com/klauspost/compress v1.18.0 // indirect
85+
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
86+
github.com/magiconair/properties v1.8.10 // indirect
6587
github.com/mailru/easyjson v0.7.6 // indirect
6688
github.com/mattn/go-colorable v0.1.14 // indirect
6789
github.com/mattn/go-isatty v0.0.20 // indirect
6890
github.com/mattn/go-runewidth v0.0.16 // indirect
91+
github.com/mdelapenya/tlscert v0.2.0 // indirect
92+
github.com/mfridman/interpolate v0.0.2 // indirect
93+
github.com/moby/docker-image-spec v1.3.1 // indirect
94+
github.com/moby/go-archive v0.1.0 // indirect
95+
github.com/moby/patternmatcher v0.6.0 // indirect
96+
github.com/moby/sys/sequential v0.6.0 // indirect
97+
github.com/moby/sys/user v0.4.0 // indirect
98+
github.com/moby/sys/userns v0.1.0 // indirect
99+
github.com/moby/term v0.5.2 // indirect
100+
github.com/morikuni/aec v1.0.0 // indirect
69101
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
102+
github.com/opencontainers/go-digest v1.0.0 // indirect
103+
github.com/opencontainers/image-spec v1.1.1 // indirect
70104
github.com/paulmach/orb v0.11.1 // indirect
71105
github.com/pierrec/lz4/v4 v4.1.22 // indirect
106+
github.com/pkg/errors v0.9.1 // indirect
72107
github.com/pmezard/go-difflib v1.0.0 // indirect
108+
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
109+
github.com/pressly/goose/v3 v3.24.3 // indirect
110+
github.com/prometheus/client_golang v1.23.0 // indirect
73111
github.com/prometheus/client_model v0.6.2 // indirect
74112
github.com/prometheus/common v0.65.0 // indirect
75113
github.com/prometheus/procfs v0.16.1 // indirect
76114
github.com/rivo/uniseg v0.4.7 // indirect
77115
github.com/russross/blackfriday/v2 v2.1.0 // indirect
78116
github.com/segmentio/asm v1.2.0 // indirect
117+
github.com/sethvargo/go-retry v0.3.0 // indirect
118+
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
79119
github.com/shopspring/decimal v1.4.0 // indirect
120+
github.com/sirupsen/logrus v1.9.3 // indirect
80121
github.com/spf13/cast v1.7.0 // indirect
81122
github.com/swaggo/files/v2 v2.0.2 // indirect
123+
github.com/testcontainers/testcontainers-go v0.38.0 // indirect
124+
github.com/testcontainers/testcontainers-go/modules/clickhouse v0.38.0 // indirect
82125
github.com/tidwall/gjson v1.18.0 // indirect
83126
github.com/tidwall/match v1.1.1 // indirect
84127
github.com/tidwall/pretty v1.2.1 // indirect
85128
github.com/tidwall/sjson v1.2.5 // indirect
129+
github.com/tklauser/go-sysconf v0.3.15 // indirect
130+
github.com/tklauser/numcpus v0.10.0 // indirect
86131
github.com/urfave/cli/v2 v2.27.5 // indirect
87132
github.com/valyala/bytebufferpool v1.0.0 // indirect
88133
github.com/valyala/fasthttp v1.55.0 // indirect
89134
github.com/valyala/tcplisten v1.0.0 // indirect
90135
github.com/volatiletech/inflect v0.0.1 // indirect
91-
github.com/volatiletech/sqlboiler/v4 v4.19.1 // indirect
92136
github.com/volatiletech/strmangle v0.0.7-0.20240503230658-86517898275a // indirect
93137
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
138+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
139+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
140+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
94141
go.opentelemetry.io/otel v1.37.0 // indirect
142+
go.opentelemetry.io/otel/metric v1.37.0 // indirect
95143
go.opentelemetry.io/otel/trace v1.37.0 // indirect
96-
go.uber.org/mock v0.6.0 // indirect
144+
go.uber.org/multierr v1.11.0 // indirect
97145
golang.org/x/crypto v0.41.0 // indirect
98146
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
99147
golang.org/x/mod v0.27.0 // indirect
@@ -102,7 +150,8 @@ require (
102150
golang.org/x/text v0.28.0 // indirect
103151
golang.org/x/tools v0.36.0 // indirect
104152
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
105-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
153+
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
154+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
106155
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
107156
gopkg.in/yaml.v2 v2.4.0 // indirect
108157
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)