Skip to content

feat!: Add support for filtering with hierarchal and auto-generated keys. #199

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

Merged
merged 9 commits into from
Mar 10, 2025

Conversation

davemarco
Copy link
Contributor

@davemarco davemarco commented Mar 5, 2025

Description

Add support for filtering with hierarchal and autogenerated keys.

To do this we upgrade to latest clp-ffi-js 0.5.0, and pass the new parsed hierarchal reader options.

In addition we modify the json decoder, to also support hierarchal filter keys.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.
  • Docs will come in later PR.

Validation performed

I performed basic validation and checked filtering for IRV2 and json with hierarchal and autogenerated keys.

Summary by CodeRabbit

  • Chores

    • Upgraded the clp-ffi-js dependency for improved performance and functionality.
  • New Features

    • Enabled support for nested log key configurations, allowing more flexible log formatting and filtering.
    • Introduced new utility functions for key processing, improving the overall parsing logic.
  • Refactor

    • Enhanced log decoding and error handling to provide more robust configuration parsing and clearer error messages for reserved key symbols.
    • Updated internal representations of log level and timestamp keys for improved flexibility.

@davemarco davemarco marked this pull request as ready for review March 5, 2025 17:24
Copy link

coderabbitai bot commented Mar 5, 2025

Walkthrough

This pull request updates the dependency version in package.json and refactors key parsing across multiple modules. The decoders now preprocess decoder options using newly added utility functions. The JSONL decoder now supports nested key access by converting keys into arrays. Additionally, the Yscope formatter and associated typings have been updated to introduce and use the new ParsedKey type, replacing the older ParsedFieldName nomenclature.

Changes

File(s) Change Summary
package.json Updated dependency: "clp-ffi-js": "^0.4.0""^0.5.0".
src/services/decoders/ClpIrDecoder/index.ts
src/services/decoders/JsonlDecoder/index.ts
Modified constructors to process decoderOptions through parseFilterKeys. JsonlDecoder now transforms key strings into arrays and uses getNestedJsonValue for nested field extraction.
src/services/decoders/utils.ts Introduced new utility functions: preprocessThenParseFilterKey and parseFilterKeys for processing decoder options and filter keys.
src/services/formatters/YscopeFormatter/index.ts
src/services/formatters/YscopeFormatter/utils.ts
Integrated new type ParsedKey and updated usage of parseKey in field parsing. Renamed related variables and adjusted error handling concerning auto-generated keys.
src/typings/formatters.ts Renamed type ParsedFieldName to ParsedKey in type definitions and export statements for consistency.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant ClpIrDecoder
    participant parseFilterKeys
    participant ClpStreamReader

    Caller->>ClpIrDecoder: Instantiate with decoderOptions
    ClpIrDecoder->>parseFilterKeys: Process decoderOptions (flag: true)
    parseFilterKeys-->>ClpIrDecoder: Return processed readerOptions
    ClpIrDecoder->>ClpStreamReader: Initialize with readerOptions
Loading
sequenceDiagram
    participant Caller
    participant YscopeFormatter
    participant parseKey

    Caller->>YscopeFormatter: Parse field placeholder
    YscopeFormatter->>parseKey: Call with fieldName
    parseKey-->>YscopeFormatter: Return ParsedKey object
    YscopeFormatter->>YscopeFormatter: Validate and process ParsedKey
Loading

Possibly related PRs

Suggested reviewers

  • junhaoliao

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc5ec13 and 7d254f0.

📒 Files selected for processing (1)
  • src/services/formatters/YscopeFormatter/utils.ts (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/services/formatters/YscopeFormatter/utils.ts

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco requested a review from a team as a code owner March 5, 2025 17:24
@davemarco davemarco requested a review from junhaoliao March 5, 2025 17:25
Copy link

@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.

Actionable comments posted: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7285859 and f0a3b64.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • package.json (1 hunks)
  • src/services/decoders/ClpIrDecoder/index.ts (2 hunks)
  • src/services/decoders/JsonlDecoder/index.ts (5 hunks)
  • src/services/decoders/utils.ts (1 hunks)
  • src/services/formatters/YscopeFormatter/index.ts (3 hunks)
  • src/services/formatters/YscopeFormatter/utils.ts (6 hunks)
  • src/typings/formatters.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ...

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • src/services/formatters/YscopeFormatter/index.ts
  • src/services/decoders/ClpIrDecoder/index.ts
  • src/services/decoders/utils.ts
  • src/typings/formatters.ts
  • src/services/decoders/JsonlDecoder/index.ts
  • src/services/formatters/YscopeFormatter/utils.ts
🪛 GitHub Check: lint-check
src/services/decoders/ClpIrDecoder/index.ts

[failure] 29-29:
Imports must not be broken into multiple lines if there are 1 or less elements


[failure] 29-29:
Unexpected line break after this opening brace


[failure] 31-31:
Unexpected line break before this closing brace

src/services/decoders/utils.ts

[failure] 1-1:
Run autofix to sort these imports!


[failure] 9-9:
Imports must not be broken into multiple lines if there are 1 or less elements

src/services/decoders/JsonlDecoder/index.ts

[failure] 27-27:
Imports must not be broken into multiple lines if there are 1 or less elements


[failure] 27-27:
Unexpected line break after this opening brace


[failure] 29-29:
Unexpected line break before this closing brace

🪛 ESLint
src/services/decoders/ClpIrDecoder/index.ts

[error] 29-31: Imports must not be broken into multiple lines if there are 1 or less elements.

(import-newlines/enforce)


[error] 29-29: Unexpected line break after this opening brace.

(@stylistic/object-curly-newline)


[error] 31-31: Unexpected line break before this closing brace.

(@stylistic/object-curly-newline)

src/services/decoders/utils.ts

[error] 9-11: Imports must not be broken into multiple lines if there are 1 or less elements.

(import-newlines/enforce)


[error] 9-9: Unexpected line break after this opening brace.

(@stylistic/object-curly-newline)


[error] 11-11: Unexpected line break before this closing brace.

(@stylistic/object-curly-newline)


[error] 45-45: Expected '===' and instead saw '=='.

(eqeqeq)

src/services/decoders/JsonlDecoder/index.ts

[error] 27-29: Imports must not be broken into multiple lines if there are 1 or less elements.

(import-newlines/enforce)


[error] 27-27: Unexpected line break after this opening brace.

(@stylistic/object-curly-newline)


[error] 29-29: Unexpected line break before this closing brace.

(@stylistic/object-curly-newline)

🪛 GitHub Actions: lint
src/services/decoders/ClpIrDecoder/index.ts

[warning] 1-1: Run autofix to sort these imports! (simple-import-sort/imports)

🔇 Additional comments (19)
package.json (1)

33-33: Dependency version update looks appropriate.

The update from ^0.4.0 to ^0.5.0 for the clp-ffi-js library aligns with the PR's objective to add support for hierarchal and autogenerated keys. According to semantic versioning, this minor version update should introduce new features without breaking existing functionality.

src/services/formatters/YscopeFormatter/index.ts (2)

6-6: Type import looks good.

The import of ParsedKey type is consistent with the renaming from ParsedFieldName to ParsedKey in the typings file.


16-16: Function import is appropriate.

Adding the import for parseKey function is necessary for the new implementation of the field placeholder parsing.

src/services/decoders/ClpIrDecoder/index.ts (1)

48-49: Implementation of filter key parsing looks good.

The code correctly uses the new parseFilterKeys function to preprocess decoder options before passing them to the ClpStreamReader. This enables support for hierarchal and autogenerated keys as intended in the PR.

src/typings/formatters.ts (4)

62-64: Updated documentation is clear and accurate.

The comment for the ParsedKey type has been appropriately updated to reflect its broader usage for both format strings and filter keys.


68-71: Type rename is well-implemented.

Renaming from ParsedFieldName to ParsedKey better represents the type's purpose, especially now that it's used for both format string fields and filter keys.


77-77: Property type reference updated correctly.

The property type reference in YscopeFieldPlaceholder has been correctly updated to use the renamed ParsedKey type.


127-127: Export update is consistent.

The export statement has been updated to use the new type name, maintaining consistency throughout the codebase.

src/services/decoders/utils.ts (3)

13-28: Function looks good!

The preprocessThenParseFilterKey function properly handles the preprocessing of filter keys, including warning about Unicode replacement characters and removing escaped backslashes.


38-57: Functionality looks good!

The parseFilterKeys function correctly handles the validation of auto-generated keys based on decoder support, throwing appropriate errors when necessary.

🧰 Tools
🪛 ESLint

[error] 45-45: Expected '===' and instead saw '=='.

(eqeqeq)


59-62: Export statement looks good!

The export statement properly includes both utility functions.

src/services/decoders/JsonlDecoder/index.ts (3)

41-43: Property type changes look good!

The properties have been correctly updated from strings to arrays to support hierarchical key access.


60-63: Implementation of filter key parsing looks good!

The constructor now properly uses the parseFilterKeys utility to parse and extract key parts, passing false for supportsAutoGeneratedKeys to ensure proper validation for JSONL logs.


175-182: Improved nested JSON value retrieval

The implementation now correctly uses getNestedJsonValue with the key parts arrays, allowing for hierarchical key access in JSON objects.

src/services/formatters/YscopeFormatter/utils.ts (5)

6-6: Type rename looks good!

The change from ParsedFieldName to ParsedKey is consistent with the PR objectives of supporting hierarchical keys.


84-84: Documentation update looks good!

The JSDoc comment has been updated to reflect the new terminology.


96-96: Parameter type update looks good!

The function parameter has been correctly updated to use the ParsedKey type.


165-165: Return type update looks good!

The parseKey function's return type has been updated to ParsedKey for consistency.


179-219: Documentation and return structure updates look good!

The JSDoc comments and return object structure have been updated to reflect the new naming conventions and simplify the returned object.

Comment on lines 95 to 104
const {fieldName, formatterName, formatterOptions} =
splitFieldPlaceholder(groupMatch);

const parsedFieldName: ParsedKey = parseKey(fieldName);
if (null === this.#structuredIrNamespaceKeys && ParsedKey.isAutoGenerated) {
throw new Error(
"`@` is a reserved symbol and must be escaped with `\\` " +
"for JSONL logs."
);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix reference to ParsedKey type.

The condition on line 99 incorrectly references ParsedKey.isAutoGenerated where ParsedKey is a type, not an object. This should be checking the property on the instance.

Apply this diff to fix the type reference:

-            if (null === this.#structuredIrNamespaceKeys && ParsedKey.isAutoGenerated) {
+            if (null === this.#structuredIrNamespaceKeys && parsedFieldName.isAutoGenerated) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const {fieldName, formatterName, formatterOptions} =
splitFieldPlaceholder(groupMatch);
const parsedFieldName: ParsedKey = parseKey(fieldName);
if (null === this.#structuredIrNamespaceKeys && ParsedKey.isAutoGenerated) {
throw new Error(
"`@` is a reserved symbol and must be escaped with `\\` " +
"for JSONL logs."
);
}
const {fieldName, formatterName, formatterOptions} =
splitFieldPlaceholder(groupMatch);
const parsedFieldName: ParsedKey = parseKey(fieldName);
if (null === this.#structuredIrNamespaceKeys && parsedFieldName.isAutoGenerated) {
throw new Error(
"`@` is a reserved symbol and must be escaped with `\\` " +
"for JSONL logs."
);
}

Comment on lines 29 to 31
import {
parseFilterKeys,
} from "../utils";
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix import formatting to comply with code style.

The import statement for parseFilterKeys violates the project's import formatting guidelines. Imports with a single element should not be broken into multiple lines.

Apply this diff to fix the import formatting:

-import {
-    parseFilterKeys,
-} from "../utils";
+import { parseFilterKeys } from "../utils";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
parseFilterKeys,
} from "../utils";
import { parseFilterKeys } from "../utils";
🧰 Tools
🪛 GitHub Check: lint-check

[failure] 29-29:
Imports must not be broken into multiple lines if there are 1 or less elements


[failure] 29-29:
Unexpected line break after this opening brace


[failure] 31-31:
Unexpected line break before this closing brace

🪛 ESLint

[error] 29-31: Imports must not be broken into multiple lines if there are 1 or less elements.

(import-newlines/enforce)


[error] 29-29: Unexpected line break after this opening brace.

(@stylistic/object-curly-newline)


[error] 31-31: Unexpected line break before this closing brace.

(@stylistic/object-curly-newline)

Comment on lines 45 to 46
if (false == supportsAutoGeneratedKeys &&
(parsedLogLevelKey.isAutoGenerated || parsedTimestampKey.isAutoGenerated)) {
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use strict equality operator

Use === instead of == for equality comparisons as per the project's coding guidelines.

Apply this diff to fix the equality comparison:

-    if (false == supportsAutoGeneratedKeys &&
+    if (false === supportsAutoGeneratedKeys &&
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (false == supportsAutoGeneratedKeys &&
(parsedLogLevelKey.isAutoGenerated || parsedTimestampKey.isAutoGenerated)) {
if (false === supportsAutoGeneratedKeys &&
(parsedLogLevelKey.isAutoGenerated || parsedTimestampKey.isAutoGenerated)) {
🧰 Tools
🪛 ESLint

[error] 45-45: Expected '===' and instead saw '=='.

(eqeqeq)

Comment on lines 1 to 11
import {
ParsedKey,
REPLACEMENT_CHARACTER,
} from "../../typings/formatters";
import {
parseKey,
replaceDoubleBacklash,
} from "../formatters/YscopeFormatter/utils";
import {
DecoderOptions,
} from "../../typings/decoders";
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Sort imports according to linting rules

The imports in this file need to be sorted, and imports with single elements should not be broken into multiple lines.

Apply this diff to fix the import formatting:

-import {
-    ParsedKey,
-    REPLACEMENT_CHARACTER,
-} from "../../typings/formatters";
-import {
-    parseKey,
-    replaceDoubleBacklash,
-} from "../formatters/YscopeFormatter/utils";
-import {
-    DecoderOptions,
-} from "../../typings/decoders";
+import { DecoderOptions } from "../../typings/decoders";
+import { ParsedKey, REPLACEMENT_CHARACTER } from "../../typings/formatters";
+import { parseKey, replaceDoubleBacklash } from "../formatters/YscopeFormatter/utils";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
ParsedKey,
REPLACEMENT_CHARACTER,
} from "../../typings/formatters";
import {
parseKey,
replaceDoubleBacklash,
} from "../formatters/YscopeFormatter/utils";
import {
DecoderOptions,
} from "../../typings/decoders";
import { DecoderOptions } from "../../typings/decoders";
import { ParsedKey, REPLACEMENT_CHARACTER } from "../../typings/formatters";
import { parseKey, replaceDoubleBacklash } from "../formatters/YscopeFormatter/utils";
🧰 Tools
🪛 GitHub Check: lint-check

[failure] 1-1:
Run autofix to sort these imports!


[failure] 9-9:
Imports must not be broken into multiple lines if there are 1 or less elements

🪛 ESLint

[error] 9-11: Imports must not be broken into multiple lines if there are 1 or less elements.

(import-newlines/enforce)


[error] 9-9: Unexpected line break after this opening brace.

(@stylistic/object-curly-newline)


[error] 11-11: Unexpected line break before this closing brace.

(@stylistic/object-curly-newline)

Comment on lines 27 to 29
import {
parseFilterKeys,
} from "../utils";
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix import formatting

The import statement for parseFilterKeys should be on a single line since it's importing only one element.

Apply this diff to fix the import formatting:

-import {
-    parseFilterKeys,
-} from "../utils";
+import { parseFilterKeys } from "../utils";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
parseFilterKeys,
} from "../utils";
import { parseFilterKeys } from "../utils";
🧰 Tools
🪛 GitHub Check: lint-check

[failure] 27-27:
Imports must not be broken into multiple lines if there are 1 or less elements


[failure] 27-27:
Unexpected line break after this opening brace


[failure] 29-29:
Unexpected line break before this closing brace

🪛 ESLint

[error] 27-29: Imports must not be broken into multiple lines if there are 1 or less elements.

(import-newlines/enforce)


[error] 27-27: Unexpected line break after this opening brace.

(@stylistic/object-curly-newline)


[error] 29-29: Unexpected line break before this closing brace.

(@stylistic/object-curly-newline)

@@ -74,7 +74,7 @@ type ParsedFieldName = {
* Parsed field placeholder from a YScope format string.
*/
type YscopeFieldPlaceholder = {
parsedFieldName: ParsedFieldName;
parsedFieldName: ParsedKey;
Copy link
Member

Choose a reason for hiding this comment

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

just curious, how do we differentiate between a parsedKey and a parsedFieldName after this type renaming?

Copy link
Member

Choose a reason for hiding this comment

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

We discussed offline:

The concept of "field names" are usually referenced in the context of field formatters / formatter strings. The docs also references this part of the specifier as <field-name>. For field formatters, it is fine to leave the name as-is. We can rename the field in a future refactoring PR if the name also changes in the docs.

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

looks mostly good. let's see if the suggestions about exception messages make sense

* @param filterKey
* @return The parsed key.
*/
const preprocessThenParseFilterKey = (filterKey: string): ParsedKey => {
Copy link
Member

Choose a reason for hiding this comment

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

(no need to address this right now - we can revisit in a future PR. we can file an issue if you also agree

With my recent experiences, i believe the Unicode Replacement character is used for replacing sequences that can't be decoded as UTF-8 characters, which means it may have a higher chance of occurrence than any other Unicode characters, depending on how users generate IRv2 logs.

In that case, we may want use a different character for replacement.

anyways, let's make sure this behaviour is covered when we put up the docs

Copy link
Contributor Author

@davemarco davemarco Mar 6, 2025

Choose a reason for hiding this comment

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

I see your point. tbh i only chose Unicode Replacement character because i thought the name was fitting. Note however, the error will only trigger on the keys not the values, which are probably human generated, so less likely to encounter replacement character.

Also, i think we want to get rid of this eventually with antler parser. With all that being said, if you want to change it to something else, we just need to change the character in the code in one place and replace the function docstrings in a few places.

Copy link
Member

Choose a reason for hiding this comment

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

the error will only trigger on the keys not the values, which are probably human generated, so less likely to use replacement character.

fair. a rare example of how this would happen is that people can write SHIFT-JIS Japanese in the keys and the logging framework / text editor decides to encode the log events as only UTF-8 in the logs. Then to select the key in the log viewer as a level / timestamp key, they would put the key partially (or fully) containing the unicode replacement character. again, i agree this is a multi-point failure, should be really rare, and for the existing use cases we're serving, likely we won't encounter such issues.

we want to get rid of this eventually with antler parser

yeah, hopefully we won't really see odd use cases before we migrate there

Comment on lines 46 to 47
"`@` is a reserved symbol and must be escaped with `\\` " +
"for JSONL logs."
Copy link
Member

Choose a reason for hiding this comment

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

how about (need to reflow if there's line length violation)

Suggested change
"`@` is a reserved symbol and must be escaped with `\\` " +
"for JSONL logs."
"`@` is a reserved symbol for CLP IR logs and must be escaped by `\\` " +
"for JSONL logs."

Comment on lines 101 to 102
"`@` is a reserved symbol and must be escaped with `\\` " +
"for JSONL logs."
Copy link
Member

Choose a reason for hiding this comment

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

similar to the one thrown at parseFilterKeys(), i believe mentioning "CLP IR" helps with the context.

shall we consider making this message a const so it can be reused across multiple places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm okay with adding CLP IR and I think we can define it here, then import to other location.

@davemarco
Copy link
Contributor Author

I made small change please look at last commit

@davemarco davemarco requested a review from junhaoliao March 7, 2025 02:26
@davemarco davemarco changed the title feat!: Add support for filtering with hierarchal and autogenerated keys. feat!: Add support for filtering with hierarchal and auto-generated keys. Mar 7, 2025
junhaoliao
junhaoliao previously approved these changes Mar 7, 2025
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

the PR title lgtm

@davemarco
Copy link
Contributor Author

@junhaoliao - reminder to reapprove, i made a very minor tweak in a newer commit

@davemarco davemarco merged commit 02797fc into y-scope:main Mar 10, 2025
3 checks passed
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.

2 participants