Skip to content

Commit

Permalink
Merge pull request #136 from snowplow/release/1.3.0
Browse files Browse the repository at this point in the history
Release/1.3.0
  • Loading branch information
matus-tomlein authored Jun 25, 2024
2 parents bf663ea + e6ede46 commit 5c0bf87
Show file tree
Hide file tree
Showing 30 changed files with 594 additions and 161 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x

- name: Restore Snowplow.Tracker dependencies
run: dotnet restore Snowplow.Tracker.sln
Expand All @@ -30,13 +30,13 @@ jobs:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup msbuild
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v2

- name: Setup nuget
uses: nuget/setup-nuget@v1
uses: nuget/setup-nuget@v2
with:
nuget-version: '5.x'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x

- name: Restore Snowplow.Tracker dependencies
run: dotnet restore Snowplow.Tracker.sln
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x

- name: Restore Snowplow.Tracker dependencies
run: dotnet restore Snowplow.Tracker.sln
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 1.3.0 (2024-06-20)
--------------------------
Add an event class for mobile screen view and make the older screen view obsolete
Add CustomGetPath and CustomPostPath methods (#129) thanks to @jfjalburquerque
Update dependencies and .NET version for the tests and console demo projects (#135)
Fix incorrectly formatted value in the structured event for some locales (#134)
Fix error on sending the same payload twice when using in memory event queue (#133)

Version 1.2.2 (2023-03-21)
--------------------------
Fix upgrading storage database from previous versions of LiteDB (#131)
Expand Down
147 changes: 82 additions & 65 deletions Snowplow.Demo.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,80 +1,97 @@
/*
* Copyright (c) 2023 Snowplow Analytics Ltd. All rights reserved.
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
* http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the Apache License Version 2.0 for the specific
* language governing permissions and limitations there under.
*/

using Snowplow.Tracker;
using Snowplow.Tracker.Logging;
using Snowplow.Tracker.Models;
using Snowplow.Tracker.Models.Events;
using System;
using System.Linq;

namespace Snowplow.Demo.Console
string collectorHostname = "http://localhost:9090";
int port = 80;

// help the user out a bit with ports
if (Uri.IsWellFormedUriString(collectorHostname, UriKind.Absolute))
{
public class Program
Uri tmp;
if (Uri.TryCreate(collectorHostname, UriKind.Absolute, out tmp))

Check warning on line 13 in Snowplow.Demo.Console/Program.cs

View workflow job for this annotation

GitHub Actions / build_tracker

Converting null literal or possible null value to non-nullable type.

Check warning on line 13 in Snowplow.Demo.Console/Program.cs

View workflow job for this annotation

GitHub Actions / build_tracker

Converting null literal or possible null value to non-nullable type.

Check warning on line 13 in Snowplow.Demo.Console/Program.cs

View workflow job for this annotation

GitHub Actions / deploy

Converting null literal or possible null value to non-nullable type.
{

/// <summary>
/// Runs the Console Demo application
/// </summary>
/// <param name="args"></param>
public static void Main(string[] args)
if (tmp.Scheme == "http" || tmp.Scheme == "https")
{
string collectorHostname = "<invalid>";
int port = 80;
collectorHostname = tmp.Host;
port = tmp.Port;
}
}
}

int count = 100;
Console.WriteLine("Demo app started - sending events to " + collectorHostname + " port " + port);

switch (args.Count())
{
case 2:
count = Int32.Parse(args[1]);
goto case 1;
case 1:
collectorHostname = args[0];
break;
default:
System.Console.WriteLine("Invalid arguments. Usage: <app> <collector-hostname> [number of events to send]");
return;
}
var logger = new ConsoleLogger();

// help the user out a bit with ports
if (Uri.IsWellFormedUriString(collectorHostname, UriKind.Absolute))
{
Uri tmp;
if (Uri.TryCreate(collectorHostname, UriKind.Absolute, out tmp))
{
if (tmp.Scheme == "http" || tmp.Scheme == "https")
{
collectorHostname = tmp.Host;
port = tmp.Port;
}
}
}
Tracker.Instance.Start(collectorHostname, "snowplow-demo-app.db", l: logger, endpointPort: port);

System.Console.WriteLine("Demo app started - sending " + count + " events to " + collectorHostname + " port " + port);
// page view
Tracker.Instance.Track(new PageView().SetPageUrl("http://helloworld.com/sample/sample.php").Build());

var logger = new ConsoleLogger();
// mobile screen view
MobileScreenView msv = new MobileScreenView("00000000-0000-0000-0000-000000000000", "name")
.SetType("type")
.SetPreviousName("previousName")
.SetPreviousId("00000000-0000-0000-0000-000000000000")
.SetPreviousType("previousType")
.SetTransitionType("transitionType")
.Build();
Tracker.Instance.Track(msv);

Tracker.Tracker.Instance.Start(collectorHostname, "snowplow-demo-app.db", l: logger, endpointPort: port);
// old screen view
Tracker.Instance.Track(new ScreenView()

Check warning on line 43 in Snowplow.Demo.Console/Program.cs

View workflow job for this annotation

GitHub Actions / build_tracker

'ScreenView' is obsolete: 'Use the MobileScreenView instead'

Check warning on line 43 in Snowplow.Demo.Console/Program.cs

View workflow job for this annotation

GitHub Actions / build_tracker

'ScreenView' is obsolete: 'Use the MobileScreenView instead'

Check warning on line 43 in Snowplow.Demo.Console/Program.cs

View workflow job for this annotation

GitHub Actions / deploy

'ScreenView' is obsolete: 'Use the MobileScreenView instead'
.SetId("example-screen-id")
.SetName("Example Screen")
.Build());

for (int i = 0; i < count; i++)
{
Tracker.Tracker.Instance.Track(new PageView().SetPageUrl("http://helloworld.com/sample/sample.php").Build());
}
// self-describing event
SelfDescribingJson sdj = new SelfDescribingJson("iglu:com.snowplowanalytics.snowplow/timing/jsonschema/1-0-0", new Dictionary<string, object> {
{ "category", "SdjTimingCategory" },
{ "variable", "SdjTimingVariable" },
{ "timing", 0 },
{ "label", "SdjTimingLabel" }
});
Tracker.Instance.Track(new SelfDescribing()
.SetEventData(sdj)
.Build());

Tracker.Tracker.Instance.Flush();
Tracker.Tracker.Instance.Stop();
// timing event
Tracker.Instance.Track(new Timing()
.SetCategory("category")
.SetVariable("variable")
.SetTiming(5)
.SetLabel("label")
.Build());

System.Console.WriteLine("Demo app finished");
System.Console.Out.Flush();
}
}
}
// structured event
Tracker.Instance.Track(new Structured()
.SetCategory("exampleCategory")
.SetAction("exampleAction")
.SetLabel("exampleLabel")
.SetProperty("exampleProperty")
.SetValue(17)
.Build());

// ecommerce transaction
var item1 = new EcommerceTransactionItem().SetSku("pbz0026").SetPrice(20).SetQuantity(1).Build();
var item2 = new EcommerceTransactionItem().SetSku("pbz0038").SetPrice(15).SetQuantity(1).SetName("shirt").SetCategory("clothing").Build();
var items = new List<EcommerceTransactionItem> { item1, item2 };
Tracker.Instance.Track(new EcommerceTransaction()
.SetOrderId("6a8078be")
.SetTotalValue(35)
.SetAffiliation("affiliation")
.SetTaxValue(3)
.SetShipping(0)
.SetCity("Phoenix")
.SetState("Arizona")
.SetCountry("US")
.SetCurrency("USD")
.SetItems(items)
.Build());

Tracker.Instance.Flush();
Tracker.Instance.Stop();

Console.WriteLine("Demo app finished");
Console.Out.Flush();
7 changes: 4 additions & 3 deletions Snowplow.Demo.Console/Snowplow.Demo.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Snowplow.Tracker" Version="1.2.2" />
<ProjectReference Include="..\Snowplow.Tracker\Snowplow.Tracker.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@
<Private>True</Private>
</Reference>
<Reference Include="LiteDB">
<HintPath>..\..\packages\LiteDB.5.0.15\lib\net45\LiteDB.dll</HintPath>
<HintPath>..\..\packages\LiteDB.5.0.20\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Memory">
<HintPath>..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
Expand All @@ -156,7 +156,7 @@
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.DiagnosticSource">
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.7.0.1\lib\netstandard2.0\System.Diagnostics.DiagnosticSource.dll</HintPath>
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\netstandard2.0\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.15" targetFramework="net461" />
<package id="LiteDB" version="5.0.20" targetFramework="net461" />
<package id="Microsoft.Extensions.PlatformAbstractions" version="1.1.0" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="7.0.0" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="7.0.4" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net461" />
<package id="Snowplow.Tracker" version="1.2.2" targetFramework="net461" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
<package id="System.Console" version="4.3.1" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="7.0.1" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net461" />
<package id="System.Diagnostics.Process" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
Expand Down Expand Up @@ -62,4 +62,4 @@
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net461" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
</packages>
</packages>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<DevInstrumentationEnabled>True</DevInstrumentationEnabled>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -55,10 +55,10 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="LiteDB">
<HintPath>..\..\packages\LiteDB.5.0.15\lib\netstandard2.0\LiteDB.dll</HintPath>
<HintPath>..\..\packages\LiteDB.5.0.20\lib\netstandard2.0\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.15" targetFramework="monoandroid60" />
<package id="LiteDB" version="5.0.20" targetFramework="monoandroid60" />
<package id="Microsoft.Extensions.PlatformAbstractions" version="1.1.0" targetFramework="monoandroid60" />
<package id="Microsoft.NETCore.Platforms" version="7.0.0" targetFramework="monoandroid60" />
<package id="Microsoft.NETCore.Platforms" version="7.0.4" targetFramework="monoandroid60" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="monoandroid60" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="monoandroid60" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="monoandroid60" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="monoandroid60" />
<package id="Snowplow.Tracker" version="1.2.2" targetFramework="monoandroid60" />
<package id="System.AppContext" version="4.3.0" targetFramework="monoandroid60" />
<package id="System.Collections" version="4.3.0" targetFramework="monoandroid60" />
Expand Down Expand Up @@ -55,4 +55,4 @@
<package id="System.Threading.Timer" version="4.3.0" targetFramework="monoandroid60" />
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="monoandroid60" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="monoandroid60" />
</packages>
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="LiteDB">
<HintPath>..\..\packages\LiteDB.5.0.15\lib\netstandard2.0\LiteDB.dll</HintPath>
<HintPath>..\..\packages\LiteDB.5.0.20\lib\netstandard2.0\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.15" targetFramework="xamarinios10" />
<package id="LiteDB" version="5.0.20" targetFramework="xamarinios10" />
<package id="Microsoft.Extensions.PlatformAbstractions" version="1.1.0" targetFramework="xamarinios10" />
<package id="Microsoft.NETCore.Platforms" version="7.0.0" targetFramework="xamarinios10" />
<package id="Microsoft.NETCore.Platforms" version="7.0.4" targetFramework="xamarinios10" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="xamarinios10" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="xamarinios10" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="xamarinios10" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="xamarinios10" />
<package id="Snowplow.Tracker" version="1.2.2" targetFramework="xamarinios10" />
<package id="System.AppContext" version="4.3.0" targetFramework="xamarinios10" />
<package id="System.Collections" version="4.3.0" targetFramework="xamarinios10" />
Expand Down Expand Up @@ -55,4 +55,4 @@
<package id="System.Threading.Timer" version="4.3.0" targetFramework="xamarinios10" />
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="xamarinios10" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="xamarinios10" />
</packages>
</packages>
2 changes: 1 addition & 1 deletion Snowplow.Tracker.Tests/Emitters/AsyncEmitterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void testFlush()
Assert.IsTrue(e.Running);
e.Stop();

Assert.AreEqual(100, mockEndpoint.CallCount);
Assert.IsTrue(100 <= mockEndpoint.CallCount);
Assert.AreEqual(0, storage.TotalItems);
}

Expand Down
Loading

0 comments on commit 5c0bf87

Please sign in to comment.