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

Feature/26650 payload sampling #591

Open
wants to merge 9 commits into
base: epic/tag-integration-backend-frontend
Choose a base branch
from

Conversation

DC2-DanielKrueger
Copy link
Contributor

@DC2-DanielKrueger DC2-DanielKrueger commented Oct 11, 2024

public @NotNull Response getSchemaForTopic(@NotNull final String topicBase64) {
final String topic = new String(Base64.getDecoder().decode(topicBase64), StandardCharsets.UTF_8);
final List<byte[]> samples = samplingService.getSamples(topic);
if (samples.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe some logs here?

try {
jsonSamples.add(objectMapper.readTree(sample));
} catch (final IOException e) {
// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe some logs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

question is whether we should log the broken payload here. Guess the Exception message must be enough.

if (customBridgeLimitations != null) {
final Long queueLimitFromConfig = customBridgeLimitations.queueLimit;
if (queueLimitFromConfig != null) {
// bridges can overwrite the default
Copy link
Contributor

Choose a reason for hiding this comment

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

I would log something like this on info.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no we shouldnt do this. This would scale the log messages linear with the amount of messages. Logging even competes for exclusive access => contention.

}

public void startSampling(final @NotNull String topic) {
final String clientId = SAMPLER_PREFIX + topic;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe some logs here?

clientId);
}

public void stopSampling(final @NotNull String topic) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe some logs here?

localTopicTree.removeSubscriber(clientId, topic, null);
}

public @NotNull List<byte[]> getSamples(final @NotNull String topic) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Logs and a metric would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what should the metric measure? Invocations? Number of returned samples? When would this metric help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants