Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double Value Support #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Graphite/GraphiteTcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public GraphiteTcpClient(string hostname, int port = 2003, string keyPrefix = nu
_tcpClient = new TcpClient(Hostname, Port);
}

public void Send(string path, int value, DateTime timeStamp)
public void Send(string path, double value, DateTime timeStamp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, it would be better to save int-methods also

{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Graphite/GraphiteUdpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public GraphiteUdpClient(string hostname, int port = 2003, string keyPrefix = nu
_udpClient = new UdpClient(Hostname, Port);
}

public void Send(string path, int value, DateTime timeStamp)
public void Send(string path, double value, DateTime timeStamp)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Graphite/IGraphiteClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Graphite
{
public interface IGraphiteClient
{
void Send(string path, int value, DateTime timeStamp);
void Send(string path, double value, DateTime timeStamp);
}

public static class IGraphiteClientExtensions
Expand Down
6 changes: 3 additions & 3 deletions Graphite/PlaintextMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace Graphite
public class PlaintextMessage
{
public string Path { get; private set; }
public int Value { get; private set; }
public double Value { get; private set; }
public long Timestamp { get; private set; }

public PlaintextMessage(string path, int value, DateTime timestamp)
public PlaintextMessage(string path, double value, DateTime timestamp)
{
if(path == null)
{
Expand All @@ -23,7 +23,7 @@ public PlaintextMessage(string path, int value, DateTime timestamp)

public byte[] ToByteArray()
{
var line = string.Format("{0} {1} {2}\n", Path, Value, Timestamp);
var line = string.Format("{0} {1} {2}\n", Path, Convert.ToString(Value).Replace(",","."), Timestamp);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think that target graphite server support dots?


return Encoding.UTF8.GetBytes(line);
}
Expand Down