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

Add Global Cache OLAP telemetry #3041

Merged
merged 6 commits into from
Dec 11, 2023
Merged

Add Global Cache OLAP telemetry #3041

merged 6 commits into from
Dec 11, 2023

Conversation

kwapik
Copy link
Contributor

@kwapik kwapik commented Dec 8, 2023

Description of change

This adds Global Cache metrics to OLAP telemetry.

Ref: GH-2981

Checklist
  • Tested in playground or other setup

Summary by CodeRabbit

  • Refactor

    • Renamed cache status labels for clarity and consistency.
    • Improved handling of cache lookup and operation statuses in telemetry data.
  • New Features

    • Introduced new telemetry labels for global cache lookup and operation statuses.
  • Documentation

    • Updated the observability documentation to reflect new and modified telemetry fields.
  • Bug Fixes

    • Corrected capitalization in the response_received field.
    • Removed an outdated reject reason from the aperture.reject_reason field.
  • Style

    • Standardized formatting in the Flow interface and related methods for better readability.

@kwapik kwapik requested a review from a team as a code owner December 8, 2023 15:44
Copy link
Contributor

coderabbitai bot commented Dec 8, 2023

Walkthrough

The changes involve renaming and adding constants related to cache lookup and operation statuses in the otelcollector package, refining the logic for handling cache responses, and updating documentation to reflect these changes. Additionally, the aperture-js SDK has seen updates to the Flow interface and _Flow class to accommodate the new cache-related properties and methods.

Changes

File Path Change Summary
pkg/otelcollector/consts/consts.go Renamed cache status constants; added new constants for global cache statuses.
pkg/otelcollector/metricsprocessor/... Updated logic and tests for cache lookup and operation statuses; modified labels in filters.
docs/content/reference/observability/flow-metrics/flow-metrics.md Updated reject_reason and response_received fields; added new cache status fields.
sdks/aperture-js/sdk/flow.ts Updated Flow interface and _Flow class for cache-related properties and methods.

Poem

In the code where the data hops, 🐇💻
A rabbit refines the cache ops.
Constants renamed, new statuses acclaimed,
With each commit, the progress never stops. 🌟


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6670f88 and 0e2ecbb.
Files selected for processing (3)
  • pkg/otelcollector/consts/consts.go (1 hunks)
  • pkg/otelcollector/metricsprocessor/internal/check_response_labels.go (1 hunks)
  • pkg/otelcollector/metricsprocessor/internal/labels_filter.go (1 hunks)
Additional comments: 4
pkg/otelcollector/consts/consts.go (1)
  • 87-97: The constants ApertureResultCacheLookupStatusLabel, ApertureResultCacheOperationStatusLabel, ApertureGlobalCacheLookupStatusLabel, and ApertureGlobalCacheOperationStatusLabel have been correctly added and renamed as per the PR objectives and summaries. Ensure that all references to these constants in the codebase are updated to reflect these changes.

The verification of the new constant names within the codebase shows that they are being used correctly in multiple files, which aligns with the changes described in the PR objectives and summaries. No issues were found with the usage of the new constants.

Final review comment:

The constants ApertureResultCacheLookupStatusLabel, ApertureResultCacheOperationStatusLabel, ApertureGlobalCacheLookupStatusLabel, and ApertureGlobalCacheOperationStatusLabel have been correctly added and renamed, and their usage across the codebase is consistent with the changes described.

pkg/otelcollector/metricsprocessor/internal/check_response_labels.go (2)
  • 61-75: The changes to handle GlobalCacheResponses are well-structured and follow the existing pattern for handling ResultCacheResponse. The loop correctly checks for nil before processing each globalCacheResponse, which is good for avoiding potential nil pointer dereferences. The use of String() method for LookupStatus and OperationStatus is consistent with the rest of the codebase.

  • 61-75: Please ensure that the new logic for handling GlobalCacheResponses is thoroughly tested, as the PR checklist indicates that testing has not been completed. This is particularly important for telemetry changes, which are critical for monitoring and observability.

pkg/otelcollector/metricsprocessor/internal/labels_filter.go (1)
  • 40-47: The addition of otelconsts.ApertureGlobalCacheLookupStatusLabel and otelconsts.ApertureGlobalCacheOperationStatusLabel to the _includeAttributesCommon variable reflects the changes intended by the PR to include global cache metrics in telemetry. This change should be cross-checked with the rest of the codebase to ensure that the new constants are used consistently and correctly.

The verification of the new constants ApertureGlobalCacheLookupStatusLabel and ApertureGlobalCacheOperationStatusLabel shows consistent usage across the codebase in both the labels_filter.go and check_response_labels.go files, as well as their declaration in consts.go. This confirms that the changes are in line with the PR's objective to add global cache metrics to the telemetry.

Final review comment:

The addition of global cache metrics to the telemetry is verified with consistent usage of the new constants across the relevant files. The changes align with the PR's objectives.

@fluxninja fluxninja deleted a comment from coderabbitai bot Dec 11, 2023
@kwapik kwapik requested a review from a team as a code owner December 11, 2023 10:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0e2ecbb and 7f2bfc6.
Files selected for processing (4)
  • docs/content/reference/observability/flow-metrics/flow-metrics.md (3 hunks)
  • pkg/otelcollector/metricsprocessor/internal/check_response_labels.go (2 hunks)
  • pkg/otelcollector/metricsprocessor/internal/labels_filter.go (2 hunks)
  • pkg/otelcollector/metricsprocessor/processor.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • pkg/otelcollector/metricsprocessor/internal/check_response_labels.go
  • pkg/otelcollector/metricsprocessor/internal/labels_filter.go
Additional comments: 3
docs/content/reference/observability/flow-metrics/flow-metrics.md (2)
  • 70-76: The addition of new fields related to cache lookup and operation status for both result and global caches is consistent with the PR objectives and the AI-generated summary. This change enhances the telemetry system's ability to monitor cache performance.

  • 76-76: The {user-defined-labels} field is mentioned in the AI-generated summary as being added. Please provide more context on where this field is used and its intended purpose.

pkg/otelcollector/metricsprocessor/processor.go (1)
  • 64-70: The capacity calculation within the ensureCapacity function has been updated to account for CheckResponse with a hardcoded value of 21. Ensure that this value accurately reflects the number of attributes expected from CheckResponse and that it is consistent with the system's requirements.

pkg/otelcollector/metricsprocessor/processor.go Outdated Show resolved Hide resolved
@kwapik kwapik force-pushed the kwapik/global-cache-olap branch from 8aec03a to 211ec2d Compare December 11, 2023 12:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3f9ab5a and 211ec2d.
Files selected for processing (6)
  • docs/content/reference/observability/flow-metrics/flow-metrics.md (3 hunks)
  • pkg/otelcollector/consts/consts.go (1 hunks)
  • pkg/otelcollector/metricsprocessor/internal/check_response_labels.go (2 hunks)
  • pkg/otelcollector/metricsprocessor/internal/check_response_labels_test.go (1 hunks)
  • pkg/otelcollector/metricsprocessor/internal/labels_filter.go (2 hunks)
  • pkg/otelcollector/metricsprocessor/processor.go (1 hunks)
Additional comments: 12
docs/content/reference/observability/flow-metrics/flow-metrics.md (3)
  • 33-34: The aperture.samplers and aperture.dropping_samplers fields are added as new fields. Ensure that these fields are properly documented and integrated into the telemetry system, and that any systems consuming this data are updated to handle these new fields.

  • 44-44: The response_received field has been added and is marked as a single value type with true or false as possible values. This field should be clearly documented to indicate under what conditions a response is considered received.

  • 72-75: The addition of aperture.cache_lookup_status, aperture.cache_operation_status, aperture.global_cache_lookup_statuses, and aperture.global_cache_operation_statuses fields aligns with the PR's objective to integrate Global Cache metrics. Ensure that the implementation of these metrics in the telemetry system is consistent with the documentation provided here.

pkg/otelcollector/consts/consts.go (3)
  • 87-97: The renaming and addition of constants for cache lookup and operation statuses are consistent with the PR objectives to distinguish between result cache and global cache metrics.

  • 87-97: Verify that the renamed and new constants are correctly used throughout the codebase.


The verification process confirms that the old constants ApertureCacheLookupStatusLabel and ApertureCacheOperationStatusLabel are no longer present in the codebase. The new constants ApertureResultCacheLookupStatusLabel, ApertureResultCacheOperationStatusLabel, ApertureGlobalCacheLookupStatusesLabel, and ApertureGlobalCacheOperationStatusesLabel are correctly used in various files, including labels_filter.go, check_response_labels_test.go, check_response_labels.go, and consts.go. No issues were found with the usage of these constants.

  • 87-97: Ensure that any external documentation, configuration files, or systems that might rely on the old constant names are updated to reflect the changes.
pkg/otelcollector/metricsprocessor/internal/check_response_labels.go (4)
  • 29-36: The comments have been updated to include the new constants for result cache and global cache statuses. This aligns with the PR's objective to expand telemetry to include Global Cache metrics.

  • 66-81: The logic for handling cache responses has been expanded to include result cache and global cache responses. Ensure that the telemetry system is prepared to handle these new types of responses and that the data is being processed correctly.


The verification script has successfully identified the files where the new labels related to cache status are being used. This confirms that the changes have been integrated into the telemetry system and are being referenced in multiple locations, including the constants definition, the logic for handling cache responses, and associated tests.

Final review comment:

The expansion of cache response handling to include result cache and global cache responses has been verified across multiple files in the telemetry system. The new labels are correctly integrated and utilized.

  • 72-79: The implementation for handling multiple global cache responses seems correct. However, it's important to ensure that the telemetry system can handle the potential increase in data volume due to multiple global cache instances reporting their statuses.

The shell script has successfully identified the files where the new labels ApertureGlobalCacheLookupStatusesLabel and ApertureGlobalCacheOperationStatusesLabel are used. This indicates that the changes related to the handling of multiple global cache instances have been integrated into the telemetry system across several files, which is a positive sign for the consistency of the implementation.

Given this information, the original concern about the telemetry system's ability to handle the increased data volume from multiple global cache instances is somewhat mitigated, as the presence of these labels in multiple files suggests that the system has been updated to accommodate the new labels.

Final review comment:

The implementation for handling multiple global cache responses is consistent across the identified files. It appears that the telemetry system has been updated to accommodate the new labels, which should help in managing the increased data volume from multiple global cache instances.

  • 63-83: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [29-83]

Please confirm that the new telemetry metrics have been tested in a playground or other setup to ensure they work as expected and do not introduce any regressions.

pkg/otelcollector/metricsprocessor/internal/check_response_labels_test.go (1)
  • 142-176: The new test cases for setting result cache and global cache dimensions are correctly implemented and align with the PR's objectives to integrate Global Cache metrics into the OLAP telemetry system.
pkg/otelcollector/metricsprocessor/internal/labels_filter.go (1)
  • 53-56: The addition of new labels to _includeAttributesSDK aligns with the PR's objective to enhance telemetry for Global Cache metrics.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5e1d4c1 and c1f8251.
Files selected for processing (1)
  • sdks/aperture-js/sdk/flow.ts (5 hunks)
Additional comments: 6
sdks/aperture-js/sdk/flow.ts (6)
  • 64-64: The change in formatting for the retryAfter method in the Flow interface is a good practice for code readability and consistency.

  • 98-98: The comparison in the shouldRun method has been updated to check for DECISION_TYPE_ACCEPTED. Ensure that this change aligns with the intended logic and that all decision types are handled appropriately.

  • 363-365: The implementation of the retryAfter method has been updated to convert the wait time to a string and handle undefined values. Verify that this implementation correctly handles all expected input scenarios and that the conversion to string does not introduce any precision loss for the nanos field.

  • 406-421: The new operations for handling cacheLookupResponse and globalCacheResponses involve converting buffer values to a base64 string. Ensure that the bufferToByteArrayJson function is correctly implemented and that it handles all edge cases, such as empty buffers or non-buffer values.

  • 458-465: The bufferToByteArrayJson function converts a buffer to a base64 string. Verify that this conversion is necessary for the intended use case and that the function is used consistently throughout the class.

  • 403-426: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [61-465]

Given the PR overview indicates that the changes have not been tested in a playground or other setup, it is crucial to perform thorough testing to ensure that the new functionality works as expected and does not introduce any regressions or bugs.

@kwapik kwapik merged commit 4e32988 into main Dec 11, 2023
25 checks passed
@kwapik kwapik deleted the kwapik/global-cache-olap branch December 11, 2023 14:32
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.

4 participants