-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from microsoft/chgeuer/nextsteps
Chgeuer/nextsteps
- Loading branch information
Showing
13 changed files
with
223 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,3 +356,4 @@ MigrationBackup/ | |
launchSettings.json | ||
.idea | ||
/testcaptures | ||
/captures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# What's new? | ||
|
||
## Version 1.1 | ||
|
||
- **2023-09-18**: Added a configuration option for controlling the frequency of state snapshot creation in blob storage. The environment variables `AZURE_METERING_MAX_DURATION_BETWEEN_SNAPSHOTS` and `AZURE_METERING_MAX_NUMBER_OF_EVENTS_BETWEEN_SNAPSHOTS` can be used to specify how often a snapshot is created (which ever comes first): For example, `AZURE_METERING_MAX_DURATION_BETWEEN_SNAPSHOTS="00:05:00"` and `AZURE_METERING_MAX_NUMBER_OF_EVENTS_BETWEEN_SNAPSHOTS="2000"` ensure that at least every 5 minutes or every 2000 processed events, a new snapshot is created. | ||
- **2023-09-14**: Added a diagnostics tool (`src/Tools/ReprocessLocalEventHubCaptureFiles`) which can be used to replay and analyze locally downloaded Event Hub Capture files. | ||
- **2023-09-14:** Added an option to `RemoveUnprocessedMessages` which purges *all* unprocessed messages from a partition's state file: `{ "type": "RemoveUnprocessedMessages", "value": { "partitionId": "5", "all": "all" } }` | ||
- **2023-09-14:** Added support for 2-year and 3-year SaaS offers, i.e., the `RenewalInterval` can not only take the values `Monthly` and `Annually`, but also `2-years` and `3-years`. | ||
- **2023-08-31:** Added business logic unit test completely based on JSON files. For example, [src/Metering.Tests/data/BusinessLogic/RefreshIncludedQuantities](https://github.com/microsoft/metered-billing-accelerator/tree/main/src/Metering.Tests/data/BusinessLogic/RefreshIncludedQuantities) contains a full series of events and the state files resulting from applying each event. The event's JSON filename must contain the EventHubs timestamp. All files must contain the sequence number. Check the [README.md in the `src/Metering.Tests/data/BusinessLogic` folder](https://github.com/microsoft/metered-billing-accelerator/tree/main/src/Metering.Tests/data/BusinessLogic) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[InternetShortcut] | ||
URL=https://github.com/microsoft/metered-billing-accelerator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<!-- https://github.com/microsoft/DockerTools/issues/209#issuecomment-588232318 --> | ||
<ItemGroup Condition="'$(MSBuildProjectExtension)' != '.dcproj'"> | ||
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<Version>3.6.133</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
module Metering.NUnitTests.RuntimeUnitTest | ||
|
||
open Metering.BaseTypes | ||
open Metering.Integration | ||
open Metering.BaseTypes.EventHub | ||
open NUnit.Framework | ||
|
||
[<Test>] | ||
let ``checkGenerateSnapshot``() = | ||
let get (dur: string option, evt: string option) = | ||
function | ||
| "MAX_DURATION_BETWEEN_SNAPSHOTS" -> dur | ||
| "MAX_NUMBER_OF_EVENTS_BETWEEN_SNAPSHOTS" -> evt | ||
| _ -> None | ||
|
||
let cfg dur evt = MeteringConnections.loadSnapshotIntervalConfigurationFromEnvironment (get (dur, evt)) | ||
|
||
let time sequenceNr dateTimeStr = MessagePosition.create "0" sequenceNr (MeteringDateTime.fromStr dateTimeStr) | ||
|
||
Assert.IsTrue( | ||
cfg (Some "00:05:00") (Some "2000") | ||
|> SnapshotIntervalConfiguration.shouldCreateSnapshot | ||
(time 0l "2024-01-01T00:00:00Z") | ||
(time 2001l "2024-01-01T00:00:01Z") | ||
) | ||
|
||
Assert.IsFalse( | ||
cfg (Some "00:05:00") (Some "2000") | ||
|> SnapshotIntervalConfiguration.shouldCreateSnapshot | ||
(time 0l "2024-01-01T00:00:00Z") | ||
(time 1999l "2024-01-01T00:00:01Z") | ||
) | ||
|
||
Assert.IsFalse( | ||
cfg (Some "1.00:00:00") None | ||
|> SnapshotIntervalConfiguration.shouldCreateSnapshot | ||
(time 0l "2024-01-01T00:00:00Z") | ||
(time 999l "2024-01-01T00:00:01Z")) | ||
|
||
Assert.IsFalse( | ||
cfg None (Some "2000") | ||
|> SnapshotIntervalConfiguration.shouldCreateSnapshot | ||
(time 0l "2024-01-01T00:00:00Z") | ||
(time 1999l "2024-01-01T00:00:01Z")) | ||
|
||
Assert.IsTrue( | ||
cfg None (Some "2000") | ||
|> SnapshotIntervalConfiguration.shouldCreateSnapshot | ||
(time 0l "2024-01-01T00:00:00Z") | ||
(time 1999l "2024-01-01T01:00:01Z")) | ||
|
||
// Without configuration, we should use the default values (at least hourly, or every 1000 events) | ||
Assert.IsTrue( | ||
cfg None None | ||
|> SnapshotIntervalConfiguration.shouldCreateSnapshot | ||
(time 0l "2024-01-01T00:00:00Z") | ||
(time 1001l "2024-01-01T00:00:01Z")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.