Skip to content

Commit 92d0e5e

Browse files
danuwvaughanknightSophietnpichuangjacksorjacksor
authored
Release 1.6.1 (#587)
* Further updates to clean up merge duplication * Signed-off-by: Vaughan Knight <[email protected]> DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: da70ec4 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6be74ff I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: fe5cef9 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b4a7973 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: d0a954a I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 996d084 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 648a1ce I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 581267c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 3c90f55 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6c1514e I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0592710 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: c59057c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0cec58f I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 028a179 Signed-off-by: Vaughan Knight <[email protected]> * blog posts - unpublished / placeholder posts currently sit in blog_preview sub folder * annoucementBar #416 to include disclaimer as well as CarbonHack link * CarbonHack24 Update to README.md Signed-off-by: Dan Benitah <[email protected]> * bold disclaimer / banner message * ensuring samples get deployed as part of the docs too * working directory correction for moving samples in docs deployment workflow * normalisation of the workflow name to others * latest docusaurus updates to check the latest workflow * docusaurus broken links build warning + move all samples folder * Update CONTRIBUTING.md Signed-off-by: Sophie Trinder <[email protected]> * Update CONTRIBUTING.md Signed-off-by: Sophie Trinder <[email protected]> * Update CHANGELOG.md Signed-off-by: Dan Benitah <[email protected]> * Update CHANGELOG.md with first draft release notes for 1.2 Signed-off-by: Dan Benitah <[email protected]> * Update CHANGELOG.md Signed-off-by: Dan Benitah <[email protected]> * Update CHANGELOG.md Updating release date Signed-off-by: Dan Benitah <[email protected]> * Update WattTime registration link Signed-off-by: Phil Huang <[email protected]> * Update containerization.md Small typo ("arbon" => "Carbon") Signed-off-by: Richard Jackson <[email protected]> * Create adopters.md Signed-off-by: tkuramoto33 <[email protected]> * Add Vestas. Signed-off-by: tkuramoto33 <[email protected]> * Remove a hyphen for consistent appearance Signed-off-by: tkuramoto33 <[email protected]> * Update the description Signed-off-by: tkuramoto33 <[email protected]> * Update the description to mention pull requests Signed-off-by: tkuramoto33 <[email protected]> * Create enablement.md table of content Signed-off-by: Rintaro Ikeda <[email protected]> * draft of enablement.md Signed-off-by: Rintaro Ikeda <[email protected]> * Update carbon-aware-cli.md Fixes bugs with Linux scripts Signed-off-by: JasonLuuk <[email protected]> * Initial codespace branch and associated docs * updated vs code extensions * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 44578f4 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 3ae9a00 Signed-off-by: Dan Benitah <[email protected]> * Update README.md * More updates More updates * Added plcaeholder images Added plcaeholder images * Updated images Updates all images and compressed some images, cleaned up naming for the avif file. * More updates New images, and some updates to the copy after stepping away from it for a bit. * Updates with theory of change details Updates with theory of change details * Minor updates, included adopters page link Minor updates, included adopters page link * Update README.md * More updates More updates * Added plcaeholder images Added plcaeholder images * Updated images Updates all images and compressed some images, cleaned up naming for the avif file. * More updates New images, and some updates to the copy after stepping away from it for a bit. * Updates with theory of change details Updates with theory of change details * Signed-off-by: Vaughan Knight <[email protected]> DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: da70ec4 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6be74ff I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: fe5cef9 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b4a7973 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: d0a954a I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 996d084 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 648a1ce I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 581267c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 3c90f55 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6c1514e I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0592710 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: c59057c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0cec58f I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 028a179 Signed-off-by: Vaughan Knight <[email protected]> * Update tests.md our current coverage is 74.6% so adjusting until we can improve Signed-off-by: Dan Benitah <[email protected]> * Update README.md linking to the new banner Signed-off-by: Dan Benitah <[email protected]> * adding the banner image Signed-off-by: Dan Benitah <[email protected]> * Create SECURITY.md * merge and bug fixes * Qucikstart fix and overview link adjustment following move * Up Helm chart version to 1.1.0 Signed-off-by: Yasumasa Suenaga <[email protected]> * Signed-off-by: Vaughan Knight <[email protected]> DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: da70ec4 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6be74ff I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: fe5cef9 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b4a7973 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: d0a954a I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 996d084 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 648a1ce I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 581267c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 3c90f55 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6c1514e I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0592710 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: c59057c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0cec58f I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 028a179 Signed-off-by: Vaughan Knight <[email protected]> * CarbonHack24 Update to README.md Signed-off-by: Dan Benitah <[email protected]> * Create tests.md test coverage #413 Signed-off-by: Dan Benitah <[email protected]> * Update tests.md our current coverage is 74.6% so adjusting until we can improve Signed-off-by: Dan Benitah <[email protected]> * Signed-off-by: Vaughan Knight <[email protected]> DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: da70ec4 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6be74ff I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: fe5cef9 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b4a7973 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: d0a954a I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 996d084 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 648a1ce I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 581267c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 3c90f55 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 6c1514e I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0592710 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: c59057c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0cec58f I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 028a179 Signed-off-by: Vaughan Knight <[email protected]> * blog updates * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 356ce09 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 2c342a8 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 04be596 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: c437b5b I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 46958d9 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 21a0e16 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 8bbe72e I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 62e2a95 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 5183d73 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 93267d6 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: ee8841c I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 2d7b4dd I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 68bbb2f I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 735a515 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: a31b391 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: b7483b6 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 4cece7b I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 83f3073 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 4799d7a I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: d2d823d I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: c3d832c I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: ec96b52 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 9567c45 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 4527514 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: ff729b0 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 1bdd2ad I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 012ca25 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: c7d4563 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: a51782f I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: cc15035 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 3c62bd4 I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 590f262 Signed-off-by: Dan Benitah <[email protected]> DCO Remediation Commit for danuw <[email protected]> I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: fbc602c I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: ac1432f I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: 8166cf2 I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: 48f117e Signed-off-by: danuw <[email protected]> * DCO Remediation Commit for danuw <[email protected]> I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: fbc602c I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: ac1432f I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: 8166cf2 I, danuw <[email protected]>, hereby add my Signed-off-by to this commit: 48f117e Signed-off-by: danuw <[email protected]> Signed-off-by: Dan Benitah <[email protected]> * Update baseURL docusaurus config Signed-off-by: Osama Jandali <[email protected]> * Update docusaurus.config.js Signed-off-by: Osama Jandali <[email protected]> * Revert changes Signed-off-by: Osama Jandali <[email protected]> * Update domain from docusaurus Signed-off-by: Osama Jandali <[email protected]> * Update docusaurus.config.js Signed-off-by: Osama Jandali <[email protected]> * Create CNAME file Signed-off-by: Osama Jandali <[email protected]> * clean up for title * Option to show the samples in the local docs using `nm run start-with-samples` . Will need deleting manually for now * seo for the doc site * docs fixes * layout update for blogs * Update SECURITY.md Updated with @Willmish recommendations for the document which were lost in a comment 👍 * DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 2dc06f8 Signed-off-by: Vaughan Knight <[email protected]> * Ensure pictures on the blog are correctly sized * updated links to videos * Update README.md * Change "Withing" to "Within" I'm genuinely unsure on what word this should be, possible "Using", but I'm sure it's not "Withing". Signed-off-by: Richard Jackson <[email protected]> * Update README.md Two other typos - programatically -> programmatically - soruces -> sources Signed-off-by: Richard Jackson <[email protected]> * first draft of release 1.3 changelog * Update README.md with updated link to overview Signed-off-by: Dan Benitah <[email protected]> * Fix overview URL in README Signed-off-by: Szymon Duchniewicz <[email protected]> * Update README.md Update FAQ link for Carbon Hack Signed-off-by: Russell Trow <[email protected]> * Updates to the contribution documentation Updates to the contribution documentation * DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: f267eba Signed-off-by: Vaughan Knight <[email protected]> * Readme as project overview in docs, disclaimer update for graduated project, and docs deploying pipeline updates * DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: bd7ad15 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 693beed I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 1d78756 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: a7bc0fc I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 571e217 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: a07870f I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0314c47 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 3af6f73 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 932a665 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 9f09493 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 02ea4d6 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 183a676 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 0481081 Signed-off-by: Vaughan Knight <[email protected]> * Migrate to .NET 8 #404 #420 #421 #422 Co-authored-by: Takuya Iwatsuka <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * fix typos Signed-off-by: omahs <[email protected]> * fix typo Signed-off-by: omahs <[email protected]> * fix typo Signed-off-by: omahs <[email protected]> * fix typos Signed-off-by: omahs <[email protected]> * fix typos Signed-off-by: omahs <[email protected]> * fix typos Signed-off-by: omahs <[email protected]> * Update agenda-template.md Signed-off-by: Sophie Trinder <[email protected]> * Resolve NU1605 relating to System.IO.FileSystem.Primitives https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605#example-3 Signed-off-by: Yasumasa Suenaga <[email protected]> * Use RID rather than QEMU to build WebAPI container image https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/ Signed-off-by: Yasumasa Suenaga <[email protected]> * Separate OpenAPI document generation from build-env stage Signed-off-by: Yasumasa Suenaga <[email protected]> * Create case-study-template.md Creating the case study template. Signed-off-by: Vaughan Knight <[email protected]> * Update case-study-template.md Minor updates. Signed-off-by: Vaughan Knight <[email protected]> * Up Helm chart version to 1.2.0 (#500) Signed-off-by: Yasumasa Suenaga <[email protected]> * First draft of the ADR for watt time v3 changes First draft of the ADR for watt time v3 changes. Looking at path mappings and parameters. Still plenty to work on. * Initial changelog 1.4.0 (#511) Signed-off-by: Dan Benitah <[email protected]> * overview.md: Fixed three broken links Signed-off-by: joecus1 <[email protected]> * DCO Remediation Commit for joecus1 <[email protected]> I, joecus1 <[email protected]>, hereby add my Signed-off-by to this commit: c6b2c14 Signed-off-by: joecus1 <[email protected]> * Update enablement.md update older .Net reference Signed-off-by: nttDamien <[email protected]> * (fix) broken links - Update enablement.md Signed-off-by: nttDamien <[email protected]> * Moved ADR to correct location Moved ADR to correct location * Further updates for the watt time v2 to v3 upgrade Signed-off-by: Vaughan Knight <[email protected]> * Further updates for the watt time v2 to v3 upgrade Signed-off-by: Vaughan Knight <[email protected]> * Update SECURITY.md (.NET 8 upgrade) Signed-off-by: nttDamien <[email protected]> * Update enablement.md 2 missed references... Signed-off-by: nttDamien <[email protected]> * Update docusaurus.config.js removed banner's mention of Hack Signed-off-by: Dan Benitah <[email protected]> * Update docusaurus.config.js Signed-off-by: Dan Benitah <[email protected]> * documentation-change.yml: Created issue template for documentation changes. Signed-off-by: joecus1 <[email protected]> * Update 0016-watt-time-v3.md updated notes for BA Signed-off-by: Vaughan Knight <[email protected]> * First draft of the ADR for watt time v3 changes First draft of the ADR for watt time v3 changes. Looking at path mappings and parameters. Still plenty to work on. * Moved ADR to correct location Moved ADR to correct location * Further updates for the watt time v2 to v3 upgrade Signed-off-by: Vaughan Knight <[email protected]> * Update 0016-watt-time-v3.md updated notes for BA Signed-off-by: Vaughan Knight <[email protected]> * Add blog article for .NET 8 upgrade Signed-off-by: Yasumasa Suenaga <[email protected]> * Update article Signed-off-by: Yasumasa Suenaga <[email protected]> * Create 0016-watt-time-v3.md More updates. * Added base url to the configuration with validation Added AuthenticationBaseUrl to the configuration and updated Authentication to leverage the v3 authenication path - note the API is not updated and will require further updates. * Updated start and end configuration Updated start and end configuration to new values * Balancing Authority Parameter Renamed to Region Balancing Authority Renamed to Region. Does not include updates to API, just the Query String parameter. * Add example for 'podman play kube' (#340) * Add example for 'podman play kube' Signed-off-by: Yasumasa Suenaga <[email protected]> * Update Swagger JSON URL Signed-off-by: Yasumasa Suenaga <[email protected]> --------- Signed-off-by: Yasumasa Suenaga <[email protected]> * Updates for historical data API Updates for historical data API * Removed accidental file Removed accidental file * Lots of test updates Lots of test updates, need to do some fixes. * Historical forecasts updated Historical forecasts updated * DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b9490e4 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b991bac I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: e4f1494 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: b443e9e I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: ab1205d I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 7c115fa I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: e047c9a I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: aa81382 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 8640c8c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 880fcf7 Signed-off-by: Vaughan Knight <[email protected]> * Many tests reworked, a few to go Many tests reworked, a few to go. Consolidated a lot of the hand crafted json objects into objects that get serialized as the purist JsonObject format was prone to errors - in some cases tests were passing even with bad typing. * Further test updates Further test updates * Further updates, just 1 test left to remediate Further updates, just 1 test left to remediate * Updated to add authentication client to the service builder for the tests Updated to add authentication client to the service builder for the tests. All tests now passing. * Renaming of Balancing Authority to Region Renaming of Balancing Authority to Region through all code and comments. This will also need updating through documentation. * Fixed spelling error in latitude Fixed spelling error in latitude * Fixed a bug where location sources were loading twice Fixed a bug where location sources were loading twice. Added a semaphore to stop any threading issues, and also stopped it loading twice in the service configuration. * Fixed typo for method name Fixed typo for method name * DCO Remediation Commit for Vaughan Knight <[email protected]> I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: e324f36 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: be6663c I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 39e45a6 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: fbfcac1 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 9aabd27 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 8127a92 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 4ff0151 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: d93320f I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 91799f7 I, Vaughan Knight <[email protected]>, hereby add my Signed-off-by to this commit: 4665813 Signed-off-by: Vaughan Knight <[email protected]> * Updates based on code review for WattTime Tests Updates based on code review for WattTime Tests. Mostly cleanup of constants which were removed elsewhere in tests. * Cleaned up a lot of the string literals Cleaned up a lot of the string literals. They were causing too much fragility in the code base, and made it complex when updating the WattTime API. * More cleanup of some of the strings More cleanup of some of the strings. Creating consistency for using the test data on parameters and not just reponses also. * Updates to documentation and changelog Updates to documentation and changelog * Fix Signed-off-by: Yasumasa Suenaga <[email protected]> * Update azure-regions.json (#536) Latest azure-regions.json list Adds italynorth, polandcentral, spaincentral, mexicocentral, israelcentral, qatarcentral, brazilus, eastusstg (Also seems to remove trailing zeros in some existing coordinates) Signed-off-by: Dan Benitah <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Update casdk-docs/blog/2024-05-16-dotnet8/index.md Co-authored-by: Vaughan Knight <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> * Fix comments Signed-off-by: Yasumasa Suenaga <[email protected]> * Update CHANGELOG.md for v1.5 Signed-off-by: Dan Benitah <[email protected]> * Update CHANGELOG.md layout update Signed-off-by: Dan Benitah <[email protected]> * Add env directive to values.yaml and troubleshooting guide to avoid inotify limitation on Linux Closes #528 Signed-off-by: Yasumasa Suenaga <[email protected]> * Add env directive into explanation of values.yaml for Helm chart Signed-off-by: Yasumasa Suenaga <[email protected]> * typo: fix incorrect usage of it's Signed-off-by: Scott Trent <[email protected]> * Docs/blog update for releases 1.3 to1.5 and fix (#551) * Catching up on release blog posts for 1.3, 1.4 and 1.5 Signed-off-by: Dan Benitah <[email protected]> * fixed docusaurus (strict) compilation error * release dates updated Signed-off-by: Dan Benitah <[email protected]> * added tag Signed-off-by: Dan Benitah <[email protected]> * tag update to post and image layout fix Signed-off-by: Dan Benitah <[email protected]> * updated slug Signed-off-by: Dan Benitah <[email protected]> * formatting fix Signed-off-by: Dan Benitah <[email protected]> * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 53e120c Signed-off-by: Dan Benitah <[email protected]> * formatting * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: 0f6cada Signed-off-by: Dan Benitah <[email protected]> --------- Signed-off-by: Dan Benitah <[email protected]> * Add a configuration for disabling to cache JSON emission data Signed-off-by: Yasumasa Suenaga <[email protected]> * Update CHANGELOG.md for 1.6 Signed-off-by: Dan Benitah <[email protected]> * Update 1-pr.yaml Updating from deprecated version of upload and download artifact to v4 as mentioned in https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/ Signed-off-by: Dan Benitah <[email protected]> * Update dev_carbon-aware-api.yml updating upload and download artifact@v1or 2 actions to v4 Signed-off-by: Dan Benitah <[email protected]> * fixes and release notes post for 1.6 Signed-off-by: Dan Benitah <[email protected]> * updated blog post * docs workflow's node version updated to latest LTS -> 22 * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: d3b054b I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: f412591 Signed-off-by: Dan Benitah <[email protected]> * blogs with truncate Signed-off-by: Dan Benitah <[email protected]> * node version update back to 20 Signed-off-by: Dan Benitah <[email protected]> * adding yarn.lock * pipelines fixes Signed-off-by: Dan Benitah <[email protected]> * Update CarbonAwareController.cs (minor typos) Signed-off-by: Richard Jackson <[email protected]> * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: eae5bd1 Signed-off-by: Dan Benitah <[email protected]> * Consider null value in carbonIntensity on EM (#575) Issue #571 Signed-off-by: Yasumasa Suenaga <[email protected]> * EM datasource didn't filter out-of-range emission data (#572) Issue #570 Signed-off-by: Yasumasa Suenaga <[email protected]> * Update CHANGELOG.md updating changelog for 1.6.1 Signed-off-by: Dan Benitah <[email protected]> * Add configuration for tracing log (#531) Signed-off-by: Yasumasa Suenaga <[email protected]> * Updating 1.6.1 to include #531 straight away * DCO Remediation Commit for Dan Benitah <[email protected]> I, Dan Benitah <[email protected]>, hereby add my Signed-off-by to this commit: f35bb59 Signed-off-by: Dan Benitah <[email protected]> * fix Signed-off-by: Dan Benitah <[email protected]> --------- Signed-off-by: Vaughan Knight <[email protected]> Signed-off-by: Dan Benitah <[email protected]> Signed-off-by: Sophie Trinder <[email protected]> Signed-off-by: Phil Huang <[email protected]> Signed-off-by: Richard Jackson <[email protected]> Signed-off-by: tkuramoto33 <[email protected]> Signed-off-by: Rintaro Ikeda <[email protected]> Signed-off-by: JasonLuuk <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> Signed-off-by: danuw <[email protected]> Signed-off-by: Osama Jandali <[email protected]> Signed-off-by: Szymon Duchniewicz <[email protected]> Signed-off-by: Russell Trow <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> Signed-off-by: omahs <[email protected]> Signed-off-by: joecus1 <[email protected]> Signed-off-by: nttDamien <[email protected]> Signed-off-by: Yasumasa Suenaga <[email protected]> Signed-off-by: Scott Trent <[email protected]> Signed-off-by: Dan Benitah <[email protected]> Co-authored-by: Vaughan Knight <[email protected]> Co-authored-by: Sophie Trinder <[email protected]> Co-authored-by: Phil Huang <[email protected]> Co-authored-by: Richard Jackson <[email protected]> Co-authored-by: tkuramoto33 <[email protected]> Co-authored-by: Rintaro Ikeda <[email protected]> Co-authored-by: rinikeda <[email protected]> Co-authored-by: JasonLuuk <[email protected]> Co-authored-by: Szymon Duchniewicz <[email protected]> Co-authored-by: Yasumasa Suenaga <[email protected]> Co-authored-by: Osama Jandali <[email protected]> Co-authored-by: Szymon Duchniewicz <[email protected]> Co-authored-by: Russell Trow <[email protected]> Co-authored-by: Takuya Iwatsuka <[email protected]> Co-authored-by: omahs <[email protected]> Co-authored-by: joecus1 <[email protected]> Co-authored-by: nttDamien <[email protected]> Co-authored-by: Yasumasa Suenaga <[email protected]> Co-authored-by: Scott Trent <[email protected]> Co-authored-by: Scott Trent <[email protected]>
1 parent 35be4ad commit 92d0e5e

File tree

11 files changed

+189
-39
lines changed

11 files changed

+189
-39
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

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

5+
## [1.6.1] - 2024-11
6+
7+
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)
8+
9+
### Added
10+
11+
- [PR #531] Add configuration for tracing log](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/531)
12+
13+
### Fixed
14+
15+
- [PR #575] Consider null value in carbonIntensity on EM ](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/575)
16+
- [PR #572] EM datasource didn't filter out-of-range emission data ](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/572)
17+
18+
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)
19+
520
## [1.6.0] - 2024-09
621

722
Release for milestone https://github.com/Green-Software-Foundation/carbon-aware-sdk/milestone/8?closed=1 with general bugs fixes and improvements

casdk-docs/docs/tutorial-extras/configuration.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,16 @@ InstrumentationKey. For more details, please refer to
409409
AppInsights_InstrumentationKey="AppInsightsInstrumentationKey"
410410
```
411411

412+
#### Configuring telemetry log
413+
414+
WebAPI configures [console exporter of OpenTelemetry](https://opentelemetry.io/docs/languages/net/exporters/#console) by default.
415+
You can configure whether the exporter is enabled with `EnableTelemetryLogging`.
416+
Set `false` if you want to reduce the log.
417+
418+
```bash
419+
CarbonAwareVars__EnableTelemetryLogging=false
420+
```
421+
412422
### Prometheus exporter for emissions data
413423

414424
> 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.

src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/src/ElectricityMapsDataSource.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,18 @@ private async Task<IEnumerable<CarbonIntensity>> GetRecentCarbonInstensityData(L
138138

139139
private IEnumerable<EmissionsData> HistoryCarbonIntensityToEmissionsData(Location location, IEnumerable<CarbonIntensity> data, DateTimeOffset startTime, DateTimeOffset endTime)
140140
{
141-
IEnumerable<EmissionsData> emissions;
142141
var duration = GetDurationFromHistoryDataPointsOrDefault(data, TimeSpan.Zero);
143-
emissions = data.Select(d =>
144-
{
145-
var emission = (EmissionsData) d;
146-
emission.Location = location.Name ?? string.Empty;
147-
emission.Time = d.DateTime;
148-
emission.Duration = duration;
149-
return emission;
150-
});
151-
152-
return emissions;
142+
return data.Where(d => ((startTime <= d.DateTime) && (d.DateTime < endTime)) ||
143+
((startTime <= d.DateTime.Add(duration)) && (d.DateTime.Add(duration) < endTime)) ||
144+
((d.DateTime < startTime) && (endTime < d.DateTime.Add(duration))))
145+
.Select(d =>
146+
{
147+
var emission = (EmissionsData)d;
148+
emission.Location = location.Name ?? string.Empty;
149+
emission.Time = d.DateTime;
150+
emission.Duration = duration;
151+
return emission;
152+
});
153153
}
154154

155155
private TimeSpan GetDurationFromHistoryDataPointsOrDefault(IEnumerable<CarbonIntensity> carbonIntensityDataPoints, TimeSpan defaultValue)

src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/src/Model/HistoryCarbonIntensityData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal record CarbonIntensity
3232
/// Carbon Intensity value.
3333
/// </summary>
3434
[JsonPropertyName("carbonIntensity")]
35-
public int Value { get; init; }
35+
public int? Value { get; init; }
3636

3737
/// <summary>
3838
/// Indicates the datetime of the carbon intensity
@@ -74,7 +74,7 @@ public static explicit operator EmissionsData(CarbonIntensity historyCarbonInten
7474
{
7575
return new EmissionsData
7676
{
77-
Rating = historyCarbonIntensity.Value,
77+
Rating = historyCarbonIntensity.Value ?? -1,
7878
Time = historyCarbonIntensity.UpdatedAt,
7979
};
8080
}

src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/test/Client/ElectricityMapsClientTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Moq.Protected;
99
using Moq.Contrib.HttpClient;
1010
using System.Text.Json;
11+
using CarbonAware.Model;
1112

1213
namespace CarbonAware.DataSources.ElectricityMaps.Tests;
1314

@@ -299,4 +300,36 @@ private void AddHandler_RequestResponse(Predicate<HttpRequestMessage> requestPre
299300
.ReturnsResponse(statusCode);
300301
}
301302
}
303+
304+
[Test]
305+
public async Task GetRecentCarbonIntensityHistoryAsync_DeserializesExpectedResponseWithNull()
306+
{
307+
AddHandler_RequestResponse(r =>
308+
{
309+
return r.Method == HttpMethod.Get;
310+
}, System.Net.HttpStatusCode.OK, TestData.GetHistoryCarbonIntensityDataJsonStringWithNull());
311+
312+
var client = new ElectricityMapsClient(this.HttpClientFactory, this.Options.Object, this.Log.Object);
313+
314+
// Act
315+
var data = await client.GetRecentCarbonIntensityHistoryAsync(TestLatitude, TestLongitude);
316+
var dataPoint = data?.HistoryData.First();
317+
318+
// Assert
319+
Assert.That(data, Is.Not.Null);
320+
Assert.That(data?.Zone, Is.EqualTo(TestZone));
321+
Assert.That(data?.HistoryData.Count(), Is.GreaterThan(0));
322+
Assert.Multiple(() =>
323+
{
324+
Assert.That(dataPoint?.DateTime, Is.EqualTo(new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero)));
325+
Assert.That(dataPoint?.UpdatedAt, Is.EqualTo(new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero)));
326+
Assert.That(dataPoint?.CreatedAt, Is.EqualTo(new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero)));
327+
Assert.That(dataPoint?.Value, Is.Null);
328+
Assert.That(((EmissionsData)dataPoint).Rating, Is.EqualTo(-1));
329+
Assert.That(dataPoint?.EmissionFactorType, Is.EqualTo("lifecycle"));
330+
Assert.That(dataPoint?.IsEstimated, Is.False);
331+
Assert.That(dataPoint?.EstimationMethod, Is.Null);
332+
});
333+
}
334+
302335
}

src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/test/Client/TestData.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,28 @@ public static string GetCurrentForecastJsonString()
9292

9393
return json.ToString();
9494
}
95+
96+
public static string GetHistoryCarbonIntensityDataJsonStringWithNull()
97+
{
98+
var json = new JsonObject
99+
{
100+
["zone"] = TestZoneId1,
101+
["history"] = new JsonArray
102+
{
103+
new JsonObject
104+
{
105+
["datetime"] = new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero),
106+
["updatedAt"] = new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero),
107+
["createdAt"] = new DateTimeOffset(2099, 1, 1, 0, 0, 0, TimeSpan.Zero),
108+
["carbonIntensity"] = null,
109+
["emissionFactorType"] = "lifecycle",
110+
["isEstimated"] = false,
111+
["estimatedMethod"] = null,
112+
}
113+
}
114+
};
115+
116+
return json.ToString();
117+
}
118+
95119
}

src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/test/ElectricityMapsDataSourceTests.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public async Task GetCarbonIntensity_CallsExpectedClientEndpoint(int startTimeOf
134134
public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRecordsFound()
135135
{
136136
var startDate = DateTimeOffset.UtcNow.AddHours(-10);
137+
var expectedDate = startDate.AddMinutes(-10);
137138
var endDate = startDate.AddHours(1);
138139
var expectedCarbonIntensity = 100;
139140

@@ -145,10 +146,12 @@ public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRe
145146
{
146147
new CarbonIntensity()
147148
{
148-
Value = expectedCarbonIntensity,
149+
DateTime = startDate.AddMinutes(-40), // out of range
150+
Value = 0,
149151
},
150152
new CarbonIntensity()
151153
{
154+
DateTime = expectedDate,
152155
Value = expectedCarbonIntensity,
153156
}
154157
}
@@ -162,10 +165,11 @@ public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRe
162165
var result = await this._dataSource.GetCarbonIntensityAsync(new List<Location>() { _defaultLocation }, startDate, endDate);
163166

164167
Assert.IsNotNull(result);
165-
Assert.That(result.Count(), Is.EqualTo(2));
168+
Assert.That(result.Count(), Is.EqualTo(1));
166169

167170
var first = result.First();
168171
Assert.IsNotNull(first);
172+
Assert.That(expectedDate, Is.EqualTo(first.Time));
169173
Assert.That(first.Rating, Is.EqualTo(expectedCarbonIntensity));
170174
Assert.That(first.Location, Is.EqualTo(_defaultLocation.Name));
171175

@@ -176,6 +180,7 @@ public async Task GetCarbonIntensity_DateRangeWithin24Hours_ReturnsResultsWhenRe
176180
public async Task GetCarbonIntensity_DateRangeMore24Hours_ReturnsResultsWhenRecordsFound()
177181
{
178182
var startDate = _defaultDataStartTime;
183+
var expectedDate = startDate.AddMinutes(-10);
179184
var endDate = startDate.AddHours(1);
180185
var expectedCarbonIntensity = 100;
181186

@@ -187,10 +192,12 @@ public async Task GetCarbonIntensity_DateRangeMore24Hours_ReturnsResultsWhenReco
187192
{
188193
new CarbonIntensity()
189194
{
190-
Value = expectedCarbonIntensity,
195+
DateTime = startDate.AddMinutes(-40), // out of range
196+
Value = 0,
191197
},
192198
new CarbonIntensity()
193199
{
200+
DateTime = expectedDate,
194201
Value = expectedCarbonIntensity,
195202
}
196203
}
@@ -206,10 +213,11 @@ public async Task GetCarbonIntensity_DateRangeMore24Hours_ReturnsResultsWhenReco
206213
var result = await this._dataSource.GetCarbonIntensityAsync(new List<Location>() { _defaultLocation }, startDate, endDate);
207214

208215
Assert.IsNotNull(result);
209-
Assert.That(result.Count(), Is.EqualTo(2));
216+
Assert.That(result.Count(), Is.EqualTo(1));
210217

211218
var first = result.First();
212219
Assert.IsNotNull(first);
220+
Assert.That(expectedDate, Is.EqualTo(first.Time));
213221
Assert.That(first.Rating, Is.EqualTo(expectedCarbonIntensity));
214222
Assert.That(first.Location, Is.EqualTo(_defaultLocation.Name));
215223

@@ -261,7 +269,9 @@ public async Task GetDurationBetweenHistoryDataPoints_ReturnsDefaultDuration_Whe
261269
{
262270
HistoryData = new List<CarbonIntensity>()
263271
{
264-
new CarbonIntensity()
272+
new CarbonIntensity(){
273+
DateTime = startDate.AddMinutes(30),
274+
},
265275
}
266276
};
267277

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

src/CarbonAware.WebApi/src/Configuration/ServiceCollectionExtensions.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using Microsoft.Extensions.Options;
22
using CarbonAware.WebApi.Metrics;
33
using OpenTelemetry.Metrics;
4+
using OpenTelemetry.Resources;
5+
using OpenTelemetry.Trace;
46

57
namespace CarbonAware.WebApi.Configuration;
68

@@ -32,7 +34,23 @@ public static void AddMonitoringAndTelemetry(this IServiceCollection services, I
3234
// Can be extended in the future to support a different provider like Zipkin, Prometheus etc
3335
}
3436

37+
var enableTelemetryLogging = envVars?.EnableTelemetryLogging ?? true;
38+
if (enableTelemetryLogging)
39+
{
40+
const string serviceName = "CarbonAware.WebAPI";
41+
const string serviceVersion = "1.0.0";
3542

43+
services.AddOpenTelemetry()
44+
.WithTracing(tracerProviderBuilder =>
45+
tracerProviderBuilder
46+
.AddConsoleExporter()
47+
.AddSource(serviceName)
48+
.SetResourceBuilder(
49+
ResourceBuilder.CreateDefault()
50+
.AddService(serviceName: serviceName, serviceVersion: serviceVersion))
51+
.AddHttpClientInstrumentation()
52+
.AddAspNetCoreInstrumentation());
53+
}
3654
}
3755

3856
public static IServiceCollection AddCarbonExporter(this IServiceCollection services, IConfiguration configuration)

src/CarbonAware.WebApi/src/Program.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,11 @@
55
using GSF.CarbonAware.Configuration;
66
using GSF.CarbonAware.Exceptions;
77
using Microsoft.OpenApi.Models;
8-
using OpenTelemetry.Resources;
9-
using OpenTelemetry.Trace;
10-
using OpenTelemetry.Metrics;
118
using Swashbuckle.AspNetCore.SwaggerGen;
129
using System.Reflection;
1310

14-
// Define constants to initialize tracing with
15-
var serviceName = "CarbonAware.WebAPI";
16-
var serviceVersion = "1.0.0";
17-
1811
var builder = WebApplication.CreateBuilder(args);
1912

20-
builder.Services.AddOpenTelemetry()
21-
.WithTracing(tracerProviderBuilder =>
22-
tracerProviderBuilder
23-
.AddConsoleExporter()
24-
.AddSource(serviceName)
25-
.SetResourceBuilder(
26-
ResourceBuilder.CreateDefault()
27-
.AddService(serviceName: serviceName, serviceVersion: serviceVersion))
28-
.AddHttpClientInstrumentation()
29-
.AddAspNetCoreInstrumentation());
30-
3113
// Add services to the container.
3214
builder.Services.AddControllers(options =>
3315
{

src/CarbonAware.WebApi/test/unitTests/Configuration/ServiceCollectionExtensionsTests.cs

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using Microsoft.Extensions.DependencyInjection;
44
using Microsoft.Extensions.Configuration;
55
using NUnit.Framework.Internal;
6+
using OpenTelemetry.Trace;
7+
using Microsoft.ApplicationInsights;
68

79
namespace CarbonAware.WepApi.UnitTests;
810

@@ -79,8 +81,8 @@ public void AddMonitoringAndTelemetry_DoesNotAddServices_WithoutTelemetryProvide
7981

8082
// Act & Assert
8183
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
82-
Assert.That(services.Count, Is.EqualTo(0));
83-
}
84+
Assert.Null(services.BuildServiceProvider().GetService<TelemetryClient>());
85+
}
8486

8587
[Test]
8688
public void AddCarbonExporter_AddsServices_IsEnabledInConfiguration()
@@ -156,4 +158,58 @@ public void CreateConsoleLogger_ReturnsILogger()
156158
// Assert
157159
Assert.That(logger, Is.Not.Null);
158160
}
161+
162+
[Test]
163+
public void EnableTelemetryLogging_AddsServices_WithoutConfiguration()
164+
{
165+
// Arrange
166+
var services = new ServiceCollection();
167+
168+
var inMemorySettings = new Dictionary<string, string> { };
169+
var configuration = new ConfigurationBuilder()
170+
.AddInMemoryCollection(inMemorySettings)
171+
.Build();
172+
173+
// Act & Assert
174+
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
175+
Assert.NotNull(services.BuildServiceProvider().GetService<TracerProvider>());
176+
}
177+
178+
[Test]
179+
public void EnableTelemetryLogging_AddsServices_IsEnabledInConfiguration()
180+
{
181+
// Arrange
182+
var services = new ServiceCollection();
183+
184+
var inMemorySettings = new Dictionary<string, string>
185+
{
186+
{ "CarbonAwareVars:EnableTelemetryLogging", "true" }
187+
};
188+
var configuration = new ConfigurationBuilder()
189+
.AddInMemoryCollection(inMemorySettings)
190+
.Build();
191+
192+
// Act & Assert
193+
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
194+
Assert.NotNull(services.BuildServiceProvider().GetService<TracerProvider>());
195+
}
196+
197+
[Test]
198+
public void EnableTelemetryLogging_AddsServices_IsDisabledInConfiguration()
199+
{
200+
// Arrange
201+
var services = new ServiceCollection();
202+
203+
var inMemorySettings = new Dictionary<string, string>
204+
{
205+
{ "CarbonAwareVars:EnableTelemetryLogging", "false" }
206+
};
207+
var configuration = new ConfigurationBuilder()
208+
.AddInMemoryCollection(inMemorySettings)
209+
.Build();
210+
211+
// Act & Assert
212+
Assert.DoesNotThrow(() => services.AddMonitoringAndTelemetry(configuration));
213+
Assert.Null(services.BuildServiceProvider().GetService<TracerProvider>());
214+
}
159215
}

0 commit comments

Comments
 (0)