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

feat(clients): enable Endpoint Discovery #2395

Merged
merged 14 commits into from
May 14, 2021
Merged

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented May 14, 2021

Issue

Fixes: #2211

Description

Enables Endpoint Discovery on clients which have clientEndpointDiscovery smithy trait set.

Testing

Tested with the following code:

import { TimestreamQuery } from "../aws-sdk-js-v3/clients/client-timestream-query/dist/cjs/index.js";

const region = "us-west-2";
const client = new TimestreamQuery({ region, logger: console });

const DatabaseName = `Database1619998684282`;
const TableName = `Table1619998684282`;
const QueryString = `SELECT * FROM ${DatabaseName}.${TableName} ORDER BY time`;

await Promise.all([
  client.query({ QueryString }),
  client.query({ QueryString: `${QueryString} LIMIT 2` }),
  client.query({ QueryString: `${QueryString} LIMIT 5` }),
]);

Verified that discovery endpoint operation (i.e. DescribeEndpoints) is called only once although there are three parallel query calls.

{
  clientName: 'TimestreamQueryClient',
  commandName: 'DescribeEndpointsCommand',
  input: { Operation: 'Query', Identifiers: undefined },
  output: { Endpoints: [ [Object] ] },
  metadata: {
    httpStatusCode: 200,
    requestId: '32384c2d-e075-492e-8d9a-02d4cd21fe69',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  }
}
{
  clientName: 'TimestreamQueryClient',
  commandName: 'QueryCommand',
  input: { QueryString: '***SensitiveInformation***' },
  output: {
    ColumnInfo: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
    NextToken: undefined,
    QueryId: 'AEDACAM4AC55UWHUXUYJ4JBU7VT76KSI5RM47JCDJYSIAN5VXANLIJG3QK24XEY',
    QueryStatus: {
      CumulativeBytesMetered: 10000000,
      CumulativeBytesScanned: 1048,
      ProgressPercentage: 100
    },
    Rows: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object]
    ]
  },
  metadata: {
    httpStatusCode: 200,
    requestId: 'K6W27XSYKRL7HD36HOW5WTWTUE',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  }
}
{
  clientName: 'TimestreamQueryClient',
  commandName: 'QueryCommand',
  input: { QueryString: '***SensitiveInformation***' },
  output: {
    ColumnInfo: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
    NextToken: undefined,
    QueryId: 'AEDACAM4AC5YR3ZREISR2NVE723ZZENOCEU4HKFCT4REEANXSZ5ITP7RCD47PGI',
    QueryStatus: {
      CumulativeBytesMetered: 10000000,
      CumulativeBytesScanned: 1048,
      ProgressPercentage: 100
    },
    Rows: [ [Object], [Object] ]
  },
  metadata: {
    httpStatusCode: 200,
    requestId: 'AJSTGRM3WS4UTI7CDAQYPQF5WE',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  }
}
{
  clientName: 'TimestreamQueryClient',
  commandName: 'QueryCommand',
  input: { QueryString: '***SensitiveInformation***' },
  output: {
    ColumnInfo: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
    NextToken: undefined,
    QueryId: 'AEDACAM4AC5RFCPYGQPYPGWSOSAR7A54WJ2FBWOEZ2EQIAHOOXGYGUXX6EJS6NA',
    QueryStatus: {
      CumulativeBytesMetered: 10000000,
      CumulativeBytesScanned: 1048,
      ProgressPercentage: 100
    },
    Rows: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  metadata: {
    httpStatusCode: 200,
    requestId: '73SI4DZ4R2KESFKBFJL6KKEE4Y',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  }
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@7f297dc). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2395   +/-   ##
=======================================
  Coverage        ?   59.11%           
=======================================
  Files           ?      490           
  Lines           ?    26181           
  Branches        ?     6213           
=======================================
  Hits            ?    15476           
  Misses          ?    10705           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f297dc...b1231af. Read the comment docs.

@trivikr
Copy link
Member Author

trivikr commented May 14, 2021

The codegen-ci is failing, as smithy-ts changes are not merged yet smithy-lang/smithy-typescript#340

What I verified in my workspace:

  • Rebased from upstream/main for smithy-ts changes Support additional plugin function parameters smithy-lang/smithy-typescript#340
  • Published the branch locally by running ./gradlew clean publishToMavenLocal
  • Ran yarn generate-clients to ensure no no additional code was generated.
  • Ran ./gradlew clean smithy-aws-typescript-codegen:build protocol-test-codegen:build -Plog-tests in codegen folder, abd verified that it was successful.

@trivikr trivikr merged commit 019c099 into aws:main May 14, 2021
@trivikr trivikr deleted the endpoint-discovery branch May 14, 2021 17:57
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endpoint discovery not working for Timestream
3 participants