Skip to content

Conversation

@dmihalcik-virtru
Copy link
Member

Proposed Changes

  • This is helpful for figuring out if the index is misconfigured

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

This is helpful for figuring out if the index is misconfigured
@github-actions github-actions bot added comp:kas Key Access Server size/xs labels Sep 10, 2025
@github-actions
Copy link
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 177.980412ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 91.639384ms

Standard Benchmark Metrics Skipped or Failed

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 344.237705ms
Throughput 290.50 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 37.870335371s
Average Latency 376.319991ms
Throughput 132.03 requests/second

NANOTDF Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 26.130237152s
Average Latency 259.453845ms
Throughput 191.35 requests/second

@dmihalcik-virtru dmihalcik-virtru marked this pull request as ready for review September 11, 2025 14:15
@dmihalcik-virtru dmihalcik-virtru requested review from a team as code owners September 11, 2025 14:15
@dmihalcik-virtru dmihalcik-virtru added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit d5eff9f Sep 11, 2025
35 checks passed
@dmihalcik-virtru dmihalcik-virtru deleted the DSPX-1630-better-logs branch September 11, 2025 19:04
@strantalis
Copy link
Member

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves the debuggability of key index requests by logging the KAS URI when a key cannot be found. This is achieved by implementing the fmt.Stringer interface for KeyIndexer and updating the error formatting in DelegatingKeyService. The changes are well-implemented and achieve the stated goal. I have one minor suggestion to improve the consistency of the new error messages.

keyDetails, err := d.index.FindKeyByID(ctx, keyID)
if err != nil {
return nil, fmt.Errorf("unable to find key by ID '%s': %w", keyID, err)
return nil, fmt.Errorf("unable to find key by ID '%s' within index %s: %w", keyID, d.index, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the error message in DeriveKey on line 107, consider using in index instead of within index. This makes the error messages uniform, which is helpful for logging and monitoring.

Suggested change
return nil, fmt.Errorf("unable to find key by ID '%s' within index %s: %w", keyID, d.index, err)
return nil, fmt.Errorf("unable to find key by ID '%s' in index %s: %w", keyID, d.index, err)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances error logging by including the KAS URI in key lookup error messages to aid in debugging index misconfigurations.

  • Added a String() method to KeyIndexer to format index information for logging
  • Updated error messages in Decrypt and DeriveKey methods to include index details

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
service/kas/key_indexer.go Implements String() method returning formatted KAS URI for logging
service/trust/delegating_key_service.go Updates error messages to include index information using %s formatter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:kas Key Access Server size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants