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

Loki: Add structured metadata keys to autocomplete #78584

Merged
merged 11 commits into from
Nov 23, 2023

Conversation

svennergr
Copy link
Contributor

What is this feature?

This PR adds structured metadata keys to the autocomplete of Loki's code editor.

Special notes for your reviewer:

  1. Use lokiStructuredMetadata feature flag.
  2. Start Grafana & Loki.
  3. You should start seeing the nonIndexed label being suggested in the autocomplete:
    image

@matyax matyax self-requested a review November 23, 2023 11:58
@matyax
Copy link
Contributor

matyax commented Nov 23, 2023

FYI there's an error in:

ERROR in ./public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/CompletionDataProvider.test.ts:81:77

@svennergr
Copy link
Contributor Author

FYI there's an error in:

ERROR in ./public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/CompletionDataProvider.test.ts:81:77

Thanks - fixed!

@matyax
Copy link
Contributor

matyax commented Nov 23, 2023

Do we have structured metadata in our devenvs? Should we add it?

@svennergr
Copy link
Contributor Author

Do we have structured metadata in our devenvs? Should we add it?

Yep, it's the nonIndexed field/label in our usual loki devenv. Let me prepare a PR to rename it to something like structuredMetadataKey or something along those lines to hightlight that.

Copy link
Contributor

@matyax matyax left a comment

Choose a reason for hiding this comment

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

Works perfectly 👌
When we combine this with the log details filter it's going to be pretty cool.

@svennergr
Copy link
Contributor Author

Do we have structured metadata in our devenvs? Should we add it?

#78587

@svennergr svennergr merged commit be15739 into main Nov 23, 2023
16 checks passed
@svennergr svennergr deleted the svennergr/structured-metadata-frontend-2 branch November 23, 2023 12:26
eleijonmarck pushed a commit that referenced this pull request Nov 27, 2023
* wip

* remove import

* scope to monaco completions for now

* use `LabelType` enum

* change strucutred metadata documentation

* fix import

* add `responseUtils` tests

* update tests

* fix completions.ts tests

* fix LabelType enum

* fix CompletionDataProvider test
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants