Skip to content

feat: swift export#178

Merged
notque merged 20 commits intomasterfrom
export_swift
Jan 27, 2025
Merged

feat: swift export#178
notque merged 20 commits intomasterfrom
export_swift

Conversation

@notque
Copy link
Copy Markdown
Contributor

@notque notque commented Jan 14, 2025

add swift export to hermescli to enable fast and easy swift exports of audit data.

@notque notque requested a review from majewsky January 14, 2025 20:24
@notque notque self-assigned this Jan 14, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 14, 2025

Pull Request Test Coverage Report for Build 12939904652

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 29 of 281 (10.32%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.1%) to 12.733%

Changes Missing Coverage Covered Lines Changed/Added Lines %
client/print.go 0 20 0.0%
client/swift.go 0 57 0.0%
client/export.go 29 204 14.22%
Totals Coverage Status
Change from base Build 12751712796: -1.1%
Covered Lines: 116
Relevant Lines: 911

💛 - Coveralls

notque and others added 12 commits January 15, 2025 09:46
std function slices.Contains

Co-authored-by: Stefan Majewsky <majewsky@gmx.net>
Co-authored-by: Stefan Majewsky <majewsky@gmx.net>
Co-authored-by: Stefan Majewsky <majewsky@gmx.net>
This reverts commit 5941370.

I wasn't thinking clearly here, this moves it outside of where it should
be. Logically, I see what I was going for, but it doesn't make any sense
@notque
Copy link
Copy Markdown
Contributor Author

notque commented Jan 23, 2025

@majewsky is this sane? Have I addressed your feedback appropriately?

Copy link
Copy Markdown
Contributor

@kayrus kayrus left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR! I wanted to implement this logic since I developed this tool, but I had other priorities.
General note is about exported functions/methods/types. Do they really need to be exported? Is there a need to consume them outside of this project? For example the ProgressReader struct or ParseExportFormat func

Another type of notes, I see a lot of go deps, which implement the Write/Read methods. Wouldn't it be more efficient to transfer the data from the hermes service output directly to the swift using pipes instead of collecting all this data in memory and only then upload to swift?

My gut feeling tells me that there are further minor issues, but this is a very good start anyway.

@stefanhipfel thank you for your review as well!

@notque
Copy link
Copy Markdown
Contributor Author

notque commented Jan 23, 2025

Wouldn't it be more efficient to transfer the data from the hermes service output directly to the swift using pipes instead of collecting all this data in memory and only then upload to swift?

The reality is this is the, good for now solution. This whole thing will ultimately be replaced by Hermes doing this in the future, but there are some hold ups on that happening at the moment.

I am trying to urgently get a solution out, I have meetings where I need to provide this next week.

I understand that's not the best response to feedback on a PR. I can try to do more, but I really would like to get a good enough solution out, that I can get released and available to customers asap.

I apologize for the attempt to get this through, however I'm trying to turn a couple rather contentious meetings next week, into reasonably lovely meetings.

client/export.go Outdated
// Create upload progress bar
uploadBar := pb.Full.Start64(int64(buf.Len()))
uploadBar.Set(pb.Bytes, true)
uploadBar.SetWidth(80)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it a static width? I just grepped a project and found this:

hermescli$ grep -r pb.SetWidth
vendor/github.com/cheggaaa/pb/v3/pb.go:         pb.SetWidth(s.AdaptiveElWidth())

maybe it make sense to do this dynamic or configurable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's fair.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thinking about it, I'm not sure making this configurable adds anything of value. It becomes another option in the list that is fairly meaningless when it's just a nice to have indication of the process.

I've committed a change which makes the terminal width automatic. Does that satisfy your request?

@notque
Copy link
Copy Markdown
Contributor Author

notque commented Jan 23, 2025

see a lot of go deps, which implement the Write/Read methods. Wouldn't it be more efficient to transfer the data from the hermes service output directly to the swift using pipes instead of collecting all this data in memory and only then upload to swift?

I thought this was a feature to not allow people to export the entire system. :)

It would be more efficient. It would also be more complex, and wouldn't show the total progress as far as I can tell. I don't know, I feel like this is fairly functional like this but I recognize and understand what you're asking for here.

@notque
Copy link
Copy Markdown
Contributor Author

notque commented Jan 27, 2025

see a lot of go deps, which implement the Write/Read methods. Wouldn't it be more efficient to transfer the data from the hermes service output directly to the swift using pipes instead of collecting all this data in memory and only then upload to swift?

I thought this was a feature to not allow people to export the entire system. :)

It would be more efficient. It would also be more complex, and wouldn't show the total progress as far as I can tell. I don't know, I feel like this is fairly functional like this but I recognize and understand what you're asking for here.

For giggles I tried to build this out, and it was a nightmare I didn't get fully working. Yaml, Json, and CSV all have different requirements, and trying to stream events like that just gets ridiculously complex.

If you want to explain out what you're thinking of here, maybe I'm totally wrong in how I'm doing it. Like, moving to json lines or something would make it more achievable.

@kayrus
Copy link
Copy Markdown
Contributor

kayrus commented Jan 27, 2025

I thought this was a feature to not allow people to export the entire system. :)

if this is PR has a time pressure, then leave it as is. We can improve the performance later on demand.

@notque notque merged commit 098e825 into master Jan 27, 2025
@notque notque deleted the export_swift branch January 27, 2025 17:09
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.

5 participants