Skip to content

Conversation

divyeshio
Copy link

@divyeshio divyeshio commented Sep 13, 2024

Fixes #316

  • Replaces NatsStas functionality with System.Diagnostics.Metrics implementation

@iby-dev
Copy link

iby-dev commented Jan 30, 2025

Any updates on this PR, since? I can see it has been outstanding for a few months now.

@mtmk
Copy link
Member

mtmk commented Jan 31, 2025

Any updates on this PR, since? I can see it has been outstanding for a few months now.

not sure since it's still in draft state. @iby-dev did you get a chance to test it at all? maybe with aspire?

@iby-dev
Copy link

iby-dev commented Feb 12, 2025

Hallo, my TL is against aspire so we won't be using it. There is a container that one can use auto extracts metrics from a running nats server which i may have a look at it. I will come back to this depending on how i get on. It is at the bottom of my last sadly.

public const string PendingMessagesInstrumentName = $"{InstrumentPrefix}.pending.messages";
public const string SentBytesInstrumentName = $"{InstrumentPrefix}.sent.bytes";
public const string ReceivedBytesInstrumentName = $"{InstrumentPrefix}.received.bytes";
public const string SentMessagesInstrumentName = $"{InstrumentPrefix}.sent.messages";
Copy link
Contributor

Choose a reason for hiding this comment

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

public const string SentBytesInstrumentName = $"{InstrumentPrefix}.sent.bytes";
public const string ReceivedBytesInstrumentName = $"{InstrumentPrefix}.received.bytes";
public const string SentMessagesInstrumentName = $"{InstrumentPrefix}.sent.messages";
public const string ReceivedMessagesInstrumentName = $"{InstrumentPrefix}.received.messages";
Copy link
Contributor

Choose a reason for hiding this comment

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

public class NatsMetrics
{
public const string MeterName = "NATS.Client";
public const string PendingMessagesInstrumentName = $"{InstrumentPrefix}.pending.messages";
Copy link
Contributor

@thompson-tomo thompson-tomo May 13, 2025

Choose a reason for hiding this comment

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

Request has been raised to add this open-telemetry/semantic-conventions#2263

Comment on lines +9 to +10
public const string SentBytesInstrumentName = $"{InstrumentPrefix}.sent.bytes";
public const string ReceivedBytesInstrumentName = $"{InstrumentPrefix}.received.bytes";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest raising a request to add these to registry just like we have in http https://opentelemetry.io/docs/specs/semconv/http/http-metrics/#metric-httpserverrequestbodysize

Copy link
Contributor

@thompson-tomo thompson-tomo May 14, 2025

Choose a reason for hiding this comment

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

private static readonly Counter<long> _sentMessagesCounter;
private static readonly Counter<long> _receivedMessagesCounter;

static NatsMetrics()
Copy link
Contributor

Choose a reason for hiding this comment

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


namespace NATS.Client.Core.Internal;

public class NatsMetrics
Copy link
Contributor

Choose a reason for hiding this comment

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


namespace NATS.Client.Core.Internal;

public class NatsMetrics
Copy link
Contributor

@thompson-tomo thompson-tomo May 13, 2025

Choose a reason for hiding this comment

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

A request has been raised to register the system name: open-telemetry/semantic-conventions#2266

@mtmk
Copy link
Member

mtmk commented May 16, 2025

thanks for the comments @thompson-tomo. we might have to open a new pr not sure if @divyeshio is still interested in this feature. been a while.

@divyeshio
Copy link
Author

Hey @mtmk @thompson-tomo, sorry I've been inactive, I won't be able to work on this.

@mtmk
Copy link
Member

mtmk commented May 22, 2025

Hey @mtmk @thompson-tomo, sorry I've been inactive, I won't be able to work on this.

thanks for the update @divyeshio 💯 thank you for kicking this off and your hard work ❤️

@thompson-tomo
Copy link
Contributor

@mtmk I have now created #871 which contains functionality from this PR plus some fixes. As such I think this one can be closed.

@mtmk
Copy link
Member

mtmk commented May 24, 2025

Thank you @thompson-tomo

@mtmk mtmk closed this May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OTEL Metrics
4 participants