-
Notifications
You must be signed in to change notification settings - Fork 233
feat: edfs stream metrics #2137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
40d8146
feat: event metrics
SkArchon a29ce3b
fix: refactoring
SkArchon 7bf5f3e
fix: add request
SkArchon 695f529
fix: refactoring
SkArchon 192f095
fix: add tests
SkArchon c4fddad
fix: kafka tests
SkArchon 50bd6e5
fix: updates
SkArchon eb4f235
fix: updates
SkArchon 3f3f5d3
fix: tests
SkArchon 7f8e869
fix: tests
SkArchon 3cd1234
fix: review comments
SkArchon bbd5f06
fix: tests
SkArchon 0c1c9c0
fix: refactoring
SkArchon b369054
fix: review comments
SkArchon 7d50c7d
fix: review comments
SkArchon a8141ff
fix: tests
SkArchon 89e96b2
fix: refactoring
SkArchon 6c7e0a9
fix: tests
SkArchon b4f9a09
fix: tests
SkArchon 77065ee
fix: tests
SkArchon 933cab4
fix: naming operation
SkArchon dbc50e5
fix: cleanup
SkArchon 061ffd1
Merge branch 'main' into milinda/eng-7785-subscriptions-metrics
SkArchon 066a57b
Merge branch 'main' into milinda/eng-7785-subscriptions-metrics
SkArchon b56c97f
fix: improve tests
SkArchon e72b9ae
fix: attempt to fix subgraph tests
SkArchon 775ea72
fix: revert false positive
SkArchon e3d63d4
fix: tests
SkArchon 2ac4afa
fix: linting
SkArchon fb2c05c
fix: review comments
SkArchon 176e960
fix: tests
SkArchon 8a41205
fix: tests
SkArchon fdbe1f8
fix: tests
SkArchon c56b7c1
fix: tests
SkArchon e945f7d
fix: tests
SkArchon 87c67fc
fix: review comments
SkArchon eed45fc
fix: error entry
SkArchon 430c421
refactor: naming to use stream metrics
SkArchon 1667595
fix: renaming
SkArchon f4393c0
fix: add router prefix name value
SkArchon 415a816
fix: update description
SkArchon 83bc1f8
Merge remote-tracking branch 'origin/main' into milinda/eng-7785-subs…
SkArchon 0da26e7
fix: renaming
SkArchon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| package events | ||
|
|
||
| import ( | ||
| "context" | ||
| "github.com/redis/go-redis/v9" | ||
| "github.com/stretchr/testify/require" | ||
| "github.com/twmb/franz-go/pkg/kgo" | ||
| "github.com/wundergraph/cosmo/router-tests/testenv" | ||
| "net/url" | ||
| "testing" | ||
| "time" | ||
| ) | ||
|
|
||
| const waitTimeout = time.Second * 30 | ||
|
|
||
| func ProduceKafkaMessage(t *testing.T, xEnv *testenv.Environment, topicName string, message string) { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
| defer cancel() | ||
|
|
||
| pErrCh := make(chan error) | ||
|
|
||
| xEnv.KafkaClient.Produce(ctx, &kgo.Record{ | ||
| Topic: xEnv.GetPubSubName(topicName), | ||
| Value: []byte(message), | ||
| }, func(_ *kgo.Record, err error) { | ||
| pErrCh <- err | ||
| }) | ||
|
|
||
| testenv.AwaitChannelWithT(t, waitTimeout, pErrCh, func(t *testing.T, pErr error) { | ||
| require.NoError(t, pErr) | ||
| }) | ||
|
|
||
| fErr := xEnv.KafkaClient.Flush(ctx) | ||
| require.NoError(t, fErr) | ||
| } | ||
|
|
||
| func EnsureTopicExists(t *testing.T, xEnv *testenv.Environment, topics ...string) { | ||
| // Delete topic for idempotency | ||
| deleteCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
| defer cancel() | ||
| prefixedTopics := make([]string, 0, len(topics)) | ||
| for _, topic := range topics { | ||
| prefixedTopics = append(prefixedTopics, xEnv.GetPubSubName(topic)) | ||
| } | ||
|
|
||
| _, err := xEnv.KafkaAdminClient.DeleteTopics(deleteCtx, prefixedTopics...) | ||
| require.NoError(t, err) | ||
|
|
||
| ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
| defer cancel() | ||
|
|
||
| _, err = xEnv.KafkaAdminClient.CreateTopics(ctx, 1, 1, nil, prefixedTopics...) | ||
| require.NoError(t, err) | ||
| } | ||
|
|
||
| func ProduceRedisMessage(t *testing.T, xEnv *testenv.Environment, topicName string, message string) { | ||
| ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
| defer cancel() | ||
|
|
||
| parsedURL, err := url.Parse(xEnv.RedisHosts[0]) | ||
| if err != nil { | ||
| t.Fatalf("Failed to parse Redis URL: %v", err) | ||
| } | ||
| var redisConn redis.UniversalClient | ||
| if !xEnv.RedisWithClusterMode { | ||
| redisConn = redis.NewClient(&redis.Options{ | ||
| Addr: parsedURL.Host, | ||
| }) | ||
| } else { | ||
| redisConn = redis.NewClusterClient(&redis.ClusterOptions{ | ||
| Addrs: []string{parsedURL.Host}, | ||
| }) | ||
| } | ||
|
|
||
| defer func() { | ||
| _ = redisConn.Close() | ||
| }() | ||
|
|
||
| intCmd := redisConn.Publish(ctx, xEnv.GetPubSubName(topicName), message) | ||
| require.NoError(t, intCmd.Err()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package events_test | ||
| package events | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.