Skip to content

draft: telemetry #87

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 10 commits into
base: main
Choose a base branch
from
Draft

draft: telemetry #87

wants to merge 10 commits into from

Conversation

blva
Copy link
Collaborator

@blva blva commented Apr 17, 2025

No description provided.

@blva blva changed the title Telemetry draft: telemetry Apr 17, 2025
@blva
Copy link
Collaborator Author

blva commented Apr 22, 2025

note: this is a draft, will do some cleanup and change tests, looking for feedback on the code architecture

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 14592314930

Details

  • 70 of 82 (85.37%) changed or added relevant lines in 6 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+5.2%) to 56.835%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/session.ts 4 7 57.14%
src/common/atlas/apiClient.ts 11 15 73.33%
src/telemetry/telemetry.ts 43 48 89.58%
Files with Coverage Reduction New Missed Lines %
src/session.ts 1 46.43%
Totals Coverage Status
Change from base Build 14591977126: 5.2%
Covered Lines: 484
Relevant Lines: 758

💛 - Coveralls

const config = {
...mergedUserConfig,
...machineMetadata,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there an advantage of having machineMetadata inside the config?


// Start the server
try {
await main();
Copy link
Collaborator

Choose a reason for hiding this comment

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

purely personal preference but I don't see much benefit in this main function as it stands as leads to more back and forth referencing. One advantage of main though is the ability to export it for external use but I'm not sure this should be encouraged anyhow

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this was me tweaking with getting the client config, I think it's not necessary so let me try to revert

src/session.ts Outdated
Comment on lines 12 to 13
agentClientName?: string;
agentClientVersion?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
agentClientName?: string;
agentClientVersion?: string;
agentRunner?: {
name: string;
version: string;
};

it can also be agentClient, it just becomes confusing with who's the client of the agent, the user or the software

agentClientName?: string;
agentClientVersion?: string;

constructor() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should probably pass the config into the constructor to make this dependency more explicit

serviceProvider?: NodeDriverServiceProvider;
apiClient?: ApiClient;
apiClient: ApiClient;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice, I like that the apiClient is always defined now 🥳

Comment on lines +10 to +11
agentClientName?: string;
agentClientVersion?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
agentClientName?: string;
agentClientVersion?: string;
agentRunner?: {
name: string;
version: string;
}

(can also be agentClient, that makes sense; I just find the agent's client to possibly be the user?)


ensureAuthenticated(): asserts this is { apiClient: ApiClient } {
if (!this.apiClient) {
if (!this.apiClient || !this.apiClient.hasCredentials()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (!this.apiClient || !this.apiClient.hasCredentials()) {
if (!this.apiClient.hasCredentials()) {

if (!config.apiClientId || !config.apiClientSecret) {
throw new Error(
"Not authenticated make sure to configure MCP server with MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET environment variables."
);
}

// Initialize or reinitialize API client with credentials
this.apiClient = new ApiClient({
Copy link
Collaborator

Choose a reason for hiding this comment

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

in what scenario would it end up reinitialized with credentials? does the global config object get updated in the middle of a session? we should probably keep anything that is dynamic in a session as part of session then

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