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

Provider better APIs to move between Instrument Tags and Commons Tags #3102

Closed
gregturn opened this issue Mar 29, 2022 · 0 comments
Closed
Labels
bug A general bug module: micrometer-test An issue that is related to our TCK
Milestone

Comments

@gregturn
Copy link

When defining a custom Observation, you get exposed to Commons TagKey...

enum MongoObservation implements DocumentedObservation {
}

This makes it tricky to use them in meter-based assertions like this:

@Test
void successfullyCompletedCommandWithoutClusterInformationShouldCreateTimerWhenParentSampleInRequestContext() {

	// given
	Observation parent = Observation.start("name", observationRegistry);
	TestRequestContext testRequestContext = TestRequestContext.withObservation(parent);

	// when
	listener.commandStarted(new CommandStartedEvent(testRequestContext, 0, null, "database", "insert",
			new BsonDocument("collection", new BsonString("user"))));
	listener.commandSucceeded(new CommandSucceededEvent(testRequestContext, 0, null, "insert", null, 0));

	// then
	assertThat(meterRegistry).hasTimerWithNameAndTags(HighCardinalityCommandTags.MONGODB_COMMAND.getKey(),
			Tags.of(Tag.of(LowCardinalityCommandTags.MONGODB_COLLECTION.getKey(), "user")));
}

Instead, you are forced to "convert" from one to the other.

If Commons Tags are, well, common, why can't Micrometer Tracing use them? Isn't that the point of a "common"?

@marcingrzejszczak marcingrzejszczak added the bug A general bug label Mar 29, 2022
@marcingrzejszczak marcingrzejszczak added this to the 2.0.0-M4 milestone Mar 29, 2022
@jonatan-ivanov jonatan-ivanov added the module: micrometer-test An issue that is related to our TCK label Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug module: micrometer-test An issue that is related to our TCK
Projects
None yet
Development

No branches or pull requests

3 participants