question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example of Assign() is slightly misleading

See original GitHub issue

Description

While consumer group is not used in Assign() scenarios, it still needs to be provided for whatever reason. In the samples new Guid() is used for naming that group. It seems to be misleading, because in most scenarios Guids are used as unique identifiers, but in this case it is just a constant (00000000-0000-0000-0000-000000000000).

As a result developers often get incorrect assumption that consumer group names for Assign() should be unique (even with each service restart). They just blindly miss that Guid is created via new Guid() but not Guid.NewGuid(). And it ends up with hundreds of empty consumer groups with Guid names in clusters.

I seems to be better to specify some hardcoded constant (and probably explicitly state that that value could be used for ALL services if needed).

How to reproduce

  • Change this line to GroupId = Guid.NewGuid().ToString(),
  • Run sample few times
  • New consumer group with unique name is created each time. Old groups are not removed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bartelinkcommented, Jan 13, 2022

new Guid()

Perhaps Guid.Empty might be a better way to convey the fact that the value should remain stable?

Though I’d favor "TestConsumerGroupName" or something more explicit

0reactions
anchitjcommented, Nov 8, 2022

Closing the issue as the example has been fixed now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object.assign() - weird behaviour need explanation
The Object.assign() function modifies the contents of the first object parameter. Thus in the first function:
Read more >
Checking if a method returns false: assign result to ...
Is it a good practice to call a method that returns true or false values in an if statement? Something like this: private...
Read more >
C++: What is wrong with an object being assigned to itself?
Everything on the right hand side of an assignment is an rvalue. That means that it is considered read-only, and must return a...
Read more >
Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, ...
Read more >
Variables -- declaring and assigning values
Variables -- declaring and assigning values. ... For example a variable which always takes integer values, can be declared as type int in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found