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

[NH-78291] Lambda support #98

Merged
merged 26 commits into from
Jun 19, 2024
Merged

[NH-78291] Lambda support #98

merged 26 commits into from
Jun 19, 2024

Conversation

swi-jared
Copy link
Contributor

@swi-jared swi-jared commented May 30, 2024

This is the last mile of work for getting Go APM to work in Lambda. NOTE: this is merging into the lambda branch, and we'll figure out the versioning in the instrumentation's go.mod after merging.

@swi-jared swi-jared changed the base branch from main to lambda June 11, 2024 22:23
@@ -1280,7 +1280,7 @@ func (d *DefaultDialer) Dial(p DialParams) (*grpc.ClientConn, error) {
opts = append(opts, grpc.WithContextDialer(newGRPCProxyDialer(p)))
}

return grpc.Dial(p.Address, opts...)
return grpc.NewClient(p.Address, opts...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dial was deprecated in favor of NewClient in the upstream version of grpc

@swi-jared swi-jared marked this pull request as ready for review June 13, 2024 20:39
@swi-jared swi-jared requested a review from a team as a code owner June 13, 2024 20:39
@swi-jared swi-jared changed the title [WIP] Lambda support [NH-78291] Lambda support Jun 13, 2024
Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

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

Really appreciate the judicious comments @swi-jared! I left some questions, the main question being whether errors are captured.

internal/metrics/otel.go Show resolved Hide resolved
s.flags,
s.value,
s.ttl,
s.args,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tangent question, the settings ttl handling is in a separate PR yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have TTL handling at the moment. There's a problem with the TTL being a number of seconds as opposed to a timestamp, meaning that we read/update the file and don't have an idea of when the TTL seconds should be applied from.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point, I wonder if the other core libraries just calculate it as "from the most recent read". But as you mentioned, this can be a follow-on PR.

log.Info("Stopping settings file watcher.")
exit <- true
}

func waitForSettingsFile() {
var timeout = 1 * time.Second

Choose a reason for hiding this comment

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

It looks like this multiplication is redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The time.Duration type is nanoseconds. This is the idiomatic way to set that type, with the correct value, in nanoseconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I realized you meant the 1 * part is unnecessary. This is correct, though I prefer to be explicit.

Choose a reason for hiding this comment

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

It seems like the we're doing this for the type conversion side effect of the multiplication?

internal/txn/txn.go Outdated Show resolved Hide resolved
return nil, err
}
proc := processor.NewInboundMetricsSpanProcessor(registry)
prop := propagation.NewCompositeTextMapPropagator(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the list of propagators customizable outside of lambda? Maybe not for this PR if at all and I don't think it's in our internal spec.

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, not in our SDK at least. I just copied this from Start so it's probably worth thinking about updating.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

@@ -95,8 +95,8 @@ func newSettingLambdaFromFile() (*settingLambdaNormalized, error) {
return nil, err
}
// Settings file should be an array with a single settings object
var settingLambdas []settingLambdaFromFile
if err := json.Unmarshal(settingBytes, &settingLambdas); err != nil {
var settingLambdas []*settingLambdaFromFile
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for tidying my lil mess

Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

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

Thanks for the explains and revisits @swi-jared, looks good from my perspective if ttl is a follow-on!

@swi-jared swi-jared merged commit 3292823 into lambda Jun 19, 2024
5 checks passed
@swi-jared swi-jared deleted the otel-metrics branch June 19, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants