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

Fix lambda metrics #5201

Merged
merged 3 commits into from
Nov 19, 2024
Merged

Conversation

kkondaka
Copy link
Collaborator

Description

Fix lambda metrics.

  1. Fix PluginMetrics to allow changing name
  2. Add request and response payload metrics in the processor

Issues Resolved

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • [ X] Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -30,8 +30,12 @@ public abstract class AbstractSink<T extends Record<?>> implements Sink<T> {
private int waitTimeMs;
private SinkThread sinkThread;

protected String getName(final PluginSetting pluginSetting) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should change AbstractSink for renaming. Rather, let the concrete sink pass in the PluginMetrics. Then handle the renaming in the LambdaSink directly.

super(pluginSetting, PluginMettrics.fromPluginSetting(pluginSetting));

Signed-off-by: Kondaka <krishkdk@amazon.com>
Signed-off-by: Kondaka <krishkdk@amazon.com>
Signed-off-by: Kondaka <krishkdk@amazon.com>
@@ -49,6 +49,8 @@
import software.amazon.awssdk.services.lambda.LambdaAsyncClient;
import software.amazon.awssdk.services.lambda.model.InvokeResponse;

import javax.management.RuntimeMBeanException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like unwanted unused import. Please remove it.

if (response.payload() != null) {
responsePayloadMetric.record(response.payload().asByteArray().length);
}
continue;
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this continue. It is likely to cause bugs later on.

if (response.payload() != null) {
responsePayloadMetric.record(response.payload().asByteArray().length);
}
continue;
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this continue and use the catch to increment. This approach is likely to lead to future code bugs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kkondaka kkondaka merged commit 72fa423 into opensearch-project:main Nov 19, 2024
46 of 47 checks passed
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