Skip to content
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

Add Data store as resource on backend #2385

Merged

Conversation

danielbdias
Copy link
Contributor

@danielbdias danielbdias commented Apr 13, 2023

This PR adds the Data Store as a resource into the Tracetest server.

On this PR, both the old and new structures coexist on the API. The next PR will update the OpenAPI code with make generate and change the references to use this structure.

Loom: https://www.loom.com/share/45b49110030d4b0688b51c059f97388c

Changes

  • Add DataStore resource package
  • Updated internal references to use this package
  • Removed DataStore model

Fixes

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@danielbdias danielbdias force-pushed the add/data-store-as-resource-on-backend branch 2 times, most recently from bf2e9ec to 7e859f5 Compare April 14, 2023 00:13
@danielbdias danielbdias changed the title Add/data store as resource on backend Add Data store as resource on backend Apr 14, 2023
@danielbdias danielbdias marked this pull request as ready for review April 14, 2023 12:56
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, I've added datastoreresource package inside of tracedb, because I thought they manage the same thing, even knowing that tracedb is heavily infrastructure-based code.

I accept suggestions on other places that could not be confusing 🙃

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense. I was thinking that maybe we don't need a package specifically for the resource. Maybe it could live directly under tracedb? This is an open question

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we discussed this and decided we'll keep the separated project. this approach allows more flexibility

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a weird name. is it like this for any particular reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An ill-succeed experiment that I've done to try to focus all repository tests on the same place. 🤦 🙃
On later versions, I've changed to repository_tests.go


// reuse the created_at field for auditing purposes,
// unless the client explicitly send it
createdAt, err := r.getCreatedAt(ctx, dataStore)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to support this case? I think unless we have an explicit need for this, clients should not be allowed to set this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this case today, I believe that we can remove it on the future.

@@ -111,6 +111,7 @@ func (ds DataStore) HasID() bool {
}

func (ds DataStore) Validate() error {
//TODO: replace for resource validate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to address these TODOs in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I'm working on it.

@danielbdias danielbdias force-pushed the add/data-store-as-resource-on-backend branch 2 times, most recently from df280fd to a0b165a Compare April 17, 2023 21:13
@danielbdias danielbdias force-pushed the feature/datastore-as-resource branch from 17add7e to 17fdb8f Compare April 18, 2023 01:21
@danielbdias danielbdias force-pushed the add/data-store-as-resource-on-backend branch 3 times, most recently from ab5b1c4 to ed03a5f Compare April 19, 2023 18:32
…2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural
@danielbdias danielbdias force-pushed the feature/datastore-as-resource branch from 17fdb8f to a997d88 Compare April 19, 2023 21:08
@danielbdias danielbdias force-pushed the add/data-store-as-resource-on-backend branch from 1b524b2 to 156958c Compare April 19, 2023 21:18
danielbdias and others added 2 commits April 20, 2023 10:58
…2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural
@danielbdias danielbdias force-pushed the feature/datastore-as-resource branch from a997d88 to ea05beb Compare April 20, 2023 18:59
return manager
}

func cleanup(t *testing.T, manager resourcemanager.Manager) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a cleanup structure, this test file surpasses more than 100 idle connections. Later we need to think about how we can improve the RM structure to avoid these open connections.

@danielbdias danielbdias force-pushed the add/data-store-as-resource-on-backend branch from b4b9ee8 to 6a1808f Compare April 21, 2023 14:09
@danielbdias danielbdias requested a review from xoscar April 24, 2023 13:40
Copy link
Contributor

@jorgeepc jorgeepc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@danielbdias danielbdias merged commit a3eafe2 into feature/datastore-as-resource Apr 24, 2023
18 of 27 checks passed
@danielbdias danielbdias deleted the add/data-store-as-resource-on-backend branch April 24, 2023 17:54
xoscar added a commit that referenced this pull request Apr 26, 2023
… CLI commands (#2414)

* Updating DataStore API definition to consider ResourcesAPI structure (#2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural

* Add Data store as resource on Backend (#2385)

* feat(frontend): add data store as resource (#2423)

* Add data store as resource on CLI (#2422)

* Updating DataStore API definition to consider ResourcesAPI structure (#2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural

* Adding datastoreresource package

* Update internal references to use datastoreresource package

* Isolate database resources on each test

* Adding behavior for no datastore scenario

* Fixing rebase problems

* Fixing another rebase problem

* Updating DataStore API definition to consider ResourcesAPI structure (#2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural

* Fixing merge

* Adding documentation for delete operation

* Improving cleanup code

* Updating datastore API

* Adding CLI generated code

* wip

* wip

* Fixing CLI

* deprecated old commands

* Adding wrongly deleted file

* simplifying the resource actions creation steps

---------

Co-authored-by: Oscar Reyes <oscar-rreyes1@hotmail.com>

* fix ingester dsRepo

* chore(docs): update data store docs and examples (#2429)

* removing test deletion

* fixing provisioning file

* fixing provisioning file

---------

Co-authored-by: Jorge Padilla <jorge.esteban.padilla@gmail.com>
Co-authored-by: Oscar Reyes <oscar-rreyes1@hotmail.com>
schoren pushed a commit that referenced this pull request Jun 5, 2023
… CLI commands (#2414)

* Updating DataStore API definition to consider ResourcesAPI structure (#2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural

* Add Data store as resource on Backend (#2385)

* feat(frontend): add data store as resource (#2423)

* Add data store as resource on CLI (#2422)

* Updating DataStore API definition to consider ResourcesAPI structure (#2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural

* Adding datastoreresource package

* Update internal references to use datastoreresource package

* Isolate database resources on each test

* Adding behavior for no datastore scenario

* Fixing rebase problems

* Fixing another rebase problem

* Updating DataStore API definition to consider ResourcesAPI structure (#2368)

Fixing sorting fields on OpenAPI

Updating OpenAPI to consider DataStore endpoint managing only one record

Add endpoint in plural

* Fixing merge

* Adding documentation for delete operation

* Improving cleanup code

* Updating datastore API

* Adding CLI generated code

* wip

* wip

* Fixing CLI

* deprecated old commands

* Adding wrongly deleted file

* simplifying the resource actions creation steps

---------

Co-authored-by: Oscar Reyes <oscar-rreyes1@hotmail.com>

* fix ingester dsRepo

* chore(docs): update data store docs and examples (#2429)

* removing test deletion

* fixing provisioning file

* fixing provisioning file

---------

Co-authored-by: Jorge Padilla <jorge.esteban.padilla@gmail.com>
Co-authored-by: Oscar Reyes <oscar-rreyes1@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants