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

#6 Added Error Metrics #12

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

antrix190
Copy link

@antrix190 antrix190 commented Oct 23, 2019

Added MeterRegistry to log Kafka exceptions.

@antrix190
Copy link
Author

@ezienecker can you review this change?

@ezienecker
Copy link
Member

@antrix190 before I review please correct the formatting

@antrix190
Copy link
Author

@ezienecker Can you share the formatting standards followed?

@antrix190
Copy link
Author

@antrix190 before I review please correct the formatting

Done.

@pvorb
Copy link
Member

pvorb commented Oct 28, 2019

@antrix190 Taking over from @ezienecker since he's not available this week. I added an .editorconfig file, which should make it easier for you in the future. If you're using Eclipse, you need the editorconfig-eclipse plugin (never tried this, since I'm not using Eclipse). In IntelliJ IDEA and VS Code it should work out of the box.

I'll review the PR later today.

@antrix190
Copy link
Author

@antrix190 Taking over from @ezienecker since he's not available this week. I added an .editorconfig file, which should make it easier for you in the future. If you're using Eclipse, you need the editorconfig-eclipse plugin (never tried this, since I'm not using Eclipse). In IntelliJ IDEA and VS Code it should work out of the box.

I'll review the PR later today.

Sure @pvorb I have formatted the files already. Please review and let me know if i have make changes

Copy link
Member

@pvorb pvorb left a comment

Choose a reason for hiding this comment

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

The PR is good in general. I request only minor changes and I think the MeterRegistryCustomizer should be left to the users of this library, since they might want to exclude other URLs as well.

})).meterFilter(MeterFilter.deny(id -> {
String uri = id.getTag("uri");
return uri != null && uri.contains("favicon");
}));
Copy link
Member

Choose a reason for hiding this comment

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

Why do you filter out the /actuator and favicon URLs? This library doesn't have anything to do with spring-webmvc, so I guess this would be the task of the service that uses the library. Maybe the class can be deleted entirely?

Copy link
Author

Choose a reason for hiding this comment

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

Okay i will remove the favicon and actuator url filtering but this Class defines a bean configuration to return MetricRegistryCustomizer. Not required to get the host region etc as a default.

Copy link
Member

Choose a reason for hiding this comment

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

Where do the values for ${host}, ${service} and ${region} come from?

Copy link
Author

Choose a reason for hiding this comment

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

Essentially from properties file.

return "KafkaHealthProperties{" + "topic='" + topic + '\'' + ", sendReceiveTimeout=" + sendReceiveTimeout +
", pollTimeout=" + pollTimeout + ", subscriptionTimeout=" + subscriptionTimeout + '}';
return "KafkaHealthProperties{" + "topic='" + topic + '\'' + ", sendReceiveTimeout=" + sendReceiveTimeout
+ ", pollTimeout=" + pollTimeout + ", subscriptionTimeout=" + subscriptionTimeout + '}';
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Please revert the changes to this file as they're unnecessary.

Copy link
Author

Choose a reason for hiding this comment

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

I moved this file to separate package. Health.config
Should this be reverted.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please

public KafkaConsumingHealthIndicator(KafkaHealthProperties kafkaHealthProperties,
Map<String, Object> kafkaConsumerProperties, Map<String, Object> kafkaProducerProperties) {
Map<String, Object> kafkaConsumerProperties, Map<String, Object> kafkaProducerProperties,
@Autowired MeterRegistry meterRegistry) {
Copy link
Member

Choose a reason for hiding this comment

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

The @Autowired annotation is also unnecessary here. This class should be initialized explicitly.

Copy link
Author

Choose a reason for hiding this comment

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

what i'm trying to do here is create a bean in MetricsConfig and autowiring it here through construtor injection. Let me know if you want me to change this approach.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I understand. But the class should be instantiated as described in the README rather than by autowiring dependencies, since this might cause issues for some projects that have multiple MeterRegistry beans, for example.

@ezienecker
Copy link
Member

@antrix190 any progress on this?

@antrix190
Copy link
Author

Hey @ezienecker @pvorb I'll incorporate the suggested changes by this weekend.

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.

3 participants