Skip to content

handle the dot between prefix and key automatically#28

Merged
vthiery merged 4 commits into
vthiery:masterfrom
kevinkreiser:kk_dot
Jun 15, 2021
Merged

handle the dot between prefix and key automatically#28
vthiery merged 4 commits into
vthiery:masterfrom
kevinkreiser:kk_dot

Conversation

@kevinkreiser

Copy link
Copy Markdown
Collaborator

fixe #27

this also updates doc strings and README exmaples and since it is API breaking it adds version macros. let me know if i should remove the macros, i know we didnt really discuss them before.

@vthiery vthiery linked an issue Jun 15, 2021 that may be closed by this pull request
@vthiery

vthiery commented Jun 15, 2021

Copy link
Copy Markdown
Owner

Thanks for the patch!

Regarding the macros, what's their use exactly?
I intend to cut the next release only when all the changes I attached to the v2 milestone will be done.
I'll only update the version in the cmake file, tag and release, so unless there's a good reason, we should avoid setting these macros.

@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

what's their use exactly?

they allow downstream library maintainers to write protective code around API changes so that their library can work on whatever target platform they are being compiled. you might see something like this in downstream code:

// newer versions handle the dot automatically
#if STATSD_CLIENT_VERSION_MAJOR >= 2
StatsdClient client{ "127.0.0.1", 8080, "prefix", 20 };
// older versions require you to put the dot manually
#else
StatsdClient client{ "127.0.0.1", 8080, "prefix.", 20 };
#endif

this is probably less useful for a header only library where people are usually vendoring it rather than getting it as an installed package on their platform. but if the preferred way of getting this library is to install a package then the downstream library that depends on it might do like above to make sure whatever version they got from the package manager still worked in their code.

no problem if you think its not needed, i dont feel strongly about it, i can happily remove it!


// Send a metric explicitly
client.send("tutu", 4, "c", 2.0f);
client.send("tutu", 241, "c", 2.0f);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this was just because i thought it would be useful to exorcise some bigger numbers some times

Comment thread CMakeLists.txt Outdated
@vthiery
vthiery merged commit fddf895 into vthiery:master Jun 15, 2021
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.

Feat: Automatically Add "." Between Prefix and Metric Key

2 participants