-
Notifications
You must be signed in to change notification settings - Fork 918
GODRIVER-2906 Add container Env to Handshake. #1382
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
Conversation
API Change ReportNo changes found! |
55670ab to
484a1e6
Compare
blink1073
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| name := getFaasEnvName() | ||
| if name == "" { | ||
| container := getContainerEnvInfo() | ||
| if name == "" && container == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line implies that we wouldn't append the client environment if the name and the container are unavailable. However, both name and container were made optional as part of DRIVERS-2570: https://github.com/mongodb/specifications/pull/1454/files#diff-0ecfac0976ff0bfe5b91b5bd52bc5a79dd1125434505ff22331c7cadf1b2f25eR170
I think we should completely remove this block.
If tests are failing, such as the handshake integration tests, it's because there is an expectation that they should contain a name which is now incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid it's ambiguous. My understanding is that the entire client.env can be omitted because:
- The spec states the
envis optional. - Logically, we don't have to keep the
envif it has nothing.
However, I will ask for clarification because we don't have a lot of reference implementations now.
Spec says:
If no fields of
client.envwould be populated,client.envMUST be entirely omitted. ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, so because the other fields in env depend on either name or container, if both are empty then implicitly the other fields will be empty. Could we add a comment to that effect?
x/mongo/driver/operation/hello.go
Outdated
| var idx int32 | ||
| idx, dst = bsoncore.AppendDocumentElementStart(dst, "env") | ||
|
|
||
| if name != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of nesting these conditions, suggest making them separate blocks for readability:
var idx int32
idx, dst = bsoncore.AppendDocumentElementStart(dst, "env")
if name != "" {
dst = bsoncore.AppendStringElement(dst, "name", name)
}
if !omitNonName {
switch name {
case envNameAWSLambda:
dst = addMem(envVarAWSLambdaFunctionMemorySize)
dst = addRegion(envVarAWSRegion)
case envNameGCPFunc:
dst = addMem(envVarFunctionMemoryMB)
dst = addRegion(envVarFunctionRegion)
dst = addTimeout(envVarFunctionTimeoutSec)
case envNameVercel:
dst = addRegion(envVarVercelRegion)
}
}
prestonvasquez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
(cherry picked from commit c3d390f)
GODRIVER-2906
Summary
client.env.namefield to optional.client.env.container.The values for
client.env.containerare sourced from the environment, see here.Background & Motivation
client.env.container.runtimeis untested since it requires "/.dockerenv", which exists in the root directory.