SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
Becoming a Flux Pro
Anais Dotis-Georgiou
Developer Advocate, InfluxData
Connect Learn Build
Hear from and meet developers
from the InfluxDB Community
Be inspired by use cases from
our partners and InfluxDB engineers
Learn best practices that will
help you build great experiences
for your projects
In this talk we’ll learn about some of the biggest
challenges beginner Flux users face. We’ll also learn
about resources and tools that developers can take
advantage of to become a Flux Pro.
Anais Dotis-Georgiou
Lead Developer Advocate
Anais Dotis-Georgiou is a developer advocate at
InfluxData with a passion for making data beautiful
using data analytics, AI, and machine learning. She
takes the data that she collects and does a mix of
research, exploration, and engineering to translate the
data into something of function, value, and beauty.
Becoming a Flux Pro
Agenda
1. Understanding critical functions
2. Utilizing existing tools to expedite learning
3. Taking advantage of learning resources
From Series to Tables on Disk
measurement1 field1=1i,field2=1,field3="a"
measurement1 field1=1i,field2=2,field3="b"
Grouping
• Flux operates on streams of tables.
• Every table has a group key – a list of columns for which every
row in the table has the same value. Tables are defined by their
group keys.
• You can use Flux to combine or divide tables.
Group Keys
NOAA water sample dataset schema
▪ 5 measurement:
• average_tempearture, h2o_feet, h2o_pH, h2o_quality,
h2o_temperature
▪ 5 fields:
• degrees, index, level description, pH, water_level
▪ 2 tags: location, randtag
• 2 location tag values
▪ coyote_creek, santa_monica
• 3 randtag tag values
▪ 1, 2, 3
How do I calculate the
mean() temp across
coyote_creek and
santa_monica?
query and group() data
from(bucket: "noaa")
|> range(start: rfc3339startTime, stop: rfc3339stopTime)
|> filter(fn: (r) => r["_measurement"] == "average_temperature")
|> filter(fn: (r) => r["_field"] == "degrees")
|> filter(fn: (r) => r["location"] == "coyote_creek" or
r["location"] == "santa_monica")
|> limit(n:3)
|> yield(name: "before")
|> group(columns:["_measurement"])
|> yield(name: "group on measurement")
Not in
Group Key
In Group Key In Group
Key
Not in
Group
Key
In Group Key In Group Key In Group Key Not in Group
Key
table
before
_measurement _field _value location _start _stop _time
0 average_temperature temperature 82.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time1
0 average_temperature temperature 73.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time2
0 average_temperature temperature 86.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time3
1 average_temperature temperature 85.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time1
1 average_temperature temperature 74.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time2
1 average_temperature temperature 80.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time3
Not in Group
Key
In Group Key Not In Group
Key
Not in
Group
Key
Not In Group
Key
Not In Group Key Not In Group Key Not in Group
Key
table
group on
measurement
_measurement _field _value location _start _stop _time
0 average_tempera
ture
temperature 82.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time1
0 average_tempera
ture
temperature 73.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time2
0 average_tempera
ture
temperature 86.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time3
0 average_tempera
ture
temperature 85.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time1
0 average_tempera
ture
temperature 74.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time2
0 average_tempera
ture
temperature 80.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time3
calculate mean
…
|> mean()
|> yield(name: "mean")
Not in
Group Key
In Group Key Not in
Group
Key
table
mean
_measurement _value
0 average_temperature 80.0
Embracing
experimentation
• Learning a new language involves embracing
experimentation. Understanding happens through
trial and error.
• Tools that facilitate experimentation:
• InfluxDB UI
• Flux extension for VS Code
Function Filter
Raw Data View
yield() and limit() functions
yield() and limit() functions
yield() function
data = from(bucket: "noaa")
|> range(start: rfc3339startTime, stop: rfc3339stopTime)
|> filter(fn: (r) => r["_measurement"] == "average_temperature")
|> filter(fn: (r) => r["_field"] == "degrees")
|> filter(fn: (r) => r["location"] == "coyote_creek")
data |> mean()
|> yield(name: "mean")
data |> max()
|> yield(name: "max")
data |> min()
|> yield(name: "min")
Flux VS Code Extension
Resources
• Get started: influxdata.com/cloud
• Forums: community.influxdata.com
• Slack: influxcommunity.slack.com
• Reddit: r/InfluxData
• GH: github.com/InfluxCommunity
• Book: awesome.influxdata.com
• Docs: docs.influxdata.com
• Blogs: influxdata.com/blog
• InfluxDB University: influxdata.com/university
• How to guides: docs.influxdata.com/resources/how-to-guides/
InfluxDB University offers free live and self-paced training on:
Scan to explore the
course catalog
influxdbu.com
• InfluxDB
• Telegraf
• Flux
Time to Awesome Book
Docs: how-to guides
Late Arriving Data
T H A N K Y O U
How do I calculate the
difference in temp across
both locations?
Not in
Group Key
In Group Key In Group Key Not in
Group
Key
In Group Key In Group Key in Group Key Not in Group
Key
table
raw
_measurement _field _value generatorID topic host _time
0 genData temperature 190.0 generator1 emergency_gen
erator/generator
1
influxdata-roads
how
rfc3339time1
0 genData temperature 195.0 generator1 emergency_gen
erator/generator
1
influxdata-roads
how
rfc3339time2
1 genData temperature 200.0 generator2 emergency_gen
erator/generator
2
influxdata-roads
how
rfc3339time1
1 genData temperature 210.0 generator2 emergency_gen
erator/generator
2
influxdata-roads
how
rfc3339time2
pivot
pivoted = data
|> pivot(rowKey:["_time"], columnKey: ["generatorID"],
valueColumn: "_value")
|> yield(name: "pivot")
Not in
Group Key
In Group Key In Group Key Not in
Group Key
Not in Group
Key
In Group Key in Group Key Not in Group
Key
table
pivoted
_measurement _field generator1 generator2 topic host _time
0 genData temperature 190.0 200.0 emergency_gene
rator/generator1
influxdata-roadsh
ow
rfc3339time1
0 genData temperature 195.0 210.0 emergency_gene
rator/generator1
influxdata-roadsh
ow
rfc3339time2
map
difference = pivot
|> map(fn: (r) => ({ r with difference: r.generator1 -
r.generator2 }))
|> yield(name: "difference")
Not in
Group Key
In Group Key In Group Key Not in
Group Key
Not in Group
Key
Not in Group
Key
In Group Key in Group Key Not in Group
Key
table
pivoted
_measurement _field generator1 generator2 difference topic host _time
0 genData temperature 190.0 200.0 -10.0 emergency_ge
nerator/generat
or1
influxdata-road
show
rfc3339time1
0 genData temperature 195.0 210.0 -15.0 emergency_ge
nerator/generat
or1
influxdata-road
show
rfc3339time2
//use the math.abs() function to get the absolute difference
|> map(fn: (r) => ({ r with difference: math.abs(x: r.generator1 -
r.generator2 )}))
i n f l u x d a y s . c o m

Weitere ähnliche Inhalte

Ähnlich wie Anais Dotis-Georgiou [InfluxData] | Becoming a Flux Pro | InfluxDays 2022

Ähnlich wie Anais Dotis-Georgiou [InfluxData] | Becoming a Flux Pro | InfluxDays 2022 (20)

Bridging Big Data and Data Science Using Scalable Workflows
Bridging Big Data and Data Science Using Scalable WorkflowsBridging Big Data and Data Science Using Scalable Workflows
Bridging Big Data and Data Science Using Scalable Workflows
 
R language tutorial
R language tutorialR language tutorial
R language tutorial
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best Practices
 
Filar seymour oreilly_bot_story_
Filar seymour oreilly_bot_story_Filar seymour oreilly_bot_story_
Filar seymour oreilly_bot_story_
 
Value streammapping cascadiait2014-mceniry
Value streammapping cascadiait2014-mceniryValue streammapping cascadiait2014-mceniry
Value streammapping cascadiait2014-mceniry
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
R tutorial
R tutorialR tutorial
R tutorial
 
How to Achieve Scale with MongoDB
How to Achieve Scale with MongoDBHow to Achieve Scale with MongoDB
How to Achieve Scale with MongoDB
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFix
 
Aws r
Aws rAws r
Aws r
 
OU RSE Tutorial Big Data Cluster
OU RSE Tutorial Big Data ClusterOU RSE Tutorial Big Data Cluster
OU RSE Tutorial Big Data Cluster
 
Reproducible research: practice
Reproducible research: practiceReproducible research: practice
Reproducible research: practice
 
Building Search & Recommendation Engines
Building Search & Recommendation EnginesBuilding Search & Recommendation Engines
Building Search & Recommendation Engines
 
InfluxDB & Grafana
InfluxDB & GrafanaInfluxDB & Grafana
InfluxDB & Grafana
 
Creating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with ChaperoneCreating Developer-Friendly Docker Containers with Chaperone
Creating Developer-Friendly Docker Containers with Chaperone
 
The ARK Identifier Scheme at Ten Years Old
The ARK Identifier Scheme at Ten Years OldThe ARK Identifier Scheme at Ten Years Old
The ARK Identifier Scheme at Ten Years Old
 
Abcd iqs ssoftware-projects-mercecrosas
Abcd iqs ssoftware-projects-mercecrosasAbcd iqs ssoftware-projects-mercecrosas
Abcd iqs ssoftware-projects-mercecrosas
 
Data Science
Data ScienceData Science
Data Science
 
Introduction to Apache HBase Training
Introduction to Apache HBase TrainingIntroduction to Apache HBase Training
Introduction to Apache HBase Training
 
Scientific Computing - Hardware
Scientific Computing - HardwareScientific Computing - Hardware
Scientific Computing - Hardware
 

Mehr von InfluxData

How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 

Mehr von InfluxData (20)

Announcing InfluxDB Clustered
Announcing InfluxDB ClusteredAnnouncing InfluxDB Clustered
Announcing InfluxDB Clustered
 
Best Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow EcosystemBest Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow Ecosystem
 
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
 
Power Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDBPower Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDB
 
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
 
Build an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING StackBuild an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING Stack
 
Meet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using RustMeet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using Rust
 
Introducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud DedicatedIntroducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud Dedicated
 
Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB
 
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
 
Introducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage EngineIntroducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage Engine
 
Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena
 
Understanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineUnderstanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage Engine
 
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDBStreamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
 
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
 
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Anais Dotis-Georgiou [InfluxData] | Becoming a Flux Pro | InfluxDays 2022

  • 1.
  • 2. Becoming a Flux Pro Anais Dotis-Georgiou Developer Advocate, InfluxData
  • 3. Connect Learn Build Hear from and meet developers from the InfluxDB Community Be inspired by use cases from our partners and InfluxDB engineers Learn best practices that will help you build great experiences for your projects
  • 4. In this talk we’ll learn about some of the biggest challenges beginner Flux users face. We’ll also learn about resources and tools that developers can take advantage of to become a Flux Pro. Anais Dotis-Georgiou Lead Developer Advocate Anais Dotis-Georgiou is a developer advocate at InfluxData with a passion for making data beautiful using data analytics, AI, and machine learning. She takes the data that she collects and does a mix of research, exploration, and engineering to translate the data into something of function, value, and beauty. Becoming a Flux Pro
  • 5. Agenda 1. Understanding critical functions 2. Utilizing existing tools to expedite learning 3. Taking advantage of learning resources
  • 6. From Series to Tables on Disk measurement1 field1=1i,field2=1,field3="a" measurement1 field1=1i,field2=2,field3="b"
  • 7. Grouping • Flux operates on streams of tables. • Every table has a group key – a list of columns for which every row in the table has the same value. Tables are defined by their group keys. • You can use Flux to combine or divide tables.
  • 9. NOAA water sample dataset schema ▪ 5 measurement: • average_tempearture, h2o_feet, h2o_pH, h2o_quality, h2o_temperature ▪ 5 fields: • degrees, index, level description, pH, water_level ▪ 2 tags: location, randtag • 2 location tag values ▪ coyote_creek, santa_monica • 3 randtag tag values ▪ 1, 2, 3
  • 10. How do I calculate the mean() temp across coyote_creek and santa_monica?
  • 11. query and group() data from(bucket: "noaa") |> range(start: rfc3339startTime, stop: rfc3339stopTime) |> filter(fn: (r) => r["_measurement"] == "average_temperature") |> filter(fn: (r) => r["_field"] == "degrees") |> filter(fn: (r) => r["location"] == "coyote_creek" or r["location"] == "santa_monica") |> limit(n:3) |> yield(name: "before") |> group(columns:["_measurement"]) |> yield(name: "group on measurement")
  • 12. Not in Group Key In Group Key In Group Key Not in Group Key In Group Key In Group Key In Group Key Not in Group Key table before _measurement _field _value location _start _stop _time 0 average_temperature temperature 82.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time1 0 average_temperature temperature 73.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time2 0 average_temperature temperature 86.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time3 1 average_temperature temperature 85.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time1 1 average_temperature temperature 74.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time2 1 average_temperature temperature 80.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time3
  • 13. Not in Group Key In Group Key Not In Group Key Not in Group Key Not In Group Key Not In Group Key Not In Group Key Not in Group Key table group on measurement _measurement _field _value location _start _stop _time 0 average_tempera ture temperature 82.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time1 0 average_tempera ture temperature 73.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time2 0 average_tempera ture temperature 86.0 coyote_creek rfc3339startTime rfc3339stopTime rfc3339time3 0 average_tempera ture temperature 85.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time1 0 average_tempera ture temperature 74.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time2 0 average_tempera ture temperature 80.0 santa_monica rfc3339startTime rfc3339stopTime rfc3339time3
  • 14. calculate mean … |> mean() |> yield(name: "mean")
  • 15. Not in Group Key In Group Key Not in Group Key table mean _measurement _value 0 average_temperature 80.0
  • 16. Embracing experimentation • Learning a new language involves embracing experimentation. Understanding happens through trial and error. • Tools that facilitate experimentation: • InfluxDB UI • Flux extension for VS Code
  • 19. yield() and limit() functions
  • 20. yield() and limit() functions
  • 21. yield() function data = from(bucket: "noaa") |> range(start: rfc3339startTime, stop: rfc3339stopTime) |> filter(fn: (r) => r["_measurement"] == "average_temperature") |> filter(fn: (r) => r["_field"] == "degrees") |> filter(fn: (r) => r["location"] == "coyote_creek") data |> mean() |> yield(name: "mean") data |> max() |> yield(name: "max") data |> min() |> yield(name: "min")
  • 22. Flux VS Code Extension
  • 23. Resources • Get started: influxdata.com/cloud • Forums: community.influxdata.com • Slack: influxcommunity.slack.com • Reddit: r/InfluxData • GH: github.com/InfluxCommunity • Book: awesome.influxdata.com • Docs: docs.influxdata.com • Blogs: influxdata.com/blog • InfluxDB University: influxdata.com/university • How to guides: docs.influxdata.com/resources/how-to-guides/
  • 24. InfluxDB University offers free live and self-paced training on: Scan to explore the course catalog influxdbu.com • InfluxDB • Telegraf • Flux
  • 28. T H A N K Y O U
  • 29. How do I calculate the difference in temp across both locations?
  • 30. Not in Group Key In Group Key In Group Key Not in Group Key In Group Key In Group Key in Group Key Not in Group Key table raw _measurement _field _value generatorID topic host _time 0 genData temperature 190.0 generator1 emergency_gen erator/generator 1 influxdata-roads how rfc3339time1 0 genData temperature 195.0 generator1 emergency_gen erator/generator 1 influxdata-roads how rfc3339time2 1 genData temperature 200.0 generator2 emergency_gen erator/generator 2 influxdata-roads how rfc3339time1 1 genData temperature 210.0 generator2 emergency_gen erator/generator 2 influxdata-roads how rfc3339time2
  • 31. pivot pivoted = data |> pivot(rowKey:["_time"], columnKey: ["generatorID"], valueColumn: "_value") |> yield(name: "pivot")
  • 32. Not in Group Key In Group Key In Group Key Not in Group Key Not in Group Key In Group Key in Group Key Not in Group Key table pivoted _measurement _field generator1 generator2 topic host _time 0 genData temperature 190.0 200.0 emergency_gene rator/generator1 influxdata-roadsh ow rfc3339time1 0 genData temperature 195.0 210.0 emergency_gene rator/generator1 influxdata-roadsh ow rfc3339time2
  • 33. map difference = pivot |> map(fn: (r) => ({ r with difference: r.generator1 - r.generator2 })) |> yield(name: "difference")
  • 34. Not in Group Key In Group Key In Group Key Not in Group Key Not in Group Key Not in Group Key In Group Key in Group Key Not in Group Key table pivoted _measurement _field generator1 generator2 difference topic host _time 0 genData temperature 190.0 200.0 -10.0 emergency_ge nerator/generat or1 influxdata-road show rfc3339time1 0 genData temperature 195.0 210.0 -15.0 emergency_ge nerator/generat or1 influxdata-road show rfc3339time2 //use the math.abs() function to get the absolute difference |> map(fn: (r) => ({ r with difference: math.abs(x: r.generator1 - r.generator2 )}))
  • 35. i n f l u x d a y s . c o m