Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Commit adf53b6

Browse files
committed
Basic Changes and Move to .NET STandard 2.0 / Framework 4.6.1
1 parent 2a9d586 commit adf53b6

File tree

20 files changed

+516
-48
lines changed

20 files changed

+516
-48
lines changed

influxdb-csharp.sln

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26730.3
4+
VisualStudioVersion = 15.0.27130.2036
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{72DC28B9-37B5-425C-8532-5CA91D253A70}"
77
EndProject
@@ -31,6 +31,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfluxDB.Collector", "src\I
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "sample\Benchmark\Benchmark.csproj", "{2A34EE83-FB59-4A41-8BB5-174BE678533E}"
3333
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfluxDb.UdpSupport.ConsoleTest", "test\Consoles\InfluxDb.UdpSupport.ConsoleTest\InfluxDb.UdpSupport.ConsoleTest.csproj", "{1B138F1D-A772-4656-9142-442DEFB969E5}"
35+
EndProject
36+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample-UDP-Support", "sample\Sample-UDP-Support\Sample-UDP-Support.csproj", "{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591}"
37+
EndProject
3438
Global
3539
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3640
Debug|Any CPU = Debug|Any CPU
@@ -57,6 +61,14 @@ Global
5761
{2A34EE83-FB59-4A41-8BB5-174BE678533E}.Debug|Any CPU.Build.0 = Debug|Any CPU
5862
{2A34EE83-FB59-4A41-8BB5-174BE678533E}.Release|Any CPU.ActiveCfg = Release|Any CPU
5963
{2A34EE83-FB59-4A41-8BB5-174BE678533E}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{1B138F1D-A772-4656-9142-442DEFB969E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65+
{1B138F1D-A772-4656-9142-442DEFB969E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
66+
{1B138F1D-A772-4656-9142-442DEFB969E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
67+
{1B138F1D-A772-4656-9142-442DEFB969E5}.Release|Any CPU.Build.0 = Release|Any CPU
68+
{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69+
{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591}.Debug|Any CPU.Build.0 = Debug|Any CPU
70+
{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591}.Release|Any CPU.ActiveCfg = Release|Any CPU
71+
{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591}.Release|Any CPU.Build.0 = Release|Any CPU
6072
EndGlobalSection
6173
GlobalSection(SolutionProperties) = preSolution
6274
HideSolutionNode = FALSE
@@ -67,6 +79,8 @@ Global
6779
{DC6028D6-ED1D-4857-B5EB-28BA05E3F531} = {CD65EE64-FDA8-4ED9-A7F2-81BDD9F64C64}
6880
{F690F3E3-D9F0-441A-9E70-4F70998BDD1B} = {72DC28B9-37B5-425C-8532-5CA91D253A70}
6981
{2A34EE83-FB59-4A41-8BB5-174BE678533E} = {CD65EE64-FDA8-4ED9-A7F2-81BDD9F64C64}
82+
{1B138F1D-A772-4656-9142-442DEFB969E5} = {75C71D21-E6FD-493F-A355-997EEF4DDF11}
83+
{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591} = {CD65EE64-FDA8-4ED9-A7F2-81BDD9F64C64}
7084
EndGlobalSection
7185
GlobalSection(ExtensibilityGlobals) = postSolution
7286
SolutionGuid = {AB0C6BCE-235A-4018-8644-7652EC826FF5}

sample/Benchmark/Benchmark.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net46</TargetFrameworks>
4+
<TargetFrameworks>net461</TargetFrameworks>
55
<AssemblyName>Sample</AssemblyName>
66
<PackageId>Sample</PackageId>
77
<ApplicationIcon />
@@ -10,8 +10,8 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="BenchmarkDotNet" Version="0.10.9" />
14-
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.10.9" />
13+
<PackageReference Include="BenchmarkDotNet" Version="0.10.12" />
14+
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.10.12" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

sample/Sample-UDP-Support/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

sample/Sample-UDP-Support/Program.cs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using InfluxDB.Collector;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Diagnostics;
5+
using System.IO;
6+
using System.Threading.Tasks;
7+
8+
// influx-db command line:
9+
// start with
10+
// # influx
11+
// # show databases
12+
// # CREATE DATABASE {name}
13+
// # DROP DATABASE {name}
14+
// # precision rfc3339
15+
// # use <database>
16+
// # SHOW MEASUREMENTS
17+
// # SHOW MEASUREMENTS WITH MEASUREMENT =~ /v1\..*/ -- all fields from measurements that start with 'v1.'
18+
// # SHOW SERIES
19+
// # SHOW SERIES [FROM <measurement_name> [WHERE <tag_key>='<tag_value>']]
20+
// # DROP SERIES FROM /v1.*\.end/
21+
// # SHOW TAG KEYS
22+
// # SHOW TAG KEYS FROM "v1.cos"
23+
// # SHOW FIELD KEYS
24+
// # SHOW FIELD KEYS FROM /v1\..*\.sin/ -- all fields from series that start with 'v1.' and end with '.sin'
25+
26+
/*
27+
# influx
28+
docker run --name influx -p 8086:8086 -p 8089:8089/udp -p 8088:8088 -v C:\Docker\Volumes\influxdb\db:/var/lib/influxdb -v C:\Docker\Volumes\influxdb\config\influxdb.conf:/etc/influxdb/influxdb.conf:ro influxdb -config /etc/influxdb/influxdb.conf
29+
docker run -d -p 8083:8083 -p 8086:8086 -p 8089:4444/udp --expose 8083 --expose 8086 --expose 4444 -e UDP_DB="playground" tutum/influxdb
30+
31+
*/
32+
namespace Sample
33+
{
34+
public static class Program
35+
{
36+
public static void Main(string[] args)
37+
{
38+
Collect().Wait();
39+
40+
Console.ReadKey();
41+
}
42+
43+
async static Task Collect()
44+
{
45+
var process = Process.GetCurrentProcess();
46+
47+
Metrics.Collector = new CollectorConfiguration()
48+
.Tag.With("host", Environment.GetEnvironmentVariable("COMPUTERNAME"))
49+
.Tag.With("os", Environment.GetEnvironmentVariable("OS"))
50+
.Tag.With("process", Path.GetFileName(process.MainModule.FileName))
51+
.Batch.AtInterval(TimeSpan.FromSeconds(2))
52+
//.WriteTo.InfluxDB("http://localhost:8086", "data")
53+
.WriteTo.InfluxDB("udp://localhost:8089", "data")
54+
.CreateCollector();
55+
56+
while (true)
57+
{
58+
Metrics.Increment("iterations");
59+
60+
Metrics.Write("cpu_time",
61+
new Dictionary<string, object>
62+
{
63+
{ "value", process.TotalProcessorTime.TotalMilliseconds },
64+
{ "user", process.UserProcessorTime.TotalMilliseconds }
65+
});
66+
67+
Metrics.Measure("working_set", process.WorkingSet64);
68+
69+
await Task.Delay(1000);
70+
}
71+
}
72+
}
73+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Sample-UDP-Support")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Sample-UDP-Support")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("62a1a1e7-ccf5-49d9-b462-f11eef7f5591")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{62A1A1E7-CCF5-49D9-B462-F11EEF7F5591}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>Sample_UDP_Support</RootNamespace>
10+
<AssemblyName>Sample-UDP-Support</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Core" />
37+
<Reference Include="System.Xml.Linq" />
38+
<Reference Include="System.Data.DataSetExtensions" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Net.Http" />
42+
<Reference Include="System.Xml" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Compile Include="Program.cs" />
46+
<Compile Include="Properties\AssemblyInfo.cs" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<None Include="App.config" />
50+
<None Include="packages.config" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<ProjectReference Include="..\..\src\InfluxDB.Collector\InfluxDB.Collector.csproj">
54+
<Project>{f690f3e3-d9f0-441a-9e70-4f70998bdd1b}</Project>
55+
<Name>InfluxDB.Collector</Name>
56+
</ProjectReference>
57+
<ProjectReference Include="..\..\src\InfluxDB.LineProtocol\InfluxDB.LineProtocol.csproj">
58+
<Project>{069e0ac5-a2cf-4584-89a7-f475276e244c}</Project>
59+
<Name>InfluxDB.LineProtocol</Name>
60+
</ProjectReference>
61+
</ItemGroup>
62+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
63+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
4+
</packages>

sample/Sample/Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net452;netcoreapp1.0</TargetFrameworks>
4+
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
55
<AssemblyName>Sample</AssemblyName>
66
<PackageId>Sample</PackageId>
77
</PropertyGroup>

src/InfluxDB.Collector/Configuration/PipelinedCollectorEmitConfiguration.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@ class PipelinedCollectorEmitConfiguration : CollectorEmitConfiguration
1111
{
1212
readonly CollectorConfiguration _configuration;
1313
readonly List<Action<PointData[]>> _emitters = new List<Action<PointData[]>>();
14-
LineProtocolClient _client;
14+
private ILineProtocolClient _client;
1515

16-
public PipelinedCollectorEmitConfiguration(CollectorConfiguration configuration)
16+
public PipelinedCollectorEmitConfiguration(
17+
CollectorConfiguration configuration)
1718
{
1819
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
1920
_configuration = configuration;
2021
}
2122

2223
public override CollectorConfiguration InfluxDB(Uri serverBaseAddress, string database, string username = null, string password = null)
2324
{
24-
_client = new LineProtocolClient(serverBaseAddress, database, username, password);
25+
if (string.Compare(serverBaseAddress.Scheme, "udp", ignoreCase: true) == 0)
26+
_client = new LineProtocolUdpClient(serverBaseAddress, database, username, password);
27+
else
28+
_client = new LineProtocolClient(serverBaseAddress, database, username, password);
2529
return _configuration;
2630
}
2731

src/InfluxDB.Collector/InfluxDB.Collector.csproj

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Description>A minimal metrics collection API for InfluxDB</Description>
55
<Authors>influxdb-csharp Contributors</Authors>
6-
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
88
<AssemblyName>InfluxDB.Collector</AssemblyName>
99
<VersionPrefix>1.1.1</VersionPrefix>
@@ -17,22 +17,21 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<ProjectReference Include="..\InfluxDB.LineProtocol\InfluxDB.LineProtocol.csproj" />
20+
<PackageReference Include="System.Net.Sockets" Version="4.3.0" />
2121
</ItemGroup>
2222

23-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
24-
<Reference Include="System" />
25-
<Reference Include="System.Core" />
23+
<ItemGroup>
24+
<ProjectReference Include="..\InfluxDB.LineProtocol\InfluxDB.LineProtocol.csproj" />
2625
</ItemGroup>
2726

28-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
29-
<PackageReference Include="System.Collections" Version="4.0.11" />
30-
<PackageReference Include="System.Linq" Version="4.1.0" />
31-
<PackageReference Include="System.Threading" Version="4.0.11" />
32-
<PackageReference Include="System.Runtime" Version="4.1.0" />
33-
<PackageReference Include="System.Net.Http" Version="4.1.1" />
34-
<PackageReference Include="System.Console" Version="4.0.0" />
35-
<PackageReference Include="System.Runtime.Extensions" Version="4.1.0" />
27+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
28+
<PackageReference Include="System.Collections" Version="4.3.0" />
29+
<PackageReference Include="System.Linq" Version="4.3.0" />
30+
<PackageReference Include="System.Threading" Version="4.3.0" />
31+
<PackageReference Include="System.Runtime" Version="4.3.0" />
32+
<PackageReference Include="System.Net.Http" Version="4.3.3" />
33+
<PackageReference Include="System.Console" Version="4.3.0" />
34+
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
3635
</ItemGroup>
3736

3837
</Project>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy