Skip to content

feat: Initialize C# client without InfluxDBClientFactory #388

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 17 commits into from
Nov 16, 2022

Conversation

michaelahojna
Copy link
Contributor

@michaelahojna michaelahojna commented Oct 18, 2022

Closes #381

Proposed Changes

Added possibility of initializing InfluxDBClient, InfluxDBClientOptions, WriteOptions and FluxClient without using factory/builder. Examples and documentation were edited to use initializer.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • dotnet test completes successfully
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@michaelahojna michaelahojna marked this pull request as ready for review October 18, 2022 17:57
@michaelahojna michaelahojna requested a review from bednar October 18, 2022 17:57
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Thanks for your PR 👍
There are a few requirements that must be be satisfy before we accept the PR:

@michaelahojna michaelahojna requested a review from bednar October 19, 2022 11:06
@michaelahojna michaelahojna requested a review from bednar October 20, 2022 12:51
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Please refactor also tests to use new initializers (keep one for testing backwards compatibility) and marks current factories as deprecated (add explanation into docs string).

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2022

Codecov Report

Base: 87.56% // Head: 87.13% // Decreases project coverage by -0.43% ⚠️

Coverage data is based on head (3832280) compared to base (5400a84).
Patch coverage: 89.54% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #388      +/-   ##
==========================================
- Coverage   87.56%   87.13%   -0.44%     
==========================================
  Files          77       77              
  Lines        6659     6893     +234     
==========================================
+ Hits         5831     6006     +175     
- Misses        828      887      +59     
Impacted Files Coverage Δ
Client.Legacy/FluxClientFactory.cs 0.00% <ø> (-100.00%) ⬇️
Client/InfluxDBClientOptions.cs 87.17% <84.97%> (-8.23%) ⬇️
Client/Writes/PointSettings.cs 98.00% <90.00%> (-2.00%) ⬇️
Client.Legacy/FluxClient.cs 99.15% <100.00%> (+0.02%) ⬆️
Client/InfluxDBClient.cs 77.81% <100.00%> (+1.79%) ⬆️
Client/InfluxDBClientFactory.cs 88.23% <100.00%> (-0.18%) ⬇️
Client/Internal/ApiClient.cs 90.26% <100.00%> (ø)
Client/WriteOptions.cs 82.90% <100.00%> (-10.34%) ⬇️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@michaelahojna michaelahojna requested a review from bednar October 20, 2022 17:32
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

The InfluxDBClientOptions should be immutable after assignment to the InfluxDBClient. Maybe we can use Init Only Setters or add something like _lock property into InfluxDBClientOptions which will be set after assignment setting to client and checked in InfluxDBClientOptions's setters.

@bednar bednar force-pushed the object-initializer branch from e208391 to 66fb91d Compare November 15, 2022 08:29
@bednar bednar merged commit 9006c29 into master Nov 16, 2022
@bednar bednar deleted the object-initializer branch November 16, 2022 09:14
@bednar bednar added this to the 4.8.0 milestone Nov 16, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialize C# client without InfluxDBClientFactory
3 participants