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

feat: Implement Default Logging Hook #308

Merged
merged 12 commits into from
Jan 23, 2025

Conversation

kylejuliandev
Copy link
Contributor

@kylejuliandev kylejuliandev commented Oct 4, 2024

This PR

  • Adds in default Logging Hook

Related Issues

Fixes #299

Notes

Follow-up Tasks

How to test

@beeme1mr
Copy link
Member

beeme1mr commented Oct 9, 2024

Hey @kylejuliandev, thanks for the PR. Could you please sign off your commits? The CNCF requires you to acknowledge that you're willing and able to donate this code.

To add your Signed-off-by line to every commit in this branch:

Thanks!

@kylejuliandev kylejuliandev force-pushed the feat/add-logging-hook branch from d5d08f7 to b4b4765 Compare October 9, 2024 21:18
@kylejuliandev
Copy link
Contributor Author

Hi @beeme1mr!

No worries, I've pushed up the signed commits now. Happy to donate this code, although it is incomplete at the moment. Will resume and get some unit tests in. Logging semantics (log IDs, log levels, content, etc...) are still left to determine - although I have tried to adhere to the spec

@askpt
Copy link
Member

askpt commented Jan 9, 2025

Hey, @kylejuliandev!

Great work on this PR; everything seems good to go. As you pointed out, however, a few unit tests are missing to get this PR out. Would you like some help?

Just a tiny suggestion: I would move the src/OpenFeature/LoggingHook.cs file into src/OpenFeature/Hooks/LoggingHook.cs and change the namespace to OpenFeature.Hooks.

@kylejuliandev
Copy link
Contributor Author

Thanks for the reminder @askpt - I completely forgot about this, my bad!

I have added some unit tests now to cover the LoggingHook. I suspect another task may include updating the README for guidance on how to use the hook.

@kylejuliandev kylejuliandev force-pushed the feat/add-logging-hook branch from 0f48130 to dff409c Compare January 9, 2025 21:04
@kylejuliandev kylejuliandev force-pushed the feat/add-logging-hook branch from dff409c to ea2b393 Compare January 9, 2025 21:15
@beeme1mr
Copy link
Member

beeme1mr commented Jan 9, 2025

I suspect another task may include updating the README for guidance on how to use the hook.

Yes please! Here's an example from the Java SDK. Thanks

https://github.com/open-feature/java-sdk?tab=readme-ov-file#logging-hook

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 94.04762% with 5 lines in your changes missing coverage. Please review.

Project coverage is 86.13%. Comparing base (f994234) to head (9ecb92d).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/OpenFeature/Hooks/LoggingHook.cs 94.04% 1 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #308      +/-   ##
==========================================
+ Coverage   85.49%   86.13%   +0.63%     
==========================================
  Files          38       39       +1     
  Lines        1517     1601      +84     
  Branches      154      173      +19     
==========================================
+ Hits         1297     1379      +82     
+ Misses        188      186       -2     
- Partials       32       36       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kylejuliandev kylejuliandev marked this pull request as ready for review January 9, 2025 21:45
@kylejuliandev kylejuliandev requested a review from a team as a code owner January 9, 2025 21:45
Copy link
Member

@askpt askpt left a comment

Choose a reason for hiding this comment

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

Added a few comments.

src/OpenFeature/Hooks/LoggingHook.cs Outdated Show resolved Hide resolved
src/OpenFeature/Hooks/LoggingHook.cs Outdated Show resolved Hide resolved
* Adopt StringBuilder.AppendLine instead of manually referring to
  Environment.NewLine
* Use null-coalescing operator inplace of adding a if null check

Signed-off-by: Kyle Julian <[email protected]>
* Suppress ConfigureAwait warnings in unit test class

Signed-off-by: Kyle Julian <[email protected]>
@beeme1mr beeme1mr merged commit 7013e95 into open-feature:main Jan 23, 2025
15 checks passed
@kylejuliandev kylejuliandev deleted the feat/add-logging-hook branch January 23, 2025 22:26
toddbaert added a commit that referenced this pull request Jan 31, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.3.0](v2.2.0...v2.3.0)
(2025-01-31)


### ⚠ BREAKING CHANGES

#### Hook Changes

The signature of the `finally` hook stage has been changed. The
signature now includes the `evaluation details`, as per the [OpenFeature
specification](https://openfeature.dev/specification/sections/hooks#requirement-438).
Note that since hooks are still `experimental,` this does not constitute
a change requiring a new major version. To migrate, update any hook that
implements the `finally` stage to accept `evaluation details` as the
second argument.

* Add evaluation details to finally hook stage
([#335](#335))
([2ef9955](2ef9955))

#### .NET 6

Removed support for .NET 6.

* add dotnet 9 support, rm dotnet 6
([#317](#317))
([2774b0d](2774b0d))

### 🐛 Bug Fixes

* Adding Async Lifetime method to fix flaky unit tests
([#333](#333))
([e14ab39](e14ab39))
* Fix issue with DI documentation
([#350](#350))
([728ae47](728ae47))


### ✨ New Features

* add dotnet 9 support, rm dotnet 6
([#317](#317))
([2774b0d](2774b0d))
* Add evaluation details to finally hook stage
([#335](#335))
([2ef9955](2ef9955))
* Implement Default Logging Hook
([#308](#308))
([7013e95](7013e95))
* Implement transaction context
([#312](#312))
([1b5a0a9](1b5a0a9))


### 🧹 Chore

* **deps:** update actions/upload-artifact action to v4.5.0
([#332](#332))
([fd68cb0](fd68cb0))
* **deps:** update codecov/codecov-action action to v5
([#316](#316))
([6c4cd02](6c4cd02))
* **deps:** update codecov/codecov-action action to v5.1.2
([#334](#334))
([b9ebddf](b9ebddf))
* **deps:** update codecov/codecov-action action to v5.3.1
([#355](#355))
([1e8ebc4](1e8ebc4))
* **deps:** update dependency coverlet.collector to 6.0.3
([#336](#336))
([8527b03](8527b03))
* **deps:** update dependency coverlet.msbuild to 6.0.3
([#337](#337))
([26fd235](26fd235))
* **deps:** update dependency dotnet-sdk to v9.0.101
([#339](#339))
([dd26ad6](dd26ad6))
* **deps:** update dependency fluentassertions to 7.1.0
([#346](#346))
([dd1c8e4](dd1c8e4))
* **deps:** update dependency microsoft.net.test.sdk to 17.12.0
([#322](#322))
([6f5b049](6f5b049))


### 📚 Documentation

* disable space in link text lint rule
([#329](#329))
([583b2a9](583b2a9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: Todd Baert <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Todd Baert <[email protected]>
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.

[FEATURE] Implement Logging Hook
4 participants