Skip to content

fix: update Flux help#6170

Merged
alespour merged 16 commits intomasterfrom
fix/update-flux-help
Feb 5, 2026
Merged

fix: update Flux help#6170
alespour merged 16 commits intomasterfrom
fix/update-flux-help

Conversation

@alespour
Copy link
Contributor

@alespour alespour commented Jan 27, 2026

Closes #

Flux functions help was not updated for a very long.

This PR

  • updates Flux function help
    • new entries added from docs: 299
    • removed entries: 1 (sleep - removed in v0.123 2021-07-19)
    • updates existing entries:
      • functions descriptions
      • missing args descriptions
      • broken links for built-in functions (eg. aggregateWindow)
  • adds a Python script scripts/flux-help-sync.py for generating Flux help update patches from Flux documentation in docs-v2 repository. If patch looks ok, it can be applied with git apply flux-help.diff. See scripts/flux-help-sync.README.md about rules of patch generation.

@alespour alespour force-pushed the fix/update-flux-help branch from ae31092 to 82efaea Compare January 27, 2026 11:42
@alespour alespour marked this pull request as ready for review January 27, 2026 12:16
@alespour alespour changed the title Fix/update flux help fix: update Flux help Jan 27, 2026
@alespour alespour requested a review from Copilot January 27, 2026 12:32
Copy link

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

Updates the Flux function help content and improves how examples are rendered in the UI, and adds a helper script to regenerate Flux help patches from the docs-v2 repository.

Changes:

  • Render Flux function examples as preformatted text so multi-line snippets display correctly.
  • Update snippet styling to preserve newlines and inherit typography.
  • Add a Python script (and README) to generate a unified diff for syncing Flux help entries from local docs-v2.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/src/flux/components/flux_functions_toolbar/TooltipExample.tsx Switches example rendering to <pre> to preserve multi-line formatting.
ui/src/flux/components/flux_functions_toolbar/FluxFunctionsToolbar.scss Updates .flux-functions-toolbar--snippet styling to better support <pre> and wrapped whitespace.
scripts/flux-help-sync.py Adds a generator script that builds a patch to sync Flux help entries from local docs.
scripts/flux-help-sync.README.md Documents how to run the sync script and what it outputs.
CHANGELOG.md Adds a changelog entry referencing this PR.

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

@alespour alespour requested a review from bednar January 27, 2026 12:45
@alespour alespour force-pushed the fix/update-flux-help branch from bbd7da2 to d8d20a7 Compare January 27, 2026 15:20
@alespour
Copy link
Contributor Author

no idea why cluster fails to deploy for e2e

Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

The code looks good to me 🚀.

Before merging, please wait for approval from @karel-rehor — he will test the solution in the UI.

@bednar bednar requested a review from karel-rehor January 29, 2026 09:26
@karel-rehor
Copy link
Contributor

I've tested the UI in Opera. There are a couple of questions that need to be resolved before I can approve.

The test results are in FluxHelpTestPlan.html

  1. It was noted that when checking clicking and inserting a function to the tick script editor, that the results are messy. The examples seem to be added completely and often make no sense at the point of insertion, so the resulting script is unusable. I recall this was also an issue in past releases, so don't consider it a blocker.
  2. In certain places some markdown is leaked into descriptions. However this syntax can sometimes conflict with flux syntax. e.g.(flux e**x, markdown **Bold**). Given the state of the Chronograf project, as essentially in maintenance mode only, I'm not considering this automatically a blocker, but open this question up for discussion. I've grepped through functions.ts for markdown syntax noted in the UI. The results are in leakedMarkdownSyntax.txt.

@karel-rehor
Copy link
Contributor

karel-rehor commented Feb 3, 2026

OK. There is a clear regression issue with clicking and inserting functions with this release.

On attempting to insert a |>map() function into the pipeline, the current release works without issue. However the PR6170 build inserts an example that cannot work in the pipeline.

To recreate.

  1. Build a basic pipeline
  2. Open Script Editor
  3. Locate the map function
  4. Click to add it to the pipeline
  5. Click run script

With the current release (1.10.9) the default map function in the pipeline works and the visualization is updated.
With the build of PR6170, it is clear that the insert corrupted the pipeline, and after naively clicking run script an error is returned.

See the following screencasts.

InsertMapFunction-Release1_10_9.webm
InsertMapFunxtion-PR6170.webm

Perhaps this functionality can be reworked to insert something other than the example.

Suggestion

{
    name: 'map',
    args: [
      {
        name: 'fn',
        desc: 'Single argument function to apply to each record.',
        type: 'Function',
      },
      {
        name: 'mergeKey',
        desc:
          '_(Deprecated)_ Merge group keys of mapped records. Default is `false`.',
        type: 'Boolean',
      },
    ],
    package: '',
    desc: 'Iterates over and applies a function to input rows.',
    example:
      'import "sampledata"\n\nsampledata.int()\n    |> map(fn: (r) => ({r with _value: r._value * r._value}))',
    inserts: '|> map(fn: (r) => ({ r with _value: r._value * r._value }))'  
    category: 'Transformations',
    link: 'https://docs.influxdata.com/flux/v0/stdlib/universe/map/',
  }

Maybe a new field inserts can be added to the function structure and the value of that field can be inserted instead of the full example. For batch preparation, perhaps the example value for the current release 1.10.9 can be copied into this new field.

Maybe the handler is here

@alespour alespour force-pushed the fix/update-flux-help branch from f136aa0 to 0eaca5b Compare February 4, 2026 10:35
@alespour
Copy link
Contributor Author

alespour commented Feb 4, 2026

@karel-rehor Fixed. Code in examples is just function call without any formatting, as it was before.

@karel-rehor
Copy link
Contributor

karel-rehor commented Feb 4, 2026

@alespour

@karel-rehor Fixed. Code in examples is just function call without any formatting, as it was before.

OK, I'll start retesting, based on same plan.

@karel-rehor
Copy link
Contributor

I see another issue with click and insert functions, however this is not a regression. It is also present in release 1.10.9 and I think may have been around for a while.

Some functions like map or aggregateWindow work in the pipeline, while others like strings.trim work with inline or lambda functions. When clicking on these kinds of functions, they get inserted as part of the pipeline. This happens even when the cursor is placed at the location in the lambda function where they are required. Running the script then throws errors like "missing property value". See screencast below.

InsertInlineStringTrimRight.webm

Since this is an already existing issue, I don't think it should block this PR. I'll create a related issue in the repository. Unless, of course, we want to fix this with this release.

@alespour
Copy link
Contributor Author

alespour commented Feb 4, 2026

Since this is an already existing issue, I don't think it should block this PR. I'll create a related issue in the repository. Unless, of course, we want to fix this with this release.

Agree. Fixing this issue is beyond the scope of this pull request.

@karel-rehor
Copy link
Contributor

OK tested the latest changes.

Report is here.
FluxHelpTestPlan02042026.html

Two minor issues were encountered when inserting functions. After inserting anomolydetection.mad and bitwise.uand when running the scripts a new error is encountered. unknown import path e.g.

  • unknown import path "contrib/anaisdg/anomalydetection"
  • unknown import path "bitwise"

Neither of these functions is available in release 1.10.9.

The question then arrises, if access to these functions requires configuration with additional libraries, should they be made available in the UI if that configuration has not been added?

Regarding problems with inserting inline functions as pipeline functions a separate issue has been opened. #6172

@alespour
Copy link
Contributor Author

alespour commented Feb 4, 2026

Strange... this runs OK for me in Chronograf script editor, against InfluxDB OSS 2.7:

import "bitwise"
import "contrib/anaisdg/anomalydetection"
from(bucket: "gateway")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "hospital_v2")
  |> filter(fn: (r) => r["_field"] == "distance")
  |> map(fn: (r) => ({r with _value: float(v: bitwise.uand(a: uint(v: 1234), b: uint(v: 4567)))}))
  |> anomalydetection.mad(threshold: 1.0)

@alespour
Copy link
Contributor Author

alespour commented Feb 5, 2026

The error comes from the backend. I assume you are using InfluxDB 1.8. It has rather obsolete Flux version 0.65. Both these packages are available in InfluxDB 1.11.
image
image

Co-authored-by: Jakub Bednář <jakub.bednar@gmail.com>
@karel-rehor
Copy link
Contributor

@alespour

Yes, the test stack I've been working with inherited Influxdb version 1.8 by default. I've updated it to use 1.11. The newer flux functions are there. So everything looks good, except for the inserts issue which is out of scope.

FluxHelpTestPlan02042026-updated.html

Copy link
Contributor

@karel-rehor karel-rehor left a comment

Choose a reason for hiding this comment

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

Functional testing of the UI changes looks good to me.

Reported one new issue (#6172) out of scope for this PR.

🚴 🏁

@alespour alespour requested a review from bednar February 5, 2026 10:00
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@alespour alespour merged commit f815286 into master Feb 5, 2026
3 checks passed
@alespour alespour deleted the fix/update-flux-help branch February 5, 2026 10:36
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