Skip to content

Conversation

@stefanbirkner
Copy link

@stefanbirkner stefanbirkner commented Aug 30, 2020

It is unexpected that the common key prefix for some metrics types is
different. This makes it unnecessary difficult to find the metrics in
the database. This commit unifies the prefix for all metrics.

The prefix of each key is now service name, type prefix, hostname. All
of them are optional. service name is added if it is available and not
set as a label because the configuration flag EnableServiceLabel is
set. type prefix is added if it is enabled with the configuration flag
EnableTypePrefix. hostname is added if it is available and not set
as a label because EnableHostnameLabel is set.

The behaviour of EmitKeys, IncrCounter, IncrCounterWithLabels,
AddSample, AddSampleWithLabels, MeasureSince and
MeasureSinceWithLabels changes with this commit. For EmitKey the
hostname will be added (details see above) but the service name will no
longer be added when EnableServiceLabel is set to true. For the
other types the hostname will be added if it is available and
EnableHostnameLabel is set to false.

@stefanbirkner stefanbirkner force-pushed the augment-key branch 2 times, most recently from ccf720f to 38e0102 Compare August 30, 2020 19:44
@stefanbirkner
Copy link
Author

This PR contains the changes of #20 and #76.

It is unexpected that the common key prefix for some metrics types is
different. This makes it unnecessary difficult to find the metrics in
the database. This commit unifies the prefix for all metrics.

The prefix of each key is now `service name, type prefix, hostname`. All
of them are optional. `service name` is added if it is available and not
set as a label because the configuration flag `EnableServiceLabel` is
set. `type prefix` is added if it is enabled with the configuration flag
`EnableTypePrefix`. `hostname` is added if it is available and not set
as a label because `EnableHostnameLabel` is set.

The behaviour of `EmitKeys`, `IncrCounter`, `IncrCounterWithLabels`,
`AddSample`, `AddSampleWithLabels`, `MeasureSince` and
`MeasureSinceWithLabels` changes with this commit. For `EmitKey` the
hostname will be added (details see above) but the service name will no
longer be added when `EnableServiceLabel` is set to `true`. For the
other types the hostname will be added if it is available and
`EnableHostnameLabel` is set to `false`.
@hashicorp-cla
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

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.

2 participants