-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(clients): add onboarding for new
influxdb3-go
, `influxdb3-csha…
…rp`, `influxdb3-java`
- Loading branch information
Showing
31 changed files
with
2,859 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/homepageExperience/components/steps/csharp/ExecuteAggregateQuery.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from 'react' | ||
import CodeSnippet from 'src/shared/components/CodeSnippet' | ||
|
||
import {SafeBlankLink} from 'src/utils/SafeBlankLink' | ||
import {event} from 'src/cloud/utils/reporting' | ||
|
||
type OwnProps = { | ||
bucket: string | ||
} | ||
|
||
export const ExecuteAggregateQuery = (props: OwnProps) => { | ||
const {bucket} = props | ||
|
||
const logCopyCodeSnippet = () => { | ||
event('firstMile.csharpWizard.executeAggregateQuery.code.copied') | ||
} | ||
|
||
const logDocsOpened = () => { | ||
event('firstMile.csharpWizard.executeAggregateQuery.docs.opened') | ||
} | ||
|
||
const fromBucketSnippet = `from(bucket: "${bucket}") | ||
|> range(start: -10m) # find data points in last 10 minutes | ||
|> mean()` | ||
|
||
const query = `const string queryAggregate = @"from(bucket: ""${bucket}"") | ||
|> range(start: -10m) | ||
|> mean()"; | ||
foreach (var table in await queryApi.QueryAsync(query: queryAggregate, org: org)) | ||
{ | ||
foreach (var record in table.Records) | ||
{ | ||
var field = record.GetField(); | ||
var value = record.GetValue(); | ||
Console.WriteLine("| {0,-5} | {1,-20} |", field, value); | ||
} | ||
}` | ||
|
||
return ( | ||
<> | ||
<h1>Execute an Aggregate Query</h1> | ||
<p> | ||
<SafeBlankLink | ||
href="https://docs.influxdata.com/flux/v0.x/function-types/#aggregates" | ||
onClick={logDocsOpened} | ||
> | ||
Aggregate functions | ||
</SafeBlankLink>{' '} | ||
take the values of all rows in a table and use them to perform an | ||
aggregate operation. The result is output as a new value in a single-row | ||
table. | ||
</p> | ||
<CodeSnippet | ||
text={fromBucketSnippet} | ||
showCopyControl={false} | ||
onCopy={logCopyCodeSnippet} | ||
language="properties" | ||
/> | ||
<p> | ||
In this example, we use the{' '} | ||
<code className="homepage-wizard--code-highlight">mean()</code> function | ||
to calculate the average value of data points in the last 10 minutes. | ||
<br /> | ||
<br /> | ||
Add the following to your <code>WriteQueryExample</code> class: | ||
</p> | ||
<CodeSnippet text={query} onCopy={logCopyCodeSnippet} language="csharp" /> | ||
<p style={{marginTop: '20px'}}> | ||
This will return the mean for the "bees" and "ants" values. | ||
</p> | ||
</> | ||
) | ||
} |
68 changes: 68 additions & 0 deletions
68
src/homepageExperience/components/steps/csharp/ExecuteQuery.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react' | ||
|
||
import CodeSnippet from 'src/shared/components/CodeSnippet' | ||
import {event} from 'src/cloud/utils/reporting' | ||
|
||
type OwnProps = { | ||
bucket: string | ||
} | ||
|
||
export const ExecuteQuery = (props: OwnProps) => { | ||
const {bucket} = props | ||
|
||
const logCopyCodeSnippet = () => { | ||
event('firstMile.csharpWizard.executeQuery.code.copied') | ||
} | ||
|
||
const fromBucketSnippet = `from(bucket: "${bucket}") | ||
|> range(start: -10m)` | ||
|
||
const query = `Console.WriteLine("Complete. Return to the InfluxDB UI."); | ||
var queryApi = client.GetQueryApi(); | ||
const string query = @"from(bucket: ""${bucket}"") |> range(start: -10m)"; | ||
foreach (var table in await queryApi.QueryAsync(query: query, org: org)) | ||
{ | ||
foreach (var record in table.Records) | ||
{ | ||
var field = record.GetField(); | ||
var value = record.GetValue(); | ||
var time = record.GetTime(); | ||
Console.WriteLine("| {0,-5} | {1,-5} | {2,-30} |", field, value, time); | ||
} | ||
}` | ||
|
||
return ( | ||
<> | ||
<h1>Execute a Flux Query</h1> | ||
<p> | ||
Now let’s query the numbers we wrote into the database. We use the Flux | ||
scripting language to query data. Flux is designed for querying, | ||
analyzing, and acting on data. | ||
<br /> | ||
<br /> | ||
Here is what a simple Flux query looks like on its own: | ||
</p> | ||
<CodeSnippet | ||
text={fromBucketSnippet} | ||
showCopyControl={false} | ||
onCopy={logCopyCodeSnippet} | ||
language="properties" | ||
/> | ||
<p> | ||
In this query, we are looking for data points within the last 10 minutes | ||
with a measurement of "census". | ||
<br /> | ||
<br /> | ||
Let’s use that Flux query in our C# code! | ||
<br /> | ||
<br /> | ||
Add the following to your <code>WriteQueryExample</code> class: | ||
</p> | ||
<CodeSnippet text={query} onCopy={logCopyCodeSnippet} language="csharp" /> | ||
</> | ||
) | ||
} |
Oops, something went wrong.