Skip to content

Commit

Permalink
Release 1.6.1 (#587)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
21 people authored Nov 12, 2024
1 parent 35be4ad commit 92d0e5e
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 39 deletions.
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 @@ private void AddHandler_RequestResponse(Predicate<HttpRequestMessage> requestPre
.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));
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 @@ public static void AddMonitoringAndTelemetry(this IServiceCollection services, I
// 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
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 Down Expand Up @@ -79,8 +81,8 @@ public void AddMonitoringAndTelemetry_DoesNotAddServices_WithoutTelemetryProvide

// 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 Down Expand Up @@ -156,4 +158,58 @@ public void CreateConsoleLogger_ReturnsILogger()
// 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

0 comments on commit 92d0e5e

Please sign in to comment.