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

Release 1.6.1 #587

Merged
merged 313 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
313 commits
Select commit Hold shift + click to select a range
028a179
Further updates to clean up merge duplication
vaughanknight Feb 7, 2024
336d52f
Signed-off-by: Vaughan Knight <[email protected]>
vaughanknight Feb 7, 2024
d2d823d
blog posts - unpublished / placeholder posts currently sit in blog_pr…
danuw Feb 11, 2024
859c86a
Merge pull request #459 from Green-Software-Foundation/Readme
danuw Feb 11, 2024
c3d832c
annoucementBar #416 to include disclaimer as well as CarbonHack link
danuw Feb 11, 2024
8b97b4b
CarbonHack24 Update to README.md
danuw Feb 11, 2024
ec96b52
bold disclaimer / banner message
danuw Feb 11, 2024
9567c45
ensuring samples get deployed as part of the docs too
danuw Feb 11, 2024
4527514
working directory correction for moving samples in docs deployment wo…
danuw Feb 11, 2024
ff729b0
normalisation of the workflow name to others
danuw Feb 11, 2024
1bdd2ad
latest docusaurus updates to check the latest workflow
danuw Feb 11, 2024
012ca25
docusaurus broken links build warning + move all samples folder
danuw Feb 11, 2024
62a866f
Update CONTRIBUTING.md
Sophietn Nov 29, 2023
529695f
Update CONTRIBUTING.md
Sophietn Nov 29, 2023
bd09508
Update CHANGELOG.md
danuw Dec 12, 2023
d8f78a0
Update CHANGELOG.md with first draft release notes for 1.2
danuw Dec 12, 2023
aebaf40
Update CHANGELOG.md
danuw Dec 19, 2023
d510f80
Update CHANGELOG.md
danuw Jan 9, 2024
062427b
Update WattTime registration link
pichuang Dec 6, 2023
9f280dd
Update containerization.md
jacksorjacksor Jan 4, 2024
958da20
Create adopters.md
tkuramoto33 Dec 7, 2023
1b8d21e
Add Vestas.
tkuramoto33 Dec 14, 2023
5839a41
Remove a hyphen for consistent appearance
tkuramoto33 Dec 14, 2023
9c8d0ba
Update the description
tkuramoto33 Feb 1, 2024
659e641
Update the description to mention pull requests
tkuramoto33 Feb 2, 2024
587380d
Create enablement.md
rinikeda Dec 15, 2023
a74be26
draft of enablement.md
rinikeda Dec 31, 2023
c416c92
Update carbon-aware-cli.md
JasonLuuk Jan 27, 2024
c7d4563
Initial codespace branch and associated docs
danuw Dec 11, 2023
a51782f
updated vs code extensions
danuw Jan 30, 2024
80d6e59
DCO Remediation Commit for Dan Benitah <[email protected]>
danuw Jan 31, 2024
bd7ad15
Update README.md
vaughanknight Feb 6, 2024
693beed
More updates
vaughanknight Feb 6, 2024
1d78756
Added plcaeholder images
vaughanknight Feb 6, 2024
a7bc0fc
Updated images
vaughanknight Feb 7, 2024
571e217
More updates
vaughanknight Feb 7, 2024
a07870f
Updates with theory of change details
vaughanknight Feb 7, 2024
0314c47
Minor updates, included adopters page link
vaughanknight Feb 7, 2024
3af6f73
Update README.md
vaughanknight Feb 6, 2024
932a665
More updates
vaughanknight Feb 6, 2024
9f09493
Added plcaeholder images
vaughanknight Feb 6, 2024
02ea4d6
Updated images
vaughanknight Feb 7, 2024
183a676
More updates
vaughanknight Feb 7, 2024
0481081
Updates with theory of change details
vaughanknight Feb 7, 2024
042123d
Signed-off-by: Vaughan Knight <[email protected]>
vaughanknight Feb 7, 2024
d6795a0
Update tests.md
danuw Feb 12, 2024
ddc6a26
Merge pull request #461 from Green-Software-Foundation/danuw-carbonha…
Sophietn Feb 12, 2024
c1d006f
Merge pull request #462 from Green-Software-Foundation/docs/test-cove…
Sophietn Feb 12, 2024
e19101a
Update README.md
danuw Feb 12, 2024
5745ba9
adding the banner image
danuw Feb 12, 2024
5798e14
Create SECURITY.md
Willmish Feb 12, 2024
cc15035
merge and bug fixes
danuw Feb 12, 2024
3c62bd4
Qucikstart fix and overview link adjustment following move
danuw Feb 12, 2024
98c4543
Up Helm chart version to 1.1.0
YaSuenag Feb 12, 2024
bfdb8ef
Signed-off-by: Vaughan Knight <[email protected]>
vaughanknight Feb 7, 2024
de8d88c
CarbonHack24 Update to README.md
danuw Feb 11, 2024
1cc4302
Create tests.md
danuw Feb 7, 2024
a3a5da6
Update tests.md
danuw Feb 12, 2024
13becaf
Signed-off-by: Vaughan Knight <[email protected]>
vaughanknight Feb 7, 2024
e0507cf
Merge pull request #463 from Green-Software-Foundation/danuw-hack-ban…
danuw Feb 13, 2024
db78f30
Merge pull request #464 from Willmish/Willmish-patch-securitymd
danuw Feb 13, 2024
751724e
Merge pull request #454 from JasonLuuk/patch-3
danuw Feb 13, 2024
f5a58db
Merge pull request #453 from JasonLuuk/patch-2
danuw Feb 13, 2024
b45c456
Merge pull request #449 from YaSuenag/pr/helm-location-sources
danuw Feb 13, 2024
590f262
blog updates
danuw Feb 13, 2024
20d120b
Merge branch 'dev' into docs/docusaurus
danuw Feb 13, 2024
aa01e63
DCO Remediation Commit for Dan Benitah <[email protected]>
danuw Feb 13, 2024
6aed17f
DCO Remediation Commit for danuw <[email protected]>
danuw Feb 13, 2024
3b8abfa
Update baseURL docusaurus config
osamajandali Feb 14, 2024
3f4fb30
Update docusaurus.config.js
osamajandali Feb 14, 2024
7dcb7d3
Revert changes
osamajandali Feb 14, 2024
53b5d7a
Update domain from docusaurus
osamajandali Feb 14, 2024
6fee055
Update docusaurus.config.js
osamajandali Feb 14, 2024
ee4532b
Create CNAME file
osamajandali Feb 14, 2024
ed464fc
clean up for title
danuw Feb 19, 2024
5f0bbff
Option to show the samples in the local docs using `nm run start-with…
danuw Feb 19, 2024
f5b3eb6
seo for the doc site
danuw Feb 19, 2024
89c1d64
docs fixes
danuw Feb 20, 2024
093ecb4
layout update for blogs
danuw Feb 20, 2024
2dc06f8
Update SECURITY.md
vaughanknight Feb 20, 2024
893439f
DCO Remediation Commit for Vaughan Knight <[email protected]>
vaughanknight Feb 20, 2024
5efc85e
Merge pull request #469 from Green-Software-Foundation/Security-Docum…
danuw Feb 20, 2024
f15a593
Ensure pictures on the blog are correctly sized
danuw Feb 20, 2024
f3c6a73
Merge pull request #466 from Green-Software-Foundation/docs/docusaurus
vaughanknight Feb 20, 2024
8cabb04
updated links to videos
danuw Feb 21, 2024
faf44cb
Update README.md
jacksorjacksor Feb 26, 2024
c062723
Update README.md
jacksorjacksor Feb 26, 2024
834d6b7
Merge pull request #472 from jacksorjacksor/patch-1
danuw Feb 26, 2024
c7e5ecd
first draft of release 1.3 changelog
danuw Feb 26, 2024
7d5e50e
Update README.md with updated link to overview
danuw Feb 27, 2024
85d83d3
Fix overview URL in README
Willmish Feb 27, 2024
fd6b5cd
Update README.md
russelltrow Feb 27, 2024
8776a69
Merge pull request #470 from Green-Software-Foundation/fix/readmefile…
danuw Feb 27, 2024
2788f56
Merge pull request #478 from Green-Software-Foundation/russelltrow-pa…
danuw Feb 27, 2024
f267eba
Updates to the contribution documentation
vaughanknight Feb 27, 2024
3ce2ba3
DCO Remediation Commit for Vaughan Knight <[email protected]>
vaughanknight Feb 27, 2024
57f50a7
Merge pull request #480 from Green-Software-Foundation/vk-contributing
vaughanknight Feb 28, 2024
1e84f60
Merge pull request #475 from Green-Software-Foundation/Changelog-1.3
vaughanknight Mar 5, 2024
fe6797d
Readme as project overview in docs, disclaimer update for graduated p…
danuw Mar 6, 2024
52705a6
DCO Remediation Commit for Vaughan Knight <[email protected]>
vaughanknight Mar 6, 2024
734605d
Merge pull request #485 from Green-Software-Foundation/docs/update-ov…
vaughanknight Mar 6, 2024
9d51f79
Migrate to .NET 8
tiwatsuka Mar 27, 2024
94b428a
fix typos
omahs Mar 27, 2024
58b548c
fix typo
omahs Mar 27, 2024
c2101f8
fix typo
omahs Mar 27, 2024
9eb3fa2
fix typos
omahs Mar 27, 2024
5b3a352
fix typos
omahs Mar 27, 2024
85d113b
fix typos
omahs Mar 27, 2024
fd6db72
Merge pull request #493 from YaSuenag/pr/dotnet8
danuw Apr 3, 2024
9b6dbc2
Update agenda-template.md
Sophietn Apr 9, 2024
38af213
Merge pull request #497 from Green-Software-Foundation/Sophietn-patch-1
Sophietn Apr 9, 2024
abd9e6b
Resolve NU1605 relating to System.IO.FileSystem.Primitives
YaSuenag Apr 10, 2024
da7a254
Use RID rather than QEMU to build WebAPI container image
YaSuenag Apr 10, 2024
6799e5b
Separate OpenAPI document generation from build-env stage
YaSuenag Apr 10, 2024
10104a2
Merge pull request #498 from YaSuenag/pr/containerize-refinement
danuw Apr 10, 2024
5921f99
Merge pull request #494 from omahs/patch-1
danuw Apr 10, 2024
5e2b5ac
Create case-study-template.md
vaughanknight Apr 16, 2024
22c09c3
Update case-study-template.md
vaughanknight Apr 16, 2024
412f185
Up Helm chart version to 1.2.0 (#500)
YaSuenag Apr 23, 2024
b9490e4
First draft of the ADR for watt time v3 changes
vaughanknight May 7, 2024
faae742
Initial changelog 1.4.0 (#511)
danuw May 7, 2024
c6b2c14
overview.md: Fixed three broken links Signed-off-by: joecus1 <joecusa…
joecus1 May 7, 2024
add24fe
DCO Remediation Commit for joecus1 <[email protected]>
joecus1 May 7, 2024
9fb9ba0
Update enablement.md
nttDamien May 8, 2024
cd44f46
(fix) broken links - Update enablement.md
nttDamien May 8, 2024
b991bac
Moved ADR to correct location
vaughanknight May 8, 2024
f4bbf52
Further updates for the watt time v2 to v3 upgrade
vaughanknight May 8, 2024
d6ad67c
Further updates for the watt time v2 to v3 upgrade
vaughanknight May 8, 2024
15a6f9c
Merge branch 'wattime-v3-support' of https://github.com/Green-Softwar…
vaughanknight May 8, 2024
4192933
Update SECURITY.md (.NET 8 upgrade)
nttDamien May 13, 2024
3398e5a
Update enablement.md
nttDamien May 14, 2024
27f41df
Merge pull request #516 from nttDamien/dev
danuw May 14, 2024
85e6c72
Merge pull request #515 from joecus1/dev
danuw May 14, 2024
2664153
Merge branch 'main' into dev
vaughanknight May 14, 2024
f29f4c9
Update docusaurus.config.js
danuw May 14, 2024
a08a9d9
Update docusaurus.config.js
danuw May 14, 2024
db72545
documentation-change.yml: Created issue template for documentation ch…
joecus1 May 15, 2024
cb46877
Update 0016-watt-time-v3.md
vaughanknight May 15, 2024
e324f36
First draft of the ADR for watt time v3 changes
vaughanknight May 7, 2024
be6663c
Moved ADR to correct location
vaughanknight May 8, 2024
17210ed
Further updates for the watt time v2 to v3 upgrade
vaughanknight May 8, 2024
7920786
Update 0016-watt-time-v3.md
vaughanknight May 15, 2024
3a7c681
Add blog article for .NET 8 upgrade
YaSuenag May 16, 2024
1106968
Merge pull request #522 from Green-Software-Foundation/remove-hack24-…
Sophietn May 17, 2024
8f1297a
Update article
YaSuenag May 24, 2024
e4f1494
Create 0016-watt-time-v3.md
vaughanknight May 31, 2024
b443e9e
Added base url to the configuration with validation
vaughanknight May 31, 2024
ab1205d
Updated start and end configuration
vaughanknight May 31, 2024
7c115fa
Balancing Authority Parameter Renamed to Region
vaughanknight May 31, 2024
4f5dbd2
Add example for 'podman play kube' (#340)
YaSuenag Jun 11, 2024
e047c9a
Updates for historical data API
vaughanknight Jun 17, 2024
aa81382
Removed accidental file
vaughanknight Jun 17, 2024
8640c8c
Lots of test updates
vaughanknight Jun 17, 2024
880fcf7
Historical forecasts updated
vaughanknight Jun 17, 2024
92f8dbc
DCO Remediation Commit for Vaughan Knight <[email protected]>
vaughanknight Jun 17, 2024
39e45a6
Many tests reworked, a few to go
vaughanknight Jun 18, 2024
fbfcac1
Further test updates
vaughanknight Jun 18, 2024
0080ae8
Merge branch 'wattime-v3-support' of https://github.com/Green-Softwar…
vaughanknight Jun 18, 2024
f3fd570
Merge branch 'wattime-v3-support' of https://github.com/Green-Softwar…
vaughanknight Jun 18, 2024
9aabd27
Further updates, just 1 test left to remediate
vaughanknight Jun 18, 2024
8127a92
Updated to add authentication client to the service builder for the t…
vaughanknight Jun 18, 2024
4ff0151
Renaming of Balancing Authority to Region
vaughanknight Jun 18, 2024
d93320f
Fixed spelling error in latitude
vaughanknight Jun 18, 2024
91799f7
Fixed a bug where location sources were loading twice
vaughanknight Jun 19, 2024
4665813
Fixed typo for method name
vaughanknight Jun 19, 2024
b228cf7
DCO Remediation Commit for Vaughan Knight <[email protected]>
vaughanknight Jun 19, 2024
8137659
Updates based on code review for WattTime Tests
vaughanknight Jun 19, 2024
f64ec8e
Cleaned up a lot of the string literals
vaughanknight Jun 19, 2024
daa4503
More cleanup of some of the strings
vaughanknight Jun 20, 2024
903a58f
Updates to documentation and changelog
vaughanknight Jun 25, 2024
301db94
Fix
YaSuenag Jun 26, 2024
55b9b10
Merge pull request #532 from Green-Software-Foundation/wattime-v3-sup…
danuw Jun 28, 2024
61420cc
Update azure-regions.json (#536)
danuw Jul 2, 2024
a734c56
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
8bf03bc
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
28e0c2f
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
16ba58b
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
4c72759
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
0daeb94
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
fc11261
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
670b6c0
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
af44de1
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
cee7dd5
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
9af35e5
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
8b7930d
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
bdebd19
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
9a5fa5f
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
7e60a26
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
7dfe8ca
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
d415c3a
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
1d375ab
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
b49f6c1
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
a51a284
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
f30a4a8
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
25c6833
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
5f405b0
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
e80947a
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
ea59427
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
406f7b0
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
42d991e
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
6cecab3
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
bdfb40b
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
a4e5a03
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
0f15148
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
c076597
Update casdk-docs/blog/2024-05-16-dotnet8/index.md
YaSuenag Jul 9, 2024
6cdcabc
Fix comments
YaSuenag Jul 10, 2024
07fb748
Update CHANGELOG.md for v1.5
danuw Jul 12, 2024
05e6a91
Update CHANGELOG.md
danuw Jul 16, 2024
fd2f560
Merge pull request #541 from Green-Software-Foundation/Changelog-1.5
danuw Jul 17, 2024
01465dd
Add env directive to values.yaml and troubleshooting guide to avoid i…
YaSuenag Jun 13, 2024
a9d1690
Add env directive into explanation of values.yaml for Helm chart
YaSuenag Jul 20, 2024
4123038
Merge branch 'main' into dev
vaughanknight Jul 23, 2024
1c57aee
Merge pull request #523 from joecus1/dev
danuw Jul 23, 2024
6bbd05e
Merge pull request #524 from YaSuenag/pr/dotnet8-blog
danuw Aug 6, 2024
878f630
typo: fix incorrect usage of it's
trent-s Aug 13, 2024
0b092c9
Docs/blog update for releases 1.3 to1.5 and fix (#551)
danuw Aug 13, 2024
5f0ed0c
Merge branch 'Green-Software-Foundation:dev' into dev
trent-s Aug 13, 2024
89a5ba3
Merge pull request #553 from trent-s/dev
danuw Aug 14, 2024
ecda90d
Add a configuration for disabling to cache JSON emission data
YaSuenag Aug 24, 2024
e67716d
Merge pull request #555 from YaSuenag/pr/update-json-emissiondata
danuw Aug 27, 2024
4a8aa9e
Merge pull request #544 from YaSuenag/pr/inotify
danuw Aug 27, 2024
a036409
Update CHANGELOG.md for 1.6
danuw Sep 10, 2024
d5bd112
Merge pull request #560 from Green-Software-Foundation/Changelog-1.6
danuw Sep 17, 2024
93d9ba2
Merge branch 'main' into dev
danuw Sep 17, 2024
d81d12c
Update 1-pr.yaml
danuw Sep 18, 2024
48d743b
Update dev_carbon-aware-api.yml
danuw Sep 18, 2024
5a5ba8f
Merge pull request #562 from Green-Software-Foundation/hotfix/discrep…
danuw Sep 18, 2024
705e72e
fixes and release notes post for 1.6
danuw Sep 19, 2024
d3b054b
updated blog post
danuw Sep 24, 2024
f412591
docs workflow's node version updated to latest LTS -> 22
danuw Sep 24, 2024
2057c32
DCO Remediation Commit for Dan Benitah <[email protected]>
danuw Sep 24, 2024
cefcd73
blogs with truncate
danuw Sep 24, 2024
3d265a1
node version update back to 20
danuw Sep 24, 2024
eae5bd1
adding yarn.lock
danuw Sep 24, 2024
dfea675
pipelines fixes
danuw Sep 24, 2024
e8b8e84
Update CarbonAwareController.cs (minor typos)
jacksorjacksor Sep 24, 2024
e8e7530
DCO Remediation Commit for Dan Benitah <[email protected]>
danuw Sep 24, 2024
c50f5f5
Merge pull request #568 from Green-Software-Foundation/docs/hotfix
danuw Sep 24, 2024
f05dcf4
Merge pull request #569 from jacksorjacksor/patch-1
danuw Sep 24, 2024
0afba03
Consider null value in carbonIntensity on EM (#575)
YaSuenag Oct 15, 2024
0cd1998
EM datasource didn't filter out-of-range emission data (#572)
YaSuenag Oct 15, 2024
e7def2b
Update CHANGELOG.md
danuw Oct 29, 2024
ead82a2
Merge pull request #580 from Green-Software-Foundation/Changelog-1.6.1
danuw Oct 29, 2024
b502723
Add configuration for tracing log (#531)
YaSuenag Nov 5, 2024
f35bb59
Updating 1.6.1 to include #531 straight away
danuw Nov 5, 2024
a3290f1
DCO Remediation Commit for Dan Benitah <[email protected]
danuw Nov 5, 2024
c723398
fix
danuw Nov 5, 2024
08560c3
Merge pull request #582 from Green-Software-Foundation/Changelog-1.6.…
danuw Nov 5, 2024
8ade7de
Merge branch 'main' into hotfix/1.6.1-merge-issues
danuw Nov 12, 2024
e7ba0ff
Merge pull request #586 from Green-Software-Foundation/hotfix/1.6.1-m…
danuw Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to the Carbon Aware SDK will be documented in this file.

## [1.6.1] - 2024-11

Release addressing minor issues [https://github.com/Green-Software-Foundation/carbon-aware-sdk/labels/v1.6.1](https://github.com/Green-Software-Foundation/carbon-aware-sdk/labels/v1.6.1)

### Added

- [PR #531] Add configuration for tracing log](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/531)

### Fixed

- [PR #575] Consider null value in carbonIntensity on EM ](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/575)
- [PR #572] EM datasource didn't filter out-of-range emission data ](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/572)

For more details, checkout [https://github.com/Green-Software-Foundation/carbon-aware-sdk/issues/579](https://github.com/Green-Software-Foundation/carbon-aware-sdk/issues/579)

## [1.6.0] - 2024-09

Release for milestone https://github.com/Green-Software-Foundation/carbon-aware-sdk/milestone/8?closed=1 with general bugs fixes and improvements
Expand Down
10 changes: 10 additions & 0 deletions casdk-docs/docs/tutorial-extras/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,16 @@ InstrumentationKey. For more details, please refer to
AppInsights_InstrumentationKey="AppInsightsInstrumentationKey"
```

#### Configuring telemetry log

WebAPI configures [console exporter of OpenTelemetry](https://opentelemetry.io/docs/languages/net/exporters/#console) by default.
You can configure whether the exporter is enabled with `EnableTelemetryLogging`.
Set `false` if you want to reduce the log.

```bash
CarbonAwareVars__EnableTelemetryLogging=false
```

### Prometheus exporter for emissions data

> DISCLAIMER: The `/metrics` Prometheus exporter is currently unsupported, and is used for internal GSF needs, and may change in the future. It will retrieve _all_ emissions data and create heavy load on your data API's. It is turned off by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@ private async Task<IEnumerable<CarbonIntensity>> GetRecentCarbonInstensityData(L

private IEnumerable<EmissionsData> HistoryCarbonIntensityToEmissionsData(Location location, IEnumerable<CarbonIntensity> data, DateTimeOffset startTime, DateTimeOffset endTime)
{
IEnumerable<EmissionsData> emissions;
var duration = GetDurationFromHistoryDataPointsOrDefault(data, TimeSpan.Zero);
emissions = data.Select(d =>
{
var emission = (EmissionsData) d;
emission.Location = location.Name ?? string.Empty;
emission.Time = d.DateTime;
emission.Duration = duration;
return emission;
});

return emissions;
return data.Where(d => ((startTime <= d.DateTime) && (d.DateTime < endTime)) ||
((startTime <= d.DateTime.Add(duration)) && (d.DateTime.Add(duration) < endTime)) ||
((d.DateTime < startTime) && (endTime < d.DateTime.Add(duration))))
.Select(d =>
{
var emission = (EmissionsData)d;
emission.Location = location.Name ?? string.Empty;
emission.Time = d.DateTime;
emission.Duration = duration;
return emission;
});
}

private TimeSpan GetDurationFromHistoryDataPointsOrDefault(IEnumerable<CarbonIntensity> carbonIntensityDataPoints, TimeSpan defaultValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal record CarbonIntensity
/// Carbon Intensity value.
/// </summary>
[JsonPropertyName("carbonIntensity")]
public int Value { get; init; }
public int? Value { get; init; }

/// <summary>
/// Indicates the datetime of the carbon intensity
Expand Down Expand Up @@ -74,7 +74,7 @@ public static explicit operator EmissionsData(CarbonIntensity historyCarbonInten
{
return new EmissionsData
{
Rating = historyCarbonIntensity.Value,
Rating = historyCarbonIntensity.Value ?? -1,
Time = historyCarbonIntensity.UpdatedAt,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Moq.Protected;
using Moq.Contrib.HttpClient;
using System.Text.Json;
using CarbonAware.Model;

namespace CarbonAware.DataSources.ElectricityMaps.Tests;

Expand Down Expand Up @@ -299,4 +300,36 @@
.ReturnsResponse(statusCode);
}
}

[Test]
public async Task GetRecentCarbonIntensityHistoryAsync_DeserializesExpectedResponseWithNull()
{
AddHandler_RequestResponse(r =>
{
return r.Method == HttpMethod.Get;
}, System.Net.HttpStatusCode.OK, TestData.GetHistoryCarbonIntensityDataJsonStringWithNull());

var client = new ElectricityMapsClient(this.HttpClientFactory, this.Options.Object, this.Log.Object);

// Act
var data = await client.GetRecentCarbonIntensityHistoryAsync(TestLatitude, TestLongitude);
var dataPoint = data?.HistoryData.First();

// Assert
Assert.That(data, Is.Not.Null);
Assert.That(data?.Zone, Is.EqualTo(TestZone));
Assert.That(data?.HistoryData.Count(), Is.GreaterThan(0));
Assert.Multiple(() =>
{
Assert.That(dataPoint?.DateTime, Is.EqualTo(new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero)));
Assert.That(dataPoint?.UpdatedAt, Is.EqualTo(new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero)));
Assert.That(dataPoint?.CreatedAt, Is.EqualTo(new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero)));
Assert.That(dataPoint?.Value, Is.Null);
Assert.That(((EmissionsData)dataPoint).Rating, Is.EqualTo(-1));

Check warning on line 328 in src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/test/Client/ElectricityMapsClientTests.cs

View workflow job for this annotation

GitHub Actions / sln-build-and-test (csharp)

Possible null reference argument for parameter 'historyCarbonIntensity' in 'CarbonIntensity.explicit operator EmissionsData(CarbonIntensity historyCarbonIntensity)'.

Check warning on line 328 in src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/test/Client/ElectricityMapsClientTests.cs

View workflow job for this annotation

GitHub Actions / webapp-container-dotnet-build

Possible null reference argument for parameter 'historyCarbonIntensity' in 'CarbonIntensity.explicit operator EmissionsData(CarbonIntensity historyCarbonIntensity)'.

Check warning on line 328 in src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/test/Client/ElectricityMapsClientTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Possible null reference argument for parameter 'historyCarbonIntensity' in 'CarbonIntensity.explicit operator EmissionsData(CarbonIntensity historyCarbonIntensity)'.
Assert.That(dataPoint?.EmissionFactorType, Is.EqualTo("lifecycle"));
Assert.That(dataPoint?.IsEstimated, Is.False);
Assert.That(dataPoint?.EstimationMethod, Is.Null);
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,28 @@ public static string GetCurrentForecastJsonString()

return json.ToString();
}

public static string GetHistoryCarbonIntensityDataJsonStringWithNull()
{
var json = new JsonObject
{
["zone"] = TestZoneId1,
["history"] = new JsonArray
{
new JsonObject
{
["datetime"] = new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero),
["updatedAt"] = new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero),
["createdAt"] = new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero),
["carbonIntensity"] = null,
["emissionFactorType"] = "lifecycle",
["isEstimated"] = false,
["estimatedMethod"] = null,
}
}
};

return json.ToString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public async Task GetCarbonIntensity_CallsExpectedClientEndpoint(int startTimeOf
public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRecordsFound()
{
var startDate = DateTimeOffset.UtcNow.AddHours(-10);
var expectedDate = startDate.AddMinutes(-10);
var endDate = startDate.AddHours(1);
var expectedCarbonIntensity = 100;

Expand All @@ -145,10 +146,12 @@ public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRe
{
new CarbonIntensity()
{
Value = expectedCarbonIntensity,
DateTime = startDate.AddMinutes(-40), // out of range
Value = 0,
},
new CarbonIntensity()
{
DateTime = expectedDate,
Value = expectedCarbonIntensity,
}
}
Expand All @@ -162,10 +165,11 @@ public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRe
var result = await this._dataSource.GetCarbonIntensityAsync(new List<Location>() { _defaultLocation }, startDate, endDate);

Assert.IsNotNull(result);
Assert.That(result.Count(), Is.EqualTo(2));
Assert.That(result.Count(), Is.EqualTo(1));

var first = result.First();
Assert.IsNotNull(first);
Assert.That(expectedDate, Is.EqualTo(first.Time));
Assert.That(first.Rating, Is.EqualTo(expectedCarbonIntensity));
Assert.That(first.Location, Is.EqualTo(_defaultLocation.Name));

Expand All @@ -176,6 +180,7 @@ public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRe
public async Task GetCarbonIntensity_DateRangeMore24Hours_ReturnsResultsWhenRecordsFound()
{
var startDate = _defaultDataStartTime;
var expectedDate = startDate.AddMinutes(-10);
var endDate = startDate.AddHours(1);
var expectedCarbonIntensity = 100;

Expand All @@ -187,10 +192,12 @@ public async Task GetCarbonIntensity_DateRangeMore24Hours_ReturnsResultsWhenReco
{
new CarbonIntensity()
{
Value = expectedCarbonIntensity,
DateTime = startDate.AddMinutes(-40), // out of range
Value = 0,
},
new CarbonIntensity()
{
DateTime = expectedDate,
Value = expectedCarbonIntensity,
}
}
Expand All @@ -206,10 +213,11 @@ public async Task GetCarbonIntensity_DateRangeMore24Hours_ReturnsResultsWhenReco
var result = await this._dataSource.GetCarbonIntensityAsync(new List<Location>() { _defaultLocation }, startDate, endDate);

Assert.IsNotNull(result);
Assert.That(result.Count(), Is.EqualTo(2));
Assert.That(result.Count(), Is.EqualTo(1));

var first = result.First();
Assert.IsNotNull(first);
Assert.That(expectedDate, Is.EqualTo(first.Time));
Assert.That(first.Rating, Is.EqualTo(expectedCarbonIntensity));
Assert.That(first.Location, Is.EqualTo(_defaultLocation.Name));

Expand Down Expand Up @@ -261,7 +269,9 @@ public async Task GetDurationBetweenHistoryDataPoints_ReturnsDefaultDuration_Whe
{
HistoryData = new List<CarbonIntensity>()
{
new CarbonIntensity()
new CarbonIntensity(){
DateTime = startDate.AddMinutes(30),
},
}
};

Expand All @@ -285,7 +295,7 @@ public async Task GetDurationBetweenHistoryDataPoints_WhenMultipleDataPoints_Ret
{
var startDate = DateTimeOffset.UtcNow.AddHours(-8);
var endDate = startDate.AddHours(1);
var expectedDuration = TimeSpan.FromHours(1);
var expectedDuration = TimeSpan.FromMinutes(59);
// Arrange
_locationSource.Setup(l => l.ToGeopositionLocationAsync(_defaultLocation)).Returns(Task.FromResult(_defaultLocation));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Microsoft.Extensions.Options;
using CarbonAware.WebApi.Metrics;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;

namespace CarbonAware.WebApi.Configuration;

Expand Down Expand Up @@ -32,7 +34,23 @@
// Can be extended in the future to support a different provider like Zipkin, Prometheus etc
}

var enableTelemetryLogging = envVars?.EnableTelemetryLogging ?? true;
if (enableTelemetryLogging)
{
const string serviceName = "CarbonAware.WebAPI";
const string serviceVersion = "1.0.0";

services.AddOpenTelemetry()
.WithTracing(tracerProviderBuilder =>
tracerProviderBuilder
.AddConsoleExporter()
.AddSource(serviceName)
.SetResourceBuilder(
ResourceBuilder.CreateDefault()
.AddService(serviceName: serviceName, serviceVersion: serviceVersion))
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation());
}
}

public static IServiceCollection AddCarbonExporter(this IServiceCollection services, IConfiguration configuration)
Expand Down Expand Up @@ -88,7 +106,7 @@
public static ILogger CreateConsoleLogger(IConfiguration? config)
{
var factory = LoggerFactory.Create(b => {
b.AddConfiguration(config?.GetSection("Logging"));

Check warning on line 109 in src/CarbonAware.WebApi/src/Configuration/ServiceCollectionExtensions.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'configuration' in 'ILoggingBuilder LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration)'.

Check warning on line 109 in src/CarbonAware.WebApi/src/Configuration/ServiceCollectionExtensions.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'configuration' in 'ILoggingBuilder LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration)'.

Check warning on line 109 in src/CarbonAware.WebApi/src/Configuration/ServiceCollectionExtensions.cs

View workflow job for this annotation

GitHub Actions / sln-build-and-test (csharp)

Possible null reference argument for parameter 'configuration' in 'ILoggingBuilder LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration)'.

Check warning on line 109 in src/CarbonAware.WebApi/src/Configuration/ServiceCollectionExtensions.cs

View workflow job for this annotation

GitHub Actions / webapp-container-dotnet-build

Possible null reference argument for parameter 'configuration' in 'ILoggingBuilder LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration)'.

Check warning on line 109 in src/CarbonAware.WebApi/src/Configuration/ServiceCollectionExtensions.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Possible null reference argument for parameter 'configuration' in 'ILoggingBuilder LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration)'.
b.AddConsole();
});
return factory.CreateLogger<IServiceCollection>();
Expand Down
18 changes: 0 additions & 18 deletions src/CarbonAware.WebApi/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,11 @@
using GSF.CarbonAware.Configuration;
using GSF.CarbonAware.Exceptions;
using Microsoft.OpenApi.Models;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using OpenTelemetry.Metrics;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Reflection;

// Define constants to initialize tracing with
var serviceName = "CarbonAware.WebAPI";
var serviceVersion = "1.0.0";

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetry()
.WithTracing(tracerProviderBuilder =>
tracerProviderBuilder
.AddConsoleExporter()
.AddSource(serviceName)
.SetResourceBuilder(
ResourceBuilder.CreateDefault()
.AddService(serviceName: serviceName, serviceVersion: serviceVersion))
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation());

// Add services to the container.
builder.Services.AddControllers(options =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using NUnit.Framework.Internal;
using OpenTelemetry.Trace;
using Microsoft.ApplicationInsights;

namespace CarbonAware.WepApi.UnitTests;

Expand All @@ -21,7 +23,7 @@
{ "ApplicationInsights_Connection_String", "AppInsightsConnectionString" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)

Check warning on line 26 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / sln-build-and-test (csharp)

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.

Check warning on line 26 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / webapp-container-dotnet-build

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.

Check warning on line 26 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.
.Build();

// Act & Assert
Expand All @@ -40,7 +42,7 @@
{ "AppInsights_InstrumentationKey", "AppInsightsInstrumentationKey" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)

Check warning on line 45 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / sln-build-and-test (csharp)

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.

Check warning on line 45 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / webapp-container-dotnet-build

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.

Check warning on line 45 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.
.Build();

// Act & Assert
Expand All @@ -58,7 +60,7 @@
{ "CarbonAwareVars:TelemetryProvider", "ApplicationInsights" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)

Check warning on line 63 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / sln-build-and-test (csharp)

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.

Check warning on line 63 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / webapp-container-dotnet-build

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.

Check warning on line 63 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.
.Build();

// Act & Assert
Expand All @@ -74,13 +76,13 @@

var inMemorySettings = new Dictionary<string, string>{};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)

Check warning on line 79 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.
.Build();

// Act & Assert
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
Assert.That(services.Count, Is.EqualTo(0));
}
Assert.Null(services.BuildServiceProvider().GetService<TelemetryClient>());
}

[Test]
public void AddCarbonExporter_AddsServices_IsEnabledInConfiguration()
Expand All @@ -93,7 +95,7 @@
{ "CarbonAwareVars:EnableCarbonExporter", "true" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)

Check warning on line 98 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.
.Build();

// Act & Assert
Expand All @@ -112,7 +114,7 @@
{ "CarbonAwareVars:EnableCarbonExporter", "false" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)

Check warning on line 117 in src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / api-comparison

Argument of type 'Dictionary<string, string>' cannot be used for parameter 'initialData' of type 'IEnumerable<KeyValuePair<string, string?>>' in 'IConfigurationBuilder MemoryConfigurationBuilderExtensions.AddInMemoryCollection(IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)' due to differences in the nullability of reference types.
.Build();

// Act & Assert
Expand Down Expand Up @@ -156,4 +158,58 @@
// Assert
Assert.That(logger, Is.Not.Null);
}

[Test]
public void EnableTelemetryLogging_AddsServices_WithoutConfiguration()
{
// Arrange
var services = new ServiceCollection();

var inMemorySettings = new Dictionary<string, string> { };
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)
.Build();

// Act & Assert
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
Assert.NotNull(services.BuildServiceProvider().GetService<TracerProvider>());
}

[Test]
public void EnableTelemetryLogging_AddsServices_IsEnabledInConfiguration()
{
// Arrange
var services = new ServiceCollection();

var inMemorySettings = new Dictionary<string, string>
{
{ "CarbonAwareVars:EnableTelemetryLogging", "true" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)
.Build();

// Act & Assert
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
Assert.NotNull(services.BuildServiceProvider().GetService<TracerProvider>());
}

[Test]
public void EnableTelemetryLogging_AddsServices_IsDisabledInConfiguration()
{
// Arrange
var services = new ServiceCollection();

var inMemorySettings = new Dictionary<string, string>
{
{ "CarbonAwareVars:EnableTelemetryLogging", "false" }
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)
.Build();

// Act & Assert
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
Assert.Null(services.BuildServiceProvider().GetService<TracerProvider>());
}
}
Loading
Loading