Skip to content

Enable User Agent Extension #3530

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

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Enable User Agent Extension #3530

wants to merge 15 commits into from

Conversation

samsharma2700
Copy link
Contributor

Description

This is the final PR(part 3) for User Agent Feature Extension work. Making this a draft since we want few changes on part 2 : #3489
This PR will be updated once part 2 is merged.

Majority of changes in this PR include:

  • Enabling UserAgent FE for prelogin.
  • More tests relating to functionality of FE.
  • Adding traces.
  • Enable/Pass the encoded JSON byte payload.

Testing

Builds are passing. Added unit tests and functional tests

@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

A few problems to address.

@@ -3072,6 +3069,25 @@ internal void OnFeatureExtAck(int featureId, byte[] data)
break;
}

case TdsEnums.FEATUREEXT_USERAGENT:
Copy link
Contributor

Choose a reason for hiding this comment

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

There will be no ack defined in the TDS spec, so we shouldn't do this. Just let the default case handle it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ignoring these UserAgent files. I assume they are identical to the previous PR. If not, please call out the differences, or rebase this PR off of the previous PR so the diffs are automatic.

@@ -191,8 +192,17 @@ internal void TdsLogin(
}

int feOffset = length;
// TODO: User Agent Json Payload will go here
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this?

Assert.True(loginFound, "Expected UserAgent extension in LOGIN7");

// Verify server never acknowledged it
Assert.False(responseFound, "Server should not acknowledge UserAgent");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just testing that our Test Server doesn't sent an ACK, which we already know - we wrote it. We need a test that verifies driver behaviour when the server does send an ACK. Maybe that's already covered elsewhere in general feature ext ack tests. Can you confirm?

@@ -93,5 +93,11 @@ public interface ITDSServerSession
/// Indicates whether the client supports Vector column type
/// </summary>
bool IsVectorSupportEnabled { get; set; }

/// <summary>
/// Indicates whether the client supports Vector column type
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy-pasta comment :)

/// <summary>
/// Default feature extension version supported on the server for user agent.
/// </summary>
public const byte DefaultSupportedUserAgentFeatureExtVersion = 0x0F;
Copy link
Contributor

Choose a reason for hiding this comment

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

0x0F is the feature identifier, not its version. Did you mean 0x01 here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ignoring this file as well.

@Wraith2
Copy link
Contributor

Wraith2 commented Aug 12, 2025

What's a user agent and what can users do with them?

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 13, 2025

@Wraith2 I think it is similar to the User Agent string submitted by a browser, and can be used for telemetry from the server side.

@paulmedynski
Copy link
Contributor

We're using the term User Agent in the generic sense - MDS is an agent acting on the user's behalf to talk to a SQL Server. This feature will calculate a JSON payload with details of the environment that MDS is running in and supply that to SQL Server for temeletry/reporting purposes, similar to what a web browser does with the HTTP User-Agent header.

@cheenamalhotra cheenamalhotra added this to the 7.0-preview1 milestone Aug 15, 2025
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.

5 participants