Merge branch 'copilot/fix-broken-docker-link' into copilot/resolve-conflicts
Resolve conflict in .github/workflows/doc-review.yml by keeping the new GitHub Check Run approach from PR #6975 (copilot/improve-review-status-signals). The conflict was between: - HEAD: New check run approach (checks.create/update, no PR comments) - copilot/fix-broken-docker-link: Old PR comment approach (@github-copilot) The new check run approach is correct - it replaces @github-copilot PR comments with GitHub Check Runs visible in the Checks tab.pull/6976/head
commit
ce09a4f6bc
|
|
@ -0,0 +1 @@
|
|||
.github/workflows/*.lock.yml linguist-generated=true merge=ours
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
description: |
|
||||
This workflow creates daily repo status reports. It gathers recent repository
|
||||
activity (issues, PRs, discussions, releases, code changes) and generates
|
||||
engaging GitHub issues with productivity insights, community highlights,
|
||||
and project recommendations.
|
||||
|
||||
on:
|
||||
schedule: daily
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
|
||||
network: defaults
|
||||
|
||||
tools:
|
||||
github:
|
||||
# If in a public repo, setting `lockdown: false` allows
|
||||
# reading issues, pull requests and comments from 3rd-parties
|
||||
# If in a private repo this has no particular effect.
|
||||
lockdown: false
|
||||
|
||||
safe-outputs:
|
||||
mentions: false
|
||||
allowed-github-references: []
|
||||
create-issue:
|
||||
title-prefix: "[repo-status] "
|
||||
labels: [report, daily-status]
|
||||
close-older-issues: true
|
||||
source: githubnext/agentics/workflows/daily-repo-status.md@9a76aba267225767b9b2e1623188d11ed9b58f11
|
||||
engine: copilot
|
||||
---
|
||||
|
||||
# Daily Repo Status
|
||||
|
||||
Create an upbeat daily status report for the repo as a GitHub issue.
|
||||
|
||||
## What to include
|
||||
|
||||
- Recent repository activity (issues, PRs, discussions, releases, code changes)
|
||||
- Progress tracking, goal reminders and highlights
|
||||
- Project status and recommendations
|
||||
- Actionable next steps for maintainers
|
||||
|
||||
## Style
|
||||
|
||||
- Be positive, encouraging, and helpful 🌟
|
||||
- Use emojis moderately for engagement
|
||||
- Keep it concise - adjust length based on actual activity
|
||||
|
||||
## Process
|
||||
|
||||
1. Gather recent activity from the repository
|
||||
2. Study the repository, its issues and its pull requests
|
||||
3. Create a new GitHub issue with your findings and insights
|
||||
|
|
@ -117,7 +117,10 @@ function getInfluxDBUrls() {
|
|||
initializeStorageItem('urls', JSON.stringify(DEFAULT_STORAGE_URLS));
|
||||
}
|
||||
|
||||
return JSON.parse(localStorage.getItem(urlStorageKey));
|
||||
const storedUrls = JSON.parse(localStorage.getItem(urlStorageKey));
|
||||
// Backfill any new default keys missing from stored data (e.g., when new
|
||||
// products like core/enterprise are added after a user's first visit).
|
||||
return { ...DEFAULT_STORAGE_URLS, ...storedUrls };
|
||||
}
|
||||
|
||||
// Get the current or previous URL for a specific product or a custom url
|
||||
|
|
@ -131,8 +134,8 @@ function getInfluxDBUrl(product) {
|
|||
const urlsString = localStorage.getItem(urlStorageKey);
|
||||
const urlsObj = JSON.parse(urlsString);
|
||||
|
||||
// Return the URL of the specified product
|
||||
return urlsObj[product];
|
||||
// Return the URL of the specified product, falling back to the default
|
||||
return urlsObj[product] ?? DEFAULT_STORAGE_URLS[product];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -289,8 +289,8 @@ Run the query on any data node for each retention policy and database.
|
|||
Here, we use InfluxDB's [CLI](/enterprise_influxdb/v1/tools/influx-cli/use-influx/) to execute the query:
|
||||
|
||||
```
|
||||
> ALTER RETENTION POLICY "<retention_policy_name>" ON "<database_name>" REPLICATION 3
|
||||
>
|
||||
ALTER RETENTION POLICY "<retention_policy_name>" ON "<database_name>" REPLICATION 3
|
||||
|
||||
```
|
||||
|
||||
A successful `ALTER RETENTION POLICY` query returns no results.
|
||||
|
|
|
|||
|
|
@ -124,11 +124,11 @@ CREATE USER <username> WITH PASSWORD '<password>'
|
|||
|
||||
###### CLI example
|
||||
```js
|
||||
> CREATE USER todd WITH PASSWORD 'influxdb41yf3'
|
||||
> CREATE USER alice WITH PASSWORD 'wonder\'land'
|
||||
> CREATE USER "rachel_smith" WITH PASSWORD 'asdf1234!'
|
||||
> CREATE USER "monitoring-robot" WITH PASSWORD 'XXXXX'
|
||||
> CREATE USER "$savyadmin" WITH PASSWORD 'm3tr1cL0v3r'
|
||||
CREATE USER todd WITH PASSWORD 'influxdb41yf3'
|
||||
CREATE USER alice WITH PASSWORD 'wonder\'land'
|
||||
CREATE USER "rachel_smith" WITH PASSWORD 'asdf1234!'
|
||||
CREATE USER "monitoring-robot" WITH PASSWORD 'XXXXX'
|
||||
CREATE USER "$savyadmin" WITH PASSWORD 'm3tr1cL0v3r'
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
|
@ -169,13 +169,13 @@ CLI examples:
|
|||
`GRANT` `READ` access to `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> GRANT READ ON "NOAA_water_database" TO "todd"
|
||||
GRANT READ ON "NOAA_water_database" TO "todd"
|
||||
```
|
||||
|
||||
`GRANT` `ALL` access to `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> GRANT ALL ON "NOAA_water_database" TO "todd"
|
||||
GRANT ALL ON "NOAA_water_database" TO "todd"
|
||||
```
|
||||
|
||||
##### `REVOKE` `READ`, `WRITE`, or `ALL` database privileges from an existing user
|
||||
|
|
@ -189,13 +189,13 @@ CLI examples:
|
|||
`REVOKE` `ALL` privileges from `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> REVOKE ALL ON "NOAA_water_database" FROM "todd"
|
||||
REVOKE ALL ON "NOAA_water_database" FROM "todd"
|
||||
```
|
||||
|
||||
`REVOKE` `WRITE` privileges from `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> REVOKE WRITE ON "NOAA_water_database" FROM "todd"
|
||||
REVOKE WRITE ON "NOAA_water_database" FROM "todd"
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
|
@ -230,7 +230,7 @@ SET PASSWORD FOR <username> = '<password>'
|
|||
CLI example:
|
||||
|
||||
```sql
|
||||
> SET PASSWORD FOR "todd" = 'password4todd'
|
||||
SET PASSWORD FOR "todd" = 'password4todd'
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
|
@ -250,6 +250,6 @@ DROP USER <username>
|
|||
CLI example:
|
||||
|
||||
```sql
|
||||
> DROP USER "todd"
|
||||
DROP USER "todd"
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ For example, simple addition:
|
|||
Assign an expression to a variable using the assignment operator, `=`.
|
||||
|
||||
```js
|
||||
> s = "this is a string"
|
||||
> i = 1 // an integer
|
||||
> f = 2.0 // a floating point number
|
||||
s = "this is a string"
|
||||
i = 1 // an integer
|
||||
f = 2.0 // a floating point number
|
||||
```
|
||||
|
||||
Type the name of a variable to print its value:
|
||||
|
|
@ -48,7 +48,7 @@ this is a string
|
|||
Flux also supports records. Each value in a record can be a different data type.
|
||||
|
||||
```js
|
||||
> o = {name:"Jim", age: 42, "favorite color": "red"}
|
||||
o = {name:"Jim", age: 42, "favorite color": "red"}
|
||||
```
|
||||
|
||||
Use **dot notation** to access a properties of a record:
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ the CQ has no `FOR` clause.
|
|||
#### 1. Create the database
|
||||
|
||||
```sql
|
||||
> CREATE DATABASE "food_data"
|
||||
CREATE DATABASE "food_data"
|
||||
```
|
||||
|
||||
#### 2. Create a two-hour `DEFAULT` retention policy
|
||||
|
|
@ -85,7 +85,7 @@ Use the
|
|||
statement to create a `DEFAULT` RP:
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "two_hours" ON "food_data" DURATION 2h REPLICATION 1 DEFAULT
|
||||
CREATE RETENTION POLICY "two_hours" ON "food_data" DURATION 2h REPLICATION 1 DEFAULT
|
||||
```
|
||||
|
||||
That query creates an RP called `two_hours` that exists in the database
|
||||
|
|
@ -116,7 +116,7 @@ Use the
|
|||
statement to create a non-`DEFAULT` retention policy:
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "a_year" ON "food_data" DURATION 52w REPLICATION 1
|
||||
CREATE RETENTION POLICY "a_year" ON "food_data" DURATION 52w REPLICATION 1
|
||||
```
|
||||
|
||||
That query creates a retention policy (RP) called `a_year` that exists in the database
|
||||
|
|
|
|||
|
|
@ -839,8 +839,7 @@ DROP CONTINUOUS QUERY <cq_name> ON <database_name>
|
|||
Drop the `idle_hands` CQ from the `telegraf` database:
|
||||
|
||||
```sql
|
||||
> DROP CONTINUOUS QUERY "idle_hands" ON "telegraf"`
|
||||
>
|
||||
DROP CONTINUOUS QUERY "idle_hands" ON "telegraf"
|
||||
```
|
||||
|
||||
### Altering continuous queries
|
||||
|
|
|
|||
|
|
@ -380,8 +380,7 @@ The following query returns no data because it specifies a single tag key (`loca
|
|||
the `SELECT` clause:
|
||||
|
||||
```sql
|
||||
> SELECT "location" FROM "h2o_feet"
|
||||
>
|
||||
SELECT "location" FROM "h2o_feet"
|
||||
```
|
||||
|
||||
To return any data associated with the `location` tag key, the query's `SELECT`
|
||||
|
|
@ -597,7 +596,7 @@ separating logic with parentheses.
|
|||
#### Select data that have specific timestamps
|
||||
|
||||
```sql
|
||||
> SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
||||
SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
||||
```
|
||||
|
||||
The query returns data from the `h2o_feet` measurement that have [timestamps](/enterprise_influxdb/v1/concepts/glossary/#timestamp)
|
||||
|
|
@ -1592,8 +1591,8 @@ the query's time range.
|
|||
Note that `fill(800)` has no effect on the query results.
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek' AND time >= '2015-09-18T22:00:00Z' AND time <= '2015-09-18T22:18:00Z' GROUP BY time(12m) fill(800)
|
||||
>
|
||||
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek' AND time >= '2015-09-18T22:00:00Z' AND time <= '2015-09-18T22:18:00Z' GROUP BY time(12m) fill(800)
|
||||
|
||||
```
|
||||
|
||||
##### Queries with `fill(previous)` when the previous result falls outside the query's time range
|
||||
|
|
@ -2639,7 +2638,7 @@ The whitespace between `-` or `+` and the [duration literal](/enterprise_influxd
|
|||
#### Specify a time range with relative time
|
||||
|
||||
```sql
|
||||
> SELECT "water_level" FROM "h2o_feet" WHERE time > now() - 1h
|
||||
SELECT "water_level" FROM "h2o_feet" WHERE time > now() - 1h
|
||||
```
|
||||
|
||||
The query returns data with timestamps that occur within the past hour.
|
||||
|
|
@ -2686,7 +2685,7 @@ a `GROUP BY time()` clause must provide an alternative upper bound in the
|
|||
Use the [CLI](/enterprise_influxdb/v1/tools/influx-cli/use-influx/) to write a point to the `NOAA_water_database` that occurs after `now()`:
|
||||
|
||||
```sql
|
||||
> INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
|
||||
INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
|
||||
```
|
||||
|
||||
Run a `GROUP BY time()` query that covers data with timestamps between
|
||||
|
|
@ -2722,8 +2721,8 @@ the lower bound to `now()` such that the query's time range is between
|
|||
`now()` and `now()`:
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location"='santa_monica' AND time >= now() GROUP BY time(12m) fill(none)
|
||||
>
|
||||
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location"='santa_monica' AND time >= now() GROUP BY time(12m) fill(none)
|
||||
|
||||
```
|
||||
|
||||
### Configuring the returned timestamps
|
||||
|
|
@ -2831,8 +2830,8 @@ includes an `m` and `water_level` is greater than three.
|
|||
#### Use a regular expression to specify a tag with no value in the WHERE clause
|
||||
|
||||
```sql
|
||||
> SELECT * FROM "h2o_feet" WHERE "location" !~ /./
|
||||
>
|
||||
SELECT * FROM "h2o_feet" WHERE "location" !~ /./
|
||||
|
||||
```
|
||||
|
||||
The query selects all data from the `h2o_feet` measurement where the `location`
|
||||
|
|
@ -2989,8 +2988,8 @@ The query returns the integer form of `water_level`'s float [field values](/ente
|
|||
#### Cast float field values to strings (this functionality is not supported)
|
||||
|
||||
```sql
|
||||
> SELECT "water_level"::string FROM "h2o_feet" LIMIT 4
|
||||
>
|
||||
SELECT "water_level"::string FROM "h2o_feet" LIMIT 4
|
||||
|
||||
```
|
||||
|
||||
The query returns no data as casting a float field value to a string is not
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ If you attempt to create a database that already exists, InfluxDB does nothing a
|
|||
##### Create a database
|
||||
|
||||
```
|
||||
> CREATE DATABASE "NOAA_water_database"
|
||||
>
|
||||
CREATE DATABASE "NOAA_water_database"
|
||||
|
||||
```
|
||||
|
||||
The query creates a database called `NOAA_water_database`.
|
||||
|
|
@ -97,8 +97,8 @@ The query creates a database called `NOAA_water_database`.
|
|||
##### Create a database with a specific retention policy
|
||||
|
||||
```
|
||||
> CREATE DATABASE "NOAA_water_database" WITH DURATION 3d REPLICATION 1 SHARD DURATION 1h NAME "liquid"
|
||||
>
|
||||
CREATE DATABASE "NOAA_water_database" WITH DURATION 3d REPLICATION 1 SHARD DURATION 1h NAME "liquid"
|
||||
|
||||
```
|
||||
|
||||
The query creates a database called `NOAA_water_database`.
|
||||
|
|
@ -114,8 +114,8 @@ DROP DATABASE <database_name>
|
|||
|
||||
Drop the database NOAA_water_database:
|
||||
```bash
|
||||
> DROP DATABASE "NOAA_water_database"
|
||||
>
|
||||
DROP DATABASE "NOAA_water_database"
|
||||
|
||||
```
|
||||
|
||||
A successful `DROP DATABASE` query returns an empty result.
|
||||
|
|
@ -135,19 +135,19 @@ DROP SERIES FROM <measurement_name[,measurement_name]> WHERE <tag_key>='<tag_val
|
|||
Drop all series from a single measurement:
|
||||
|
||||
```sql
|
||||
> DROP SERIES FROM "h2o_feet"
|
||||
DROP SERIES FROM "h2o_feet"
|
||||
```
|
||||
|
||||
Drop series with a specific tag pair from a single measurement:
|
||||
|
||||
```sql
|
||||
> DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
|
||||
DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
|
||||
```
|
||||
|
||||
Drop all points in the series that have a specific tag pair from all measurements in the database:
|
||||
|
||||
```sql
|
||||
> DROP SERIES WHERE "location" = 'santa_monica'
|
||||
DROP SERIES WHERE "location" = 'santa_monica'
|
||||
```
|
||||
|
||||
A successful `DROP SERIES` query returns an empty result.
|
||||
|
|
@ -168,25 +168,25 @@ DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval
|
|||
Delete all data associated with the measurement `h2o_feet`:
|
||||
|
||||
```sql
|
||||
> DELETE FROM "h2o_feet"
|
||||
DELETE FROM "h2o_feet"
|
||||
```
|
||||
|
||||
Delete all data associated with the measurement `h2o_quality` and where the tag `randtag` equals `3`:
|
||||
|
||||
```sql
|
||||
> DELETE FROM "h2o_quality" WHERE "randtag" = '3'
|
||||
DELETE FROM "h2o_quality" WHERE "randtag" = '3'
|
||||
```
|
||||
|
||||
Delete all data in the database that occur before January 01, 2020:
|
||||
|
||||
```sql
|
||||
> DELETE WHERE time < '2020-01-01'
|
||||
DELETE WHERE time < '2020-01-01'
|
||||
```
|
||||
|
||||
Delete all data associated with the measurement `h2o_feet` in retention policy `one_day`:
|
||||
|
||||
```sql
|
||||
> DELETE FROM "one_day"."h2o_feet"
|
||||
DELETE FROM "one_day"."h2o_feet"
|
||||
```
|
||||
|
||||
A successful `DELETE` query returns an empty result.
|
||||
|
|
@ -216,7 +216,7 @@ DROP MEASUREMENT <measurement_name>
|
|||
|
||||
Delete the measurement `h2o_feet`:
|
||||
```sql
|
||||
> DROP MEASUREMENT "h2o_feet"
|
||||
DROP MEASUREMENT "h2o_feet"
|
||||
```
|
||||
|
||||
> **Note:** `DROP MEASUREMENT` drops all data and series in the measurement.
|
||||
|
|
@ -238,9 +238,9 @@ DROP SHARD <shard_id_number>
|
|||
```
|
||||
|
||||
Delete the shard with the id `1`:
|
||||
```
|
||||
> DROP SHARD 1
|
||||
>
|
||||
```sql
|
||||
DROP SHARD 1
|
||||
|
||||
```
|
||||
|
||||
A successful `DROP SHARD` query returns an empty result.
|
||||
|
|
@ -345,9 +345,9 @@ This setting is optional.
|
|||
|
||||
##### Create a retention policy
|
||||
|
||||
```
|
||||
> CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 1d REPLICATION 1
|
||||
>
|
||||
```sql
|
||||
CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 1d REPLICATION 1
|
||||
|
||||
```
|
||||
The query creates a retention policy called `one_day_only` for the database
|
||||
`NOAA_water_database` with a one day duration and a replication factor of one.
|
||||
|
|
@ -355,8 +355,8 @@ The query creates a retention policy called `one_day_only` for the database
|
|||
##### Create a DEFAULT retention policy
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 23h60m REPLICATION 1 DEFAULT
|
||||
>
|
||||
CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 23h60m REPLICATION 1 DEFAULT
|
||||
|
||||
```
|
||||
|
||||
The query creates the same retention policy as the one in the example above, but
|
||||
|
|
@ -381,14 +381,14 @@ ALTER RETENTION POLICY <retention_policy_name> ON <database_name> [DURATION <dur
|
|||
|
||||
First, create the retention policy `what_is_time` with a `DURATION` of two days:
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
|
||||
>
|
||||
CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
|
||||
|
||||
```
|
||||
|
||||
Modify `what_is_time` to have a three week `DURATION`, a two hour shard group duration, and make it the `DEFAULT` retention policy for `NOAA_water_database`.
|
||||
```sql
|
||||
> ALTER RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 3w SHARD DURATION 2h DEFAULT
|
||||
>
|
||||
ALTER RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 3w SHARD DURATION 2h DEFAULT
|
||||
|
||||
```
|
||||
In the last example, `what_is_time` retains its original replication factor of 1.
|
||||
|
||||
|
|
@ -407,9 +407,9 @@ DROP RETENTION POLICY <retention_policy_name> ON <database_name>
|
|||
```
|
||||
|
||||
Delete the retention policy `what_is_time` in the `NOAA_water_database` database:
|
||||
```bash
|
||||
> DROP RETENTION POLICY "what_is_time" ON "NOAA_water_database"
|
||||
>
|
||||
```sql
|
||||
DROP RETENTION POLICY "what_is_time" ON "NOAA_water_database"
|
||||
|
||||
```
|
||||
|
||||
A successful `DROP RETENTION POLICY` query returns an empty result.
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ digits, or underscores and do not begin with a digit.
|
|||
|
||||
Throughout the query language exploration, we'll use the database name `NOAA_water_database`:
|
||||
|
||||
```
|
||||
> CREATE DATABASE NOAA_water_database
|
||||
> exit
|
||||
```sql
|
||||
CREATE DATABASE NOAA_water_database
|
||||
exit
|
||||
```
|
||||
|
||||
### Download and write the data to InfluxDB
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ Executes the specified SELECT statement and returns data on the query performanc
|
|||
For example, executing the following statement:
|
||||
|
||||
```sql
|
||||
> explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
```
|
||||
|
||||
May produce an output similar to the following:
|
||||
|
|
|
|||
|
|
@ -407,8 +407,8 @@ Use `insert into <retention policy> <line protocol>` to write data to a specific
|
|||
Write data to a single field in the measurement `treasures` with the tag `captain_id = pirate_king`.
|
||||
`influx` automatically writes the point to the database's `DEFAULT` retention policy.
|
||||
```
|
||||
> INSERT treasures,captain_id=pirate_king value=2
|
||||
>
|
||||
INSERT treasures,captain_id=pirate_king value=2
|
||||
|
||||
```
|
||||
|
||||
Write the same point to the already-existing retention policy `oneday`:
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ In Query 1, the field key `duration` is an InfluxQL Keyword.
|
|||
Double quote `duration` to avoid the error:
|
||||
|
||||
```sql
|
||||
> SELECT "duration" FROM runs
|
||||
SELECT "duration" FROM runs
|
||||
```
|
||||
|
||||
*Query 2:*
|
||||
|
|
@ -114,7 +114,7 @@ In Query 2, the retention policy name `limit` is an InfluxQL Keyword.
|
|||
Double quote `limit` to avoid the error:
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "limit" ON telegraf DURATION 1d REPLICATION 1
|
||||
CREATE RETENTION POLICY "limit" ON telegraf DURATION 1d REPLICATION 1
|
||||
```
|
||||
|
||||
While using double quotes is an acceptable workaround, we recommend that you avoid using InfluxQL keywords as identifiers for simplicity's sake.
|
||||
|
|
@ -141,7 +141,7 @@ The `CREATE USER` statement requires single quotation marks around the password
|
|||
string:
|
||||
|
||||
```sql
|
||||
> CREATE USER penelope WITH PASSWORD 'timeseries4dayz'
|
||||
CREATE USER penelope WITH PASSWORD 'timeseries4dayz'
|
||||
```
|
||||
|
||||
Note that you should not include the single quotes when authenticating requests.
|
||||
|
|
@ -257,7 +257,7 @@ Replace the timestamp with a UNIX timestamp to avoid the error and successfully
|
|||
write the point to InfluxDB:
|
||||
|
||||
```sql
|
||||
> INSERT pineapple,fresh=true value=1 1439938800000000000
|
||||
INSERT pineapple,fresh=true value=1 1439938800000000000
|
||||
```
|
||||
|
||||
### InfluxDB line protocol syntax
|
||||
|
|
@ -283,7 +283,7 @@ InfluxDB assumes that the `value=9` field is the timestamp and returns an error.
|
|||
Use a comma instead of a space between the measurement and tag to avoid the error:
|
||||
|
||||
```sql
|
||||
> INSERT hens,location=2 value=9
|
||||
INSERT hens,location=2 value=9
|
||||
```
|
||||
|
||||
*Write 2*
|
||||
|
|
@ -300,7 +300,7 @@ InfluxDB assumes that the `happy=3` field is the timestamp and returns an error.
|
|||
Use a comma instead of a space between the two fields to avoid the error:
|
||||
|
||||
```sql
|
||||
> INSERT cows,name=daisy milk_prod=3,happy=3
|
||||
INSERT cows,name=daisy milk_prod=3,happy=3
|
||||
```
|
||||
|
||||
**Resources:**
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ SELECT MEAN("dogs" - "cats") from "pet_daycare"
|
|||
Instead, use a subquery to get the same result:
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("difference") FROM (SELECT "dogs" - "cat" AS "difference" FROM "pet_daycare")
|
||||
SELECT MEAN("difference") FROM (SELECT "dogs" - "cat" AS "difference" FROM "pet_daycare")
|
||||
```
|
||||
|
||||
See the
|
||||
|
|
@ -753,10 +753,10 @@ In the following example, the first query covers data with timestamps between
|
|||
`2015-09-18T21:30:00Z` and `now()`.
|
||||
The second query covers data with timestamps between `2015-09-18T21:30:00Z` and 180 weeks from `now()`.
|
||||
```
|
||||
> SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' GROUP BY time(12m) fill(none)
|
||||
SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' GROUP BY time(12m) fill(none)
|
||||
|
||||
|
||||
> SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' AND time <= now() + 180w GROUP BY time(12m) fill(none)
|
||||
SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' AND time <= now() + 180w GROUP BY time(12m) fill(none)
|
||||
```
|
||||
|
||||
Note that the `WHERE` clause must provide an alternative **upper** bound to
|
||||
|
|
@ -765,8 +765,8 @@ the lower bound to `now()` such that the query's time range is between
|
|||
`now()` and `now()`:
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("boards") FROM "hillvalley" WHERE time >= now() GROUP BY time(12m) fill(none)
|
||||
>
|
||||
SELECT MEAN("boards") FROM "hillvalley" WHERE time >= now() GROUP BY time(12m) fill(none)
|
||||
|
||||
```
|
||||
|
||||
For for more on time syntax in queries, see [Data Exploration](/enterprise_influxdb/v1/query_language/explore-data/#time-syntax).
|
||||
|
|
@ -856,8 +856,8 @@ time count
|
|||
We [create](/enterprise_influxdb/v1/query_language/manage-database/#create-retention-policies-with-create-retention-policy) a new `DEFAULT` RP (`two_hour`) and perform the same query:
|
||||
|
||||
```sql
|
||||
> SELECT count(flounders) FROM fleeting
|
||||
>
|
||||
SELECT count(flounders) FROM fleeting
|
||||
|
||||
```
|
||||
|
||||
To query the old data, we must specify the old `DEFAULT` RP by fully qualifying `fleeting`:
|
||||
|
|
@ -879,8 +879,8 @@ with time intervals.
|
|||
Example:
|
||||
|
||||
```sql
|
||||
> SELECT * FROM "absolutismus" WHERE time = '2016-07-31T20:07:00Z' OR time = '2016-07-31T23:07:17Z'
|
||||
>
|
||||
SELECT * FROM "absolutismus" WHERE time = '2016-07-31T20:07:00Z' OR time = '2016-07-31T23:07:17Z'
|
||||
|
||||
```
|
||||
|
||||
{{% warn %}} [GitHub Issue #7530](https://github.com/influxdata/influxdb/issues/7530)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ To learn how field value type discrepancies can affect `SELECT *` queries, see
|
|||
#### Write the field value `-1.234456e+78` as a float to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=-1.234456e+78
|
||||
INSERT mymeas value=-1.234456e+78
|
||||
```
|
||||
|
||||
InfluxDB supports field values specified in scientific notation.
|
||||
|
|
@ -83,25 +83,25 @@ InfluxDB supports field values specified in scientific notation.
|
|||
#### Write a field value `1.0` as a float to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=1.0
|
||||
INSERT mymeas value=1.0
|
||||
```
|
||||
|
||||
#### Write the field value `1` as a float to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=1
|
||||
INSERT mymeas value=1
|
||||
```
|
||||
|
||||
#### Write the field value `1` as an integer to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=1i
|
||||
INSERT mymeas value=1i
|
||||
```
|
||||
|
||||
#### Write the field value `stringing along` as a string to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value="stringing along"
|
||||
INSERT mymeas value="stringing along"
|
||||
```
|
||||
|
||||
Always double quote string field values. More on quoting [below](#quoting).
|
||||
|
|
@ -109,14 +109,14 @@ Always double quote string field values. More on quoting [below](#quoting).
|
|||
#### Write the field value `true` as a Boolean to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=true
|
||||
INSERT mymeas value=true
|
||||
```
|
||||
|
||||
Do not quote Boolean field values.
|
||||
The following statement writes `true` as a string field value to InfluxDB:
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value="true"
|
||||
INSERT mymeas value="true"
|
||||
```
|
||||
|
||||
#### Attempt to write a string to a field that previously accepted floats
|
||||
|
|
@ -132,9 +132,9 @@ ERR: {"error":"field type conflict: input field \"value\" on measurement \"mymea
|
|||
If the timestamps on the float and string are not stored in the same shard:
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=3 1465934559000000000
|
||||
> INSERT mymeas value="stringing along" 1466625759000000000
|
||||
>
|
||||
INSERT mymeas value=3 1465934559000000000
|
||||
INSERT mymeas value="stringing along" 1466625759000000000
|
||||
|
||||
```
|
||||
|
||||
## Quoting, special characters, and additional naming guidelines
|
||||
|
|
@ -231,7 +231,7 @@ You do not need to escape other special characters.
|
|||
##### Write a point with special characters
|
||||
|
||||
```sql
|
||||
> INSERT "measurement\ with\ quo⚡️es\ and\ emoji",tag\ key\ with\ sp🚀ces=tag\,value\,with"commas" field_k\ey="string field value, only \" need be esc🍭ped"
|
||||
INSERT "measurement\ with\ quo⚡️es\ and\ emoji",tag\ key\ with\ sp🚀ces=tag\,value\,with"commas" field_k\ey="string field value, only \" need be esc🍭ped"
|
||||
```
|
||||
|
||||
The system writes a point where the measurement is `"measurement with quo⚡️es and emoji"`, the tag key is `tag key with sp🚀ces`, the
|
||||
|
|
|
|||
|
|
@ -245,9 +245,9 @@ But, writing an integer to a field that previously accepted floats succeeds if
|
|||
InfluxDB stores the integer in a new shard:
|
||||
|
||||
```sql
|
||||
> INSERT weather,location=us-midwest temperature=82 1465839830100400200
|
||||
> INSERT weather,location=us-midwest temperature=81i 1467154750000000000
|
||||
>
|
||||
INSERT weather,location=us-midwest temperature=82 1465839830100400200
|
||||
INSERT weather,location=us-midwest temperature=81i 1467154750000000000
|
||||
|
||||
```
|
||||
|
||||
See
|
||||
|
|
|
|||
|
|
@ -355,12 +355,12 @@ CREATE USER <username> WITH PASSWORD '<password>'
|
|||
|
||||
###### CLI example
|
||||
```js
|
||||
> CREATE USER todd WITH PASSWORD 'influxdb41yf3'
|
||||
> CREATE USER alice WITH PASSWORD 'wonder\'land'
|
||||
> CREATE USER "rachel_smith" WITH PASSWORD 'asdf1234!'
|
||||
> CREATE USER "monitoring-robot" WITH PASSWORD 'XXXXX'
|
||||
> CREATE USER "$savyadmin" WITH PASSWORD 'm3tr1cL0v3r'
|
||||
>
|
||||
CREATE USER todd WITH PASSWORD 'influxdb41yf3'
|
||||
CREATE USER alice WITH PASSWORD 'wonder\'land'
|
||||
CREATE USER "rachel_smith" WITH PASSWORD 'asdf1234!'
|
||||
CREATE USER "monitoring-robot" WITH PASSWORD 'XXXXX'
|
||||
CREATE USER "$savyadmin" WITH PASSWORD 'm3tr1cL0v3r'
|
||||
|
||||
```
|
||||
|
||||
> [!Important]
|
||||
|
|
@ -397,15 +397,15 @@ CLI examples:
|
|||
`GRANT` `READ` access to `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> GRANT READ ON "NOAA_water_database" TO "todd"
|
||||
>
|
||||
GRANT READ ON "NOAA_water_database" TO "todd"
|
||||
|
||||
```
|
||||
|
||||
`GRANT` `ALL` access to `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> GRANT ALL ON "NOAA_water_database" TO "todd"
|
||||
>
|
||||
GRANT ALL ON "NOAA_water_database" TO "todd"
|
||||
|
||||
```
|
||||
|
||||
##### `REVOKE` `READ`, `WRITE`, or `ALL` database privileges from an existing user
|
||||
|
|
@ -419,15 +419,15 @@ CLI examples:
|
|||
`REVOKE` `ALL` privileges from `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> REVOKE ALL ON "NOAA_water_database" FROM "todd"
|
||||
>
|
||||
REVOKE ALL ON "NOAA_water_database" FROM "todd"
|
||||
|
||||
```
|
||||
|
||||
`REVOKE` `WRITE` privileges from `todd` on the `NOAA_water_database` database:
|
||||
|
||||
```sql
|
||||
> REVOKE WRITE ON "NOAA_water_database" FROM "todd"
|
||||
>
|
||||
REVOKE WRITE ON "NOAA_water_database" FROM "todd"
|
||||
|
||||
```
|
||||
|
||||
>**Note:** If a user with `ALL` privileges has `WRITE` privileges revoked, they are left with `READ` privileges, and vice versa.
|
||||
|
|
@ -460,8 +460,8 @@ SET PASSWORD FOR <username> = '<password>'
|
|||
CLI example:
|
||||
|
||||
```sql
|
||||
> SET PASSWORD FOR "todd" = 'influxdb4ever'
|
||||
>
|
||||
SET PASSWORD FOR "todd" = 'influxdb4ever'
|
||||
|
||||
```
|
||||
|
||||
> [!Note]
|
||||
|
|
@ -480,8 +480,8 @@ DROP USER <username>
|
|||
CLI example:
|
||||
|
||||
```sql
|
||||
> DROP USER "todd"
|
||||
>
|
||||
DROP USER "todd"
|
||||
|
||||
```
|
||||
|
||||
## Authentication and authorization HTTP errors
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ For example, simple addition:
|
|||
Assign an expression to a variable using the assignment operator, `=`.
|
||||
|
||||
```js
|
||||
> s = "this is a string"
|
||||
> i = 1 // an integer
|
||||
> f = 2.0 // a floating point number
|
||||
s = "this is a string"
|
||||
i = 1 // an integer
|
||||
f = 2.0 // a floating point number
|
||||
```
|
||||
|
||||
Type the name of a variable to print its value:
|
||||
|
|
@ -74,7 +74,7 @@ this is a string
|
|||
Flux also supports records. Each value in a record can be a different data type.
|
||||
|
||||
```js
|
||||
> o = {name:"Jim", age: 42, "favorite color": "red"}
|
||||
o = {name:"Jim", age: 42, "favorite color": "red"}
|
||||
```
|
||||
|
||||
Use **dot notation** to access a properties of a record:
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ the CQ has no `FOR` clause.
|
|||
#### 1. Create the database
|
||||
|
||||
```sql
|
||||
> CREATE DATABASE "food_data"
|
||||
CREATE DATABASE "food_data"
|
||||
```
|
||||
|
||||
#### 2. Create a two-hour `DEFAULT` retention policy
|
||||
|
|
@ -87,7 +87,7 @@ Use the
|
|||
statement to create a `DEFAULT` RP:
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "two_hours" ON "food_data" DURATION 2h REPLICATION 1 DEFAULT
|
||||
CREATE RETENTION POLICY "two_hours" ON "food_data" DURATION 2h REPLICATION 1 DEFAULT
|
||||
```
|
||||
|
||||
That query creates an RP called `two_hours` that exists in the database
|
||||
|
|
@ -118,7 +118,7 @@ Use the
|
|||
statement to create a non-`DEFAULT` retention policy:
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "a_year" ON "food_data" DURATION 52w REPLICATION 1
|
||||
CREATE RETENTION POLICY "a_year" ON "food_data" DURATION 52w REPLICATION 1
|
||||
```
|
||||
|
||||
That query creates a retention policy (RP) called `a_year` that exists in the database
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ digits, or underscores and do not begin with a digit.
|
|||
Throughout this guide, we'll use the database name `mydb`:
|
||||
|
||||
```sql
|
||||
> CREATE DATABASE mydb
|
||||
>
|
||||
CREATE DATABASE mydb
|
||||
|
||||
```
|
||||
|
||||
> **Note:** After hitting enter, a new prompt appears and nothing else is displayed.
|
||||
|
|
@ -141,8 +141,8 @@ temperature,machine=unit42,type=assembly external=25,internal=37 143406746700000
|
|||
To insert a single time series data point into InfluxDB using the CLI, enter `INSERT` followed by a point:
|
||||
|
||||
```sql
|
||||
> INSERT cpu,host=serverA,region=us_west value=0.64
|
||||
>
|
||||
INSERT cpu,host=serverA,region=us_west value=0.64
|
||||
|
||||
```
|
||||
|
||||
A point with the measurement name of `cpu` and tags `host` and `region` has now been written to the database, with the measured `value` of `0.64`.
|
||||
|
|
@ -166,8 +166,8 @@ That means your timestamp will be different.
|
|||
Let's try storing another type of data, with two fields in the same measurement:
|
||||
|
||||
```sql
|
||||
> INSERT temperature,machine=unit42,type=assembly external=25,internal=37
|
||||
>
|
||||
INSERT temperature,machine=unit42,type=assembly external=25,internal=37
|
||||
|
||||
```
|
||||
|
||||
To return all fields and tags with a query, you can use the `*` operator:
|
||||
|
|
|
|||
|
|
@ -841,8 +841,8 @@ DROP CONTINUOUS QUERY <cq_name> ON <database_name>
|
|||
Drop the `idle_hands` CQ from the `telegraf` database:
|
||||
|
||||
```sql
|
||||
> DROP CONTINUOUS QUERY "idle_hands" ON "telegraf"`
|
||||
>
|
||||
DROP CONTINUOUS QUERY "idle_hands" ON "telegraf"
|
||||
|
||||
```
|
||||
|
||||
### Altering continuous queries
|
||||
|
|
|
|||
|
|
@ -382,8 +382,8 @@ The following query returns no data because it specifies a single tag key (`loca
|
|||
the `SELECT` clause:
|
||||
|
||||
```sql
|
||||
> SELECT "location" FROM "h2o_feet"
|
||||
>
|
||||
SELECT "location" FROM "h2o_feet"
|
||||
|
||||
```
|
||||
|
||||
To return any data associated with the `location` tag key, the query's `SELECT`
|
||||
|
|
@ -599,7 +599,7 @@ separating logic with parentheses.
|
|||
#### Select data that have specific timestamps
|
||||
|
||||
```sql
|
||||
> SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
||||
SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
||||
```
|
||||
|
||||
The query returns data from the `h2o_feet` measurement that have [timestamps](/influxdb/v1/concepts/glossary/#timestamp)
|
||||
|
|
@ -1594,8 +1594,8 @@ the query's time range.
|
|||
Note that `fill(800)` has no effect on the query results.
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek' AND time >= '2015-09-18T22:00:00Z' AND time <= '2015-09-18T22:18:00Z' GROUP BY time(12m) fill(800)
|
||||
>
|
||||
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek' AND time >= '2015-09-18T22:00:00Z' AND time <= '2015-09-18T22:18:00Z' GROUP BY time(12m) fill(800)
|
||||
|
||||
```
|
||||
|
||||
##### Queries with `fill(previous)` when the previous result falls outside the query's time range
|
||||
|
|
@ -2646,7 +2646,7 @@ The whitespace between `-` or `+` and the [duration literal](/influxdb/v1/query_
|
|||
#### Specify a time range with relative time
|
||||
|
||||
```sql
|
||||
> SELECT "water_level" FROM "h2o_feet" WHERE time > now() - 1h
|
||||
SELECT "water_level" FROM "h2o_feet" WHERE time > now() - 1h
|
||||
```
|
||||
|
||||
The query returns data with timestamps that occur within the past hour.
|
||||
|
|
@ -2693,7 +2693,7 @@ a `GROUP BY time()` clause must provide an alternative upper bound in the
|
|||
Use the [CLI](/influxdb/v1/tools/shell/) to write a point to the `NOAA_water_database` that occurs after `now()`:
|
||||
|
||||
```sql
|
||||
> INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
|
||||
INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
|
||||
```
|
||||
|
||||
Run a `GROUP BY time()` query that covers data with timestamps between
|
||||
|
|
@ -2729,8 +2729,8 @@ the lower bound to `now()` such that the query's time range is between
|
|||
`now()` and `now()`:
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location"='santa_monica' AND time >= now() GROUP BY time(12m) fill(none)
|
||||
>
|
||||
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location"='santa_monica' AND time >= now() GROUP BY time(12m) fill(none)
|
||||
|
||||
```
|
||||
|
||||
### Configuring the returned timestamps
|
||||
|
|
@ -2838,8 +2838,8 @@ includes an `m` and `water_level` is greater than three.
|
|||
#### Use a regular expression to specify a tag with no value in the WHERE clause
|
||||
|
||||
```sql
|
||||
> SELECT * FROM "h2o_feet" WHERE "location" !~ /./
|
||||
>
|
||||
SELECT * FROM "h2o_feet" WHERE "location" !~ /./
|
||||
|
||||
```
|
||||
|
||||
The query selects all data from the `h2o_feet` measurement where the `location`
|
||||
|
|
@ -2996,8 +2996,8 @@ The query returns the integer form of `water_level`'s float [field values](/infl
|
|||
#### Cast float field values to strings (this functionality is not supported)
|
||||
|
||||
```sql
|
||||
> SELECT "water_level"::string FROM "h2o_feet" LIMIT 4
|
||||
>
|
||||
SELECT "water_level"::string FROM "h2o_feet" LIMIT 4
|
||||
|
||||
```
|
||||
|
||||
The query returns no data as casting a float field value to a string is not
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ If you attempt to create a database that already exists, InfluxDB does nothing a
|
|||
##### Create a database
|
||||
|
||||
```
|
||||
> CREATE DATABASE "NOAA_water_database"
|
||||
>
|
||||
CREATE DATABASE "NOAA_water_database"
|
||||
|
||||
```
|
||||
|
||||
The query creates a database called `NOAA_water_database`.
|
||||
|
|
@ -97,8 +97,8 @@ The query creates a database called `NOAA_water_database`.
|
|||
##### Create a database with a specific retention policy
|
||||
|
||||
```
|
||||
> CREATE DATABASE "NOAA_water_database" WITH DURATION 3d REPLICATION 1 SHARD DURATION 1h NAME "liquid"
|
||||
>
|
||||
CREATE DATABASE "NOAA_water_database" WITH DURATION 3d REPLICATION 1 SHARD DURATION 1h NAME "liquid"
|
||||
|
||||
```
|
||||
|
||||
The query creates a database called `NOAA_water_database`.
|
||||
|
|
@ -114,8 +114,8 @@ DROP DATABASE <database_name>
|
|||
|
||||
Drop the database NOAA_water_database:
|
||||
```bash
|
||||
> DROP DATABASE "NOAA_water_database"
|
||||
>
|
||||
DROP DATABASE "NOAA_water_database"
|
||||
|
||||
```
|
||||
|
||||
A successful `DROP DATABASE` query returns an empty result.
|
||||
|
|
@ -135,19 +135,19 @@ DROP SERIES FROM <measurement_name[,measurement_name]> WHERE <tag_key>='<tag_val
|
|||
Drop all series from a single measurement:
|
||||
|
||||
```sql
|
||||
> DROP SERIES FROM "h2o_feet"
|
||||
DROP SERIES FROM "h2o_feet"
|
||||
```
|
||||
|
||||
Drop series with a specific tag pair from a single measurement:
|
||||
|
||||
```sql
|
||||
> DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
|
||||
DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
|
||||
```
|
||||
|
||||
Drop all points in the series that have a specific tag pair from all measurements in the database:
|
||||
|
||||
```sql
|
||||
> DROP SERIES WHERE "location" = 'santa_monica'
|
||||
DROP SERIES WHERE "location" = 'santa_monica'
|
||||
```
|
||||
|
||||
A successful `DROP SERIES` query returns an empty result.
|
||||
|
|
@ -168,25 +168,25 @@ DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval
|
|||
Delete all data associated with the measurement `h2o_feet`:
|
||||
|
||||
```sql
|
||||
> DELETE FROM "h2o_feet"
|
||||
DELETE FROM "h2o_feet"
|
||||
```
|
||||
|
||||
Delete all data associated with the measurement `h2o_quality` and where the tag `randtag` equals `3`:
|
||||
|
||||
```sql
|
||||
> DELETE FROM "h2o_quality" WHERE "randtag" = '3'
|
||||
DELETE FROM "h2o_quality" WHERE "randtag" = '3'
|
||||
```
|
||||
|
||||
Delete all data in the database that occur before January 01, 2020:
|
||||
|
||||
```sql
|
||||
> DELETE WHERE time < '2020-01-01'
|
||||
DELETE WHERE time < '2020-01-01'
|
||||
```
|
||||
|
||||
Delete all data associated with the measurement `h2o_feet` in retention policy `one_day`:
|
||||
|
||||
```sql
|
||||
> DELETE FROM "one_day"."h2o_feet"
|
||||
DELETE FROM "one_day"."h2o_feet"
|
||||
```
|
||||
|
||||
A successful `DELETE` query returns an empty result.
|
||||
|
|
@ -217,7 +217,7 @@ DROP MEASUREMENT <measurement_name>
|
|||
|
||||
Delete the measurement `h2o_feet`:
|
||||
```sql
|
||||
> DROP MEASUREMENT "h2o_feet"
|
||||
DROP MEASUREMENT "h2o_feet"
|
||||
```
|
||||
|
||||
> **Note:** `DROP MEASUREMENT` drops all data and series in the measurement.
|
||||
|
|
@ -240,8 +240,8 @@ DROP SHARD <shard_id_number>
|
|||
|
||||
Delete the shard with the id `1`:
|
||||
```
|
||||
> DROP SHARD 1
|
||||
>
|
||||
DROP SHARD 1
|
||||
|
||||
```
|
||||
|
||||
A successful `DROP SHARD` query returns an empty result.
|
||||
|
|
@ -339,8 +339,8 @@ This setting is optional.
|
|||
##### Create a retention policy
|
||||
|
||||
```
|
||||
> CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 1d REPLICATION 1
|
||||
>
|
||||
CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 1d REPLICATION 1
|
||||
|
||||
```
|
||||
The query creates a retention policy called `one_day_only` for the database
|
||||
`NOAA_water_database` with a one day duration and a replication factor of one.
|
||||
|
|
@ -348,8 +348,8 @@ The query creates a retention policy called `one_day_only` for the database
|
|||
##### Create a DEFAULT retention policy
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 23h60m REPLICATION 1 DEFAULT
|
||||
>
|
||||
CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 23h60m REPLICATION 1 DEFAULT
|
||||
|
||||
```
|
||||
|
||||
The query creates the same retention policy as the one in the example above, but
|
||||
|
|
@ -377,14 +377,14 @@ For information about the `FUTURE LIMIT` and `PAST LIMIT` clauses, see
|
|||
|
||||
First, create the retention policy `what_is_time` with a `DURATION` of two days:
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
|
||||
>
|
||||
CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
|
||||
|
||||
```
|
||||
|
||||
Modify `what_is_time` to have a three week `DURATION`, a two hour shard group duration, and make it the `DEFAULT` retention policy for `NOAA_water_database`.
|
||||
```sql
|
||||
> ALTER RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 3w SHARD DURATION 2h DEFAULT
|
||||
>
|
||||
ALTER RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 3w SHARD DURATION 2h DEFAULT
|
||||
|
||||
```
|
||||
In the last example, `what_is_time` retains its original replication factor of 1.
|
||||
|
||||
|
|
@ -404,8 +404,8 @@ DROP RETENTION POLICY <retention_policy_name> ON <database_name>
|
|||
|
||||
Delete the retention policy `what_is_time` in the `NOAA_water_database` database:
|
||||
```bash
|
||||
> DROP RETENTION POLICY "what_is_time" ON "NOAA_water_database"
|
||||
>
|
||||
DROP RETENTION POLICY "what_is_time" ON "NOAA_water_database"
|
||||
|
||||
```
|
||||
|
||||
A successful `DROP RETENTION POLICY` query returns an empty result.
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ digits, or underscores and do not begin with a digit.
|
|||
Throughout the query language exploration, we'll use the database name `NOAA_water_database`:
|
||||
|
||||
```
|
||||
> CREATE DATABASE NOAA_water_database
|
||||
> exit
|
||||
CREATE DATABASE NOAA_water_database
|
||||
exit
|
||||
```
|
||||
|
||||
### Download and write the data to InfluxDB
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ Executes the specified SELECT statement and returns data on the query performanc
|
|||
For example, executing the following statement:
|
||||
|
||||
```sql
|
||||
> explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
```
|
||||
|
||||
May produce an output similar to the following:
|
||||
|
|
|
|||
|
|
@ -427,8 +427,8 @@ Use `insert into <retention policy> <line protocol>` to write data to a specific
|
|||
Write data to a single field in the measurement `treasures` with the tag `captain_id = pirate_king`.
|
||||
`influx` automatically writes the point to the database's `DEFAULT` retention policy.
|
||||
```
|
||||
> INSERT treasures,captain_id=pirate_king value=2
|
||||
>
|
||||
INSERT treasures,captain_id=pirate_king value=2
|
||||
|
||||
```
|
||||
|
||||
Write the same point to the already-existing retention policy `oneday`:
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ In Query 1, the field key `duration` is an InfluxQL Keyword.
|
|||
Double quote `duration` to avoid the error:
|
||||
|
||||
```sql
|
||||
> SELECT "duration" FROM runs
|
||||
SELECT "duration" FROM runs
|
||||
```
|
||||
|
||||
*Query 2:*
|
||||
|
|
@ -115,7 +115,7 @@ In Query 2, the retention policy name `limit` is an InfluxQL Keyword.
|
|||
Double quote `limit` to avoid the error:
|
||||
|
||||
```sql
|
||||
> CREATE RETENTION POLICY "limit" ON telegraf DURATION 1d REPLICATION 1
|
||||
CREATE RETENTION POLICY "limit" ON telegraf DURATION 1d REPLICATION 1
|
||||
```
|
||||
|
||||
While using double quotes is an acceptable workaround, we recommend that you avoid using InfluxQL keywords as identifiers for simplicity's sake.
|
||||
|
|
@ -142,7 +142,7 @@ The `CREATE USER` statement requires single quotation marks around the password
|
|||
string:
|
||||
|
||||
```sql
|
||||
> CREATE USER penelope WITH PASSWORD 'timeseries4dayz'
|
||||
CREATE USER penelope WITH PASSWORD 'timeseries4dayz'
|
||||
```
|
||||
|
||||
Note that you should not include the single quotes when authenticating requests.
|
||||
|
|
@ -258,7 +258,7 @@ Replace the timestamp with a UNIX timestamp to avoid the error and successfully
|
|||
write the point to InfluxDB:
|
||||
|
||||
```sql
|
||||
> INSERT pineapple,fresh=true value=1 1439938800000000000
|
||||
INSERT pineapple,fresh=true value=1 1439938800000000000
|
||||
```
|
||||
|
||||
### InfluxDB line protocol syntax
|
||||
|
|
@ -284,7 +284,7 @@ InfluxDB assumes that the `value=9` field is the timestamp and returns an error.
|
|||
Use a comma instead of a space between the measurement and tag to avoid the error:
|
||||
|
||||
```sql
|
||||
> INSERT hens,location=2 value=9
|
||||
INSERT hens,location=2 value=9
|
||||
```
|
||||
|
||||
*Write 2*
|
||||
|
|
@ -301,7 +301,7 @@ InfluxDB assumes that the `happy=3` field is the timestamp and returns an error.
|
|||
Use a comma instead of a space between the two fields to avoid the error:
|
||||
|
||||
```sql
|
||||
> INSERT cows,name=daisy milk_prod=3,happy=3
|
||||
INSERT cows,name=daisy milk_prod=3,happy=3
|
||||
```
|
||||
|
||||
**Resources:**
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ SELECT MEAN("dogs" - "cats") from "pet_daycare"
|
|||
Instead, use a subquery to get the same result:
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("difference") FROM (SELECT "dogs" - "cat" AS "difference" FROM "pet_daycare")
|
||||
SELECT MEAN("difference") FROM (SELECT "dogs" - "cat" AS "difference" FROM "pet_daycare")
|
||||
```
|
||||
|
||||
See the
|
||||
|
|
@ -740,9 +740,9 @@ In the following example, the first query covers data with timestamps between
|
|||
The second query covers data with timestamps between `2015-09-18T21:30:00Z` and 180 weeks from `now()`.
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' GROUP BY time(12m) fill(none)
|
||||
SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' GROUP BY time(12m) fill(none)
|
||||
|
||||
> SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' AND time <= now() + 180w GROUP BY time(12m) fill(none)
|
||||
SELECT MEAN("boards") FROM "hillvalley" WHERE time >= '2015-09-18T21:30:00Z' AND time <= now() + 180w GROUP BY time(12m) fill(none)
|
||||
```
|
||||
|
||||
Note that the `WHERE` clause must provide an alternative **upper** bound to
|
||||
|
|
@ -751,8 +751,8 @@ the lower bound to `now()` such that the query's time range is between
|
|||
`now()` and `now()`:
|
||||
|
||||
```sql
|
||||
> SELECT MEAN("boards") FROM "hillvalley" WHERE time >= now() GROUP BY time(12m) fill(none)
|
||||
>
|
||||
SELECT MEAN("boards") FROM "hillvalley" WHERE time >= now() GROUP BY time(12m) fill(none)
|
||||
|
||||
```
|
||||
|
||||
For for more on time syntax in queries, see [Data Exploration](/influxdb/v1/query_language/explore-data/#time-syntax).
|
||||
|
|
@ -843,8 +843,8 @@ time count
|
|||
We [create](/influxdb/v1/query_language/manage-database/#create-retention-policies-with-create-retention-policy) a new `DEFAULT` RP (`two_hour`) and perform the same query:
|
||||
|
||||
```sql
|
||||
> SELECT count(flounders) FROM fleeting
|
||||
>
|
||||
SELECT count(flounders) FROM fleeting
|
||||
|
||||
```
|
||||
|
||||
To query the old data, we must specify the old `DEFAULT` RP by fully qualifying `fleeting`:
|
||||
|
|
@ -866,8 +866,8 @@ with time intervals.
|
|||
Example:
|
||||
|
||||
```sql
|
||||
> SELECT * FROM "absolutismus" WHERE time = '2016-07-31T20:07:00Z' OR time = '2016-07-31T23:07:17Z'
|
||||
>
|
||||
SELECT * FROM "absolutismus" WHERE time = '2016-07-31T20:07:00Z' OR time = '2016-07-31T23:07:17Z'
|
||||
|
||||
```
|
||||
|
||||
{{% warn %}} [GitHub Issue #7530](https://github.com/influxdata/influxdb/issues/7530)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ To learn how field value type discrepancies can affect `SELECT *` queries, see
|
|||
#### Write the field value `-1.234456e+78` as a float to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=-1.234456e+78
|
||||
INSERT mymeas value=-1.234456e+78
|
||||
```
|
||||
|
||||
InfluxDB supports field values specified in scientific notation.
|
||||
|
|
@ -81,25 +81,25 @@ InfluxDB supports field values specified in scientific notation.
|
|||
#### Write a field value `1.0` as a float to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=1.0
|
||||
INSERT mymeas value=1.0
|
||||
```
|
||||
|
||||
#### Write the field value `1` as a float to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=1
|
||||
INSERT mymeas value=1
|
||||
```
|
||||
|
||||
#### Write the field value `1` as an integer to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=1i
|
||||
INSERT mymeas value=1i
|
||||
```
|
||||
|
||||
#### Write the field value `stringing along` as a string to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value="stringing along"
|
||||
INSERT mymeas value="stringing along"
|
||||
```
|
||||
|
||||
Always double quote string field values. More on quoting [below](#quoting).
|
||||
|
|
@ -107,14 +107,14 @@ Always double quote string field values. More on quoting [below](#quoting).
|
|||
#### Write the field value `true` as a Boolean to InfluxDB
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=true
|
||||
INSERT mymeas value=true
|
||||
```
|
||||
|
||||
Do not quote Boolean field values.
|
||||
The following statement writes `true` as a string field value to InfluxDB:
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value="true"
|
||||
INSERT mymeas value="true"
|
||||
```
|
||||
|
||||
#### Attempt to write a string to a field that previously accepted floats
|
||||
|
|
@ -130,9 +130,9 @@ ERR: {"error":"field type conflict: input field \"value\" on measurement \"mymea
|
|||
If the timestamps on the float and string are not stored in the same shard:
|
||||
|
||||
```sql
|
||||
> INSERT mymeas value=3 1465934559000000000
|
||||
> INSERT mymeas value="stringing along" 1466625759000000000
|
||||
>
|
||||
INSERT mymeas value=3 1465934559000000000
|
||||
INSERT mymeas value="stringing along" 1466625759000000000
|
||||
|
||||
```
|
||||
|
||||
## Quoting, special characters, and additional naming guidelines
|
||||
|
|
@ -233,7 +233,7 @@ You do not need to escape other special characters.
|
|||
##### Write a point with special characters
|
||||
|
||||
```sql
|
||||
> INSERT "measurement\ with\ quo⚡️es\ and\ emoji",tag\ key\ with\ sp🚀ces=tag\,value\,with"commas" field_k\ey="string field value, only \" need be esc🍭ped"
|
||||
INSERT "measurement\ with\ quo⚡️es\ and\ emoji",tag\ key\ with\ sp🚀ces=tag\,value\,with"commas" field_k\ey="string field value, only \" need be esc🍭ped"
|
||||
```
|
||||
|
||||
The system writes a point where the measurement is `"measurement with quo⚡️es and emoji"`, the tag key is `tag key with sp🚀ces`, the
|
||||
|
|
|
|||
|
|
@ -278,9 +278,9 @@ But, writing an integer to a field that previously accepted floats succeeds if
|
|||
InfluxDB stores the integer in a new shard:
|
||||
|
||||
```sql
|
||||
> INSERT weather,location=us-midwest temperature=82 1465839830100400200
|
||||
> INSERT weather,location=us-midwest temperature=81i 1467154750000000000
|
||||
>
|
||||
INSERT weather,location=us-midwest temperature=82 1465839830100400200
|
||||
INSERT weather,location=us-midwest temperature=81i 1467154750000000000
|
||||
|
||||
```
|
||||
|
||||
See
|
||||
|
|
|
|||
|
|
@ -151,8 +151,8 @@ If using an admin user for visualization or Chronograf administrative functions,
|
|||
|
||||
<!--pytest.mark.skip-->
|
||||
```bash
|
||||
> CREATE USER <username> WITH PASSWORD '<password>'
|
||||
> GRANT READ ON <database> TO "<username>"
|
||||
CREATE USER <username> WITH PASSWORD '<password>'
|
||||
GRANT READ ON <database> TO "<username>"
|
||||
```
|
||||
|
||||
InfluxDB {{< current-version >}} only grants admin privileges to the primary user
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ aliases:
|
|||
- /influxdb3/cloud-dedicated/admin/clusters/list/
|
||||
---
|
||||
|
||||
Use the Admin UI or the [`influxctl cluster list` CLI command](/influxdb3/cloud-dedicated/reference/cli/influxctl/list/)
|
||||
Use the Admin UI or the [`influxctl cluster list` CLI command](/influxdb3/cloud-dedicated/reference/cli/influxctl/cluster/list/)
|
||||
to view information about all {{< product-name omit=" Clustered" >}} clusters associated with your account ID.
|
||||
|
||||
{{< tabs-wrapper >}}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Use visualization tools to query data stored in {{% product-name %}} with SQL.
|
|||
The following visualization tools support querying InfluxDB with SQL:
|
||||
|
||||
- [Grafana](/influxdb3/cloud-dedicated/process-data/visualize/grafana/)
|
||||
- [Power BI](/influxdb3/cloud-dedicated/process-data/visualize/powerbi/)
|
||||
- [Power BI](/influxdb3/cloud-dedicated/visualize-data/powerbi/)
|
||||
- [Superset](/influxdb3/cloud-dedicated/process-data/visualize/superset/)
|
||||
- [Tableau](/influxdb3/cloud-dedicated/process-data/visualize/tableau/)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Use visualization tools to query data stored in {{% product-name %}}.
|
|||
The following visualization tools support querying InfluxDB with SQL:
|
||||
|
||||
- [Grafana](/influxdb3/cloud-serverless/process-data/visualize/grafana/)
|
||||
- [Power BI](/influxdb3/cloud-serverless/process-data/visualize/powerbi/)
|
||||
- [Power BI](/influxdb3/cloud-serverless/visualize-data/powerbi/)
|
||||
- [Superset](/influxdb3/cloud-serverless/process-data/visualize/superset/)
|
||||
- [Tableau](/influxdb3/cloud-serverless/process-data/visualize/tableau/)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Use visualization tools to query data stored in {{% product-name %}} with SQL.
|
|||
The following visualization tools support querying InfluxDB with SQL:
|
||||
|
||||
- [Grafana](/influxdb3/clustered/process-data/visualize/grafana/)
|
||||
- [Power BI](/influxdb3/clustered/process-data/visualize/powerbi/)
|
||||
- [Power BI](/influxdb3/clustered/visualize-data/powerbi/)
|
||||
- [Superset](/influxdb3/clustered/process-data/visualize/superset/)
|
||||
- [Tableau](/influxdb3/clustered/process-data/visualize/tableau/)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ menu:
|
|||
parent: influxdb3
|
||||
name: influxdb3 serve
|
||||
weight: 300
|
||||
aliases:
|
||||
- /influxdb3/core/reference/clis/influxdb3/serve/
|
||||
related:
|
||||
- /influxdb3/core/reference/config-options/
|
||||
---
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ menu:
|
|||
parent: influxdb3
|
||||
name: influxdb3 serve
|
||||
weight: 300
|
||||
aliases:
|
||||
- /influxdb3/enterprise/reference/clis/influxdb3/serve/
|
||||
related:
|
||||
- /influxdb3/enterprise/reference/config-options/
|
||||
---
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ a `GROUP BY time()` clause must provide an alternative upper bound in the
|
|||
Use the [CLI](/enterprise_influxdb/v1/tools/influx-cli/use-influx/) to write a point to the `noaa` database that occurs after `now()`:
|
||||
|
||||
```sql
|
||||
> INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
|
||||
INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
|
||||
```
|
||||
|
||||
Run a `GROUP BY time()` query that covers data with timestamps between
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ INSERT INTO mydb example-m,tag1=value1 field1=1i 1640995200000000000
|
|||
The following example uses the [InfluxQL shell](/influxdb/version/tools/influxql-shell).
|
||||
|
||||
```sql
|
||||
> USE mydb
|
||||
> INSERT example-m,tag1=value1 field1=1i 1640995200000000000
|
||||
USE mydb
|
||||
INSERT example-m,tag1=value1 field1=1i 1640995200000000000
|
||||
```
|
||||
|
||||
## Delete series with DELETE
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ Executes the specified SELECT statement and returns data on the query performanc
|
|||
For example, executing the following statement:
|
||||
|
||||
```sql
|
||||
> explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
```
|
||||
|
||||
May produce an output similar to the following:
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ Executes the specified `SELECT` statement and returns data about the query perfo
|
|||
For example, if you execute the following statement:
|
||||
|
||||
```sql
|
||||
> explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
|
||||
```
|
||||
|
||||
The output is similar to the following:
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ With MongoDB 3.4 and higher, the `clusterMonitor` role can be used. In
|
|||
version 3.2 you may also need these additional permissions:
|
||||
|
||||
```shell
|
||||
> db.grantRolesToUser("user", [{role: "read", actions: "find", db: "local"}])
|
||||
db.grantRolesToUser("user", [{role: "read", actions: "find", db: "local"}])
|
||||
```
|
||||
|
||||
If the user is missing required privileges you may see an error in the
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
/**
|
||||
* InfluxDB URL localStorage E2E Test Suite
|
||||
*
|
||||
* Tests that the InfluxDB URL replacement logic in influxdb-url.js handles
|
||||
* localStorage correctly, including stale data from returning visitors.
|
||||
*
|
||||
* Regression tests for https://github.com/influxdata/docs-v2/issues/6960
|
||||
* where stale localStorage missing the `core` key caused JavaScript to
|
||||
* replace rendered hostnames with "undefined" in code blocks.
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = 'influxdata_docs_urls';
|
||||
const TEST_PAGE = '/influxdb3/core/plugins/';
|
||||
const EXPECTED_PRODUCT_KEYS = [
|
||||
'oss',
|
||||
'cloud',
|
||||
'core',
|
||||
'enterprise',
|
||||
'serverless',
|
||||
'dedicated',
|
||||
'clustered',
|
||||
];
|
||||
|
||||
describe('InfluxDB URL - localStorage', function () {
|
||||
it('should not render "undefined" in code blocks when localStorage is missing product keys', function () {
|
||||
// Simulate a returning visitor whose localStorage was created before
|
||||
// core/enterprise products were added — missing those keys entirely.
|
||||
const staleUrls = {
|
||||
oss: 'http://localhost:8086',
|
||||
cloud: 'https://us-west-2-1.aws.cloud2.influxdata.com',
|
||||
prev_oss: 'http://localhost:8086',
|
||||
prev_cloud: 'https://us-west-2-1.aws.cloud2.influxdata.com',
|
||||
custom: '',
|
||||
};
|
||||
|
||||
cy.visit(TEST_PAGE, {
|
||||
onBeforeLoad(win) {
|
||||
win.localStorage.setItem(STORAGE_KEY, JSON.stringify(staleUrls));
|
||||
},
|
||||
});
|
||||
|
||||
// The api-endpoint block should show the default Core host, not "undefined"
|
||||
cy.get('.article--content pre.api-endpoint')
|
||||
.first()
|
||||
.should('contain', 'localhost:8181')
|
||||
.and('not.contain', 'undefined');
|
||||
|
||||
// No code block in the article should contain "undefined" as a bare host
|
||||
cy.get('.article--content pre:not(.preserve)').each(($el) => {
|
||||
cy.wrap($el).invoke('text').should('not.match', /undefined\/api\//);
|
||||
});
|
||||
});
|
||||
|
||||
it('should backfill all expected product URL keys into localStorage', function () {
|
||||
cy.visit(TEST_PAGE, {
|
||||
onBeforeLoad(win) {
|
||||
// Start with no stored URLs — forces initialization
|
||||
win.localStorage.removeItem(STORAGE_KEY);
|
||||
},
|
||||
});
|
||||
|
||||
// After the page loads and JS initializes, localStorage should contain
|
||||
// all expected product keys with non-empty URL values.
|
||||
cy.window().then((win) => {
|
||||
const stored = JSON.parse(win.localStorage.getItem(STORAGE_KEY));
|
||||
expect(stored).to.be.an('object');
|
||||
|
||||
EXPECTED_PRODUCT_KEYS.forEach((key) => {
|
||||
expect(stored, `stored URLs should have key "${key}"`).to.have.property(
|
||||
key
|
||||
);
|
||||
expect(stored[key], `"${key}" should be a non-empty string`).to.be.a(
|
||||
'string'
|
||||
).and.not.be.empty;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue