Skip to content

Commit d0fad98

Browse files
authored
Merge branch 'master' into 6021-add-schedule-plugin-test-docs
2 parents 20366d1 + dc53392 commit d0fad98

File tree

15 files changed

+2520
-211
lines changed

15 files changed

+2520
-211
lines changed

.github/instructions/contributing.instructions.md

Lines changed: 1705 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
mode: 'edit'
3+
applyTo: "content/{influxdb3/core,influxdb3/enterprise,shared/influxdb3*}/**"
4+
---
5+
## Best Practices
6+
7+
- Use UPPERCASE for placeholders to make them easily identifiable
8+
- Don't use pronouns in placeholders (e.g., "your", "this")
9+
- List placeholders in the same order they appear in the code
10+
- Provide clear descriptions including:
11+
- - Expected data type or format
12+
- - Purpose of the value
13+
- - Any constraints or requirements
14+
- Mark optional placeholders as "Optional:" in their descriptions
15+
- Placeholder key descriptions should fit the context of the code snippet
16+
- Include examples for complex formats
17+
18+
## Writing Placeholder Descriptions
19+
20+
Descriptions should follow consistent patterns:
21+
22+
1. **Admin Authentication tokens**:
23+
- Recommended: "a {{% token-link "admin" %}} for your {{< product-name >}} instance"
24+
- Avoid: "your token", "the token", "an authorization token"
25+
2. **Database resource tokens**:
26+
- Recommended: "your {{% token-link "database" %}}"{{% show-in "enterprise" %}} with permissions on the specified database{{% /show-in %}}
27+
- Avoid: "your token", "the token", "an authorization token"
28+
3. **Database names**:
29+
- Recommended: "the name of the database to [action]"
30+
- Avoid: "your database", "the database name"
31+
4. **Conditional content**:
32+
- Use `{{% show-in "enterprise" %}}` for content specific to enterprise versions
33+
- Example: "your {{% token-link "database" %}}{{% show-in "enterprise" %}} with permission to query the specified database{{% /show-in %}}"
34+
35+
## Common placeholders for InfluxDB 3
36+
37+
- `AUTH_TOKEN`: your {{% token-link %}}
38+
- `DATABASE_NAME`: the database to use
39+
- `TABLE_NAME`: Name of the table/measurement to query or write to
40+
- `NODE_ID`: Node ID for a specific node in a cluster
41+
- `CLUSTER_ID`: Cluster ID for a specific cluster
42+
- `HOST`: InfluxDB server hostname or URL
43+
- `PORT`: InfluxDB server port (typically 8181)
44+
- `QUERY`: SQL or InfluxQL query string
45+
- `LINE_PROTOCOL`: Line protocol data for writes
46+
- `PLUGIN_FILENAME`: Name of plugin file to use
47+
- `CACHE_NAME`: Name for a new or existing cache
48+
49+
## Hugo shortcodes in Markdown
50+
51+
- `{{% code-placeholders "PLACEHOLDER1|PLACEHOLDER2" %}}`: Use this shortcode to define placeholders in code snippets.
52+
- `{{% /code-placeholders %}}`: End the shortcode.
53+
- `{{% code-placeholder-key %}}`: Use this shortcode to define a specific placeholder key.
54+
- `{{% /code-placeholder-key %}}`: End the specific placeholder key shortcode.
55+
56+
## Language-Specific Placeholder Formatting
57+
58+
- **Bash/Shell**: Use uppercase variables with no quotes or prefix
59+
```bash
60+
--database DATABASE_NAME
61+
```
62+
- Python: Use string literals with quotes
63+
```python
64+
database_name='DATABASE_NAME'
65+
```
66+
- JSON: Use key-value pairs with quotes
67+
```json
68+
{
69+
"database": "DATABASE_NAME"
70+
}
71+
```
72+
73+
## Real-World Examples from Documentation
74+
75+
### InfluxDB CLI Commands
76+
This pattern appears frequently in CLI documentation:
77+
78+
{{% code-placeholders "DATABASE_NAME|AUTH_TOKEN" %}}
79+
```bash
80+
influxdb3 write \
81+
--database DATABASE_NAME \
82+
--token AUTH_TOKEN \
83+
--precision ns
84+
{{% /code-placeholders %}}
85+
86+
Replace the following placeholders with your values:
87+
88+
{{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database to write to
89+
{{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: your {{% token-link "database" %}}{{% show-in "enterprise" %}} with write permissions on the specified database{{% /show-in %}}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to InfluxData Documentation
22

3-
## Sign the InfluxData CLA
3+
### Sign the InfluxData CLA
44

55
The InfluxData Contributor License Agreement (CLA) is part of the legal framework
66
for the open source ecosystem that protects both you and InfluxData.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Script to generate GitHub Copilot instructions
5+
* for InfluxData documentation.
6+
*/
7+
import fs from 'fs';
8+
import path from 'path';
9+
import process from 'process';
10+
import { execSync } from 'child_process';
11+
12+
// Get the current file path and directory
13+
export { buildContributingInstructions };
14+
15+
(async () => {
16+
try {
17+
await buildContributingInstructions();
18+
} catch (error) {
19+
console.error('Error generating Copilot instructions:', error);
20+
}
21+
})();
22+
23+
/** Build instructions from CONTRIBUTING.md
24+
* This script reads CONTRIBUTING.md, formats it appropriately,
25+
* and saves it to .github/instructions/contributing.instructions.md
26+
*/
27+
function buildContributingInstructions() {
28+
// Paths
29+
const contributingPath = path.join(process.cwd(), 'CONTRIBUTING.md');
30+
const instructionsDir = path.join(process.cwd(), '.github', 'instructions');
31+
const instructionsPath = path.join(
32+
instructionsDir,
33+
'contributing.instructions.md'
34+
);
35+
36+
// Ensure the instructions directory exists
37+
if (!fs.existsSync(instructionsDir)) {
38+
fs.mkdirSync(instructionsDir, { recursive: true });
39+
}
40+
41+
// Read the CONTRIBUTING.md file
42+
let content = fs.readFileSync(contributingPath, 'utf8');
43+
44+
// Format the content for Copilot instructions with applyTo attribute
45+
content = `---
46+
applyTo: "content/**/*.md, layouts/**/*.html"
47+
---
48+
49+
# GitHub Copilot Instructions for InfluxData Documentation
50+
51+
## Purpose and scope
52+
53+
GitHub Copilot should help document InfluxData products
54+
by creating clear, accurate technical content with proper
55+
code examples, frontmatter, shortcodes, and formatting.
56+
57+
${content}`;
58+
59+
// Write the formatted content to the instructions file
60+
fs.writeFileSync(instructionsPath, content);
61+
62+
console.log(`✅ Generated Copilot instructions at ${instructionsPath}`);
63+
64+
// Add the file to git if it has changed
65+
try {
66+
const gitStatus = execSync(
67+
`git status --porcelain "${instructionsPath}"`
68+
).toString();
69+
if (gitStatus.trim()) {
70+
execSync(`git add "${instructionsPath}"`);
71+
console.log('✅ Added instructions file to git staging');
72+
}
73+
} catch (error) {
74+
console.warn('⚠️ Could not add instructions file to git:', error.message);
75+
}
76+
}

compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ services:
449449
- type: bind
450450
source: ./content
451451
target: /app/content
452+
- type: bind
453+
source: ./CONTRIBUTING.md
454+
target: /app/CONTRIBUTING.md
452455
volumes:
453456
test-content:
454457
cloud-tmp:

content/influxdb3/core/write-data/best-practices/optimize-writes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/optimize-writes.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
2021
-->

content/influxdb3/core/write-data/best-practices/schema-design.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/schema-design.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/schema-design.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/schema-design.md
2021
-->

content/influxdb3/enterprise/write-data/best-practices/optimize-writes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/optimize-writes.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
2021
-->

content/influxdb3/enterprise/write-data/best-practices/schema-design.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/schema-design.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/schema-design.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/schema-design.md
2021
-->

content/shared/influxdb3-write-guides/best-practices/optimize-writes.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Use these tips to optimize performance and system overhead when writing data to
33
{{< product-name >}}.
44

55
- [Batch writes](#batch-writes)
6-
- [Sort tags by key](#sort-tags-by-key)
6+
{{% hide-in "enterprise,core" %}}- [Sort tags by key](#sort-tags-by-key){{% /hide-in %}}
7+
{{% show-in "enterprise,core" %}}- [On first write, sort tags by query priority](#on-first-write-sort-tags-by-query-priority){{% /show-in %}}
78
- [Use the coarsest time precision possible](#use-the-coarsest-time-precision-possible)
89
- [Use gzip compression](#use-gzip-compression)
910
- [Enable gzip compression in Telegraf](#enable-gzip-compression-in-telegraf)
@@ -34,6 +35,8 @@ Write data in batches to minimize network overhead when writing data to InfluxDB
3435
> The optimal batch size is 10,000 lines of line protocol or 10 MBs, whichever
3536
> threshold is met first.
3637
38+
{{% hide-in "enterprise,core" %}}
39+
3740
## Sort tags by key
3841

3942
Before writing data points to InfluxDB, sort tags by key in lexicographic order.
@@ -49,6 +52,31 @@ measurement,tagC=therefore,tagE=am,tagA=i,tagD=i,tagB=think fieldKey=fieldValue
4952
measurement,tagA=i,tagB=think,tagC=therefore,tagD=i,tagE=am fieldKey=fieldValue 1562020262
5053
```
5154

55+
{{% /hide-in %}}
56+
57+
{{% show-in "enterprise,core" %}}
58+
59+
## On first write, sort tags by query priority
60+
61+
The first write to a table in {{% product-name %}} determines the physical column
62+
order in storage, and that order has a direct impact on query performance.
63+
Columns that appear earlier are typically faster to filter and access during
64+
query execution.
65+
66+
Sort your tags by query priority when performing the initial write to a table.
67+
Place the most commonly queried tags first—those you frequently use in `WHERE`
68+
clauses or joins—followed by less frequently queried ones. For example, if most
69+
of your queries filter by `region` and then by `host`, structure your first
70+
write so that `region` comes before `host`.
71+
72+
> [!Important]
73+
> Column order is determined on the first write and cannot be changed afterward.
74+
> Tags added after the first write are added last in the column sort order.
75+
> Plan your schema with your query workload in mind to ensure the best long-term
76+
> performance.
77+
78+
{{% /show-in %}}
79+
5280
## Use the coarsest time precision possible
5381

5482
{{< product-name >}} supports up to nanosecond timestamp precision. However,

0 commit comments

Comments
 (0)