SlideShare a Scribd company logo
1 of 31
Download to read offline
Noah Crowley / Developer Advocate
2.0 Client Libraries &
Using the Java Client
© 2018 InfluxData. All rights reserved.
A new approach for Clients in InfluxDB 2.0
• In 1.x, the client libraries were community-led efforts

• A function of available resources — not enough engineers!

• Has been a successful effort; supports 17 languages

• Some issues with consistency across libraries

• Function names, batching and buffering of data

• In 2.0, the client libraries are part of the work we’re doing on the
platform as a whole
© 2018 InfluxData. All rights reserved.
API-driven
• 2.0 has a consistent and easy to use API across all products

• Open Source, Enterprise, Cloud

• Allows for easy migration of workloads

• Want to give developers an equally consistent and easy to use set
of client libraries

• Consistency of function names (with respect to language
idioms)

• Ease of use: Documentation & examples, always up-to-date
InfluxDB 2.0 API &
Swagger
© 2018 InfluxData. All rights reserved.
Defining the API: Swagger
• The InfluxDB repo contains an API specification

• Industry-standard format

• Information about endpoints, parameters, security, etc.

• Single source of truth

• Allows the specification to be checked into Git and
versioned alongside the code

• Provides a contract for engineers to follow when developing
against the API
© 2018 InfluxData. All rights reserved.
/telegrafs:
get:
tags:
- Telegrafs
parameters:
- $ref: '#/components/parameters/
TraceSpan'
- in: query
name: orgID
description: specifies the organization
of the resource
required: true
schema:
type: string
responses:
'200':
description: a list of telegraf configs
content:
application/json:
schema:
$ref: "#/components/schemas/Telegrafs"
default:
description: unexpected error
content:
application/json:
schema:
$ref: “#/components/schemas/Error"
© 2018 InfluxData. All rights reserved.
Developing against the API: Swagger Codegen
• Swagger also gives us the ability to do code generation

• Both client and server are possible

• Tradeoffs between codegen and writing libraries by hand

• Ideally the libraries would be fully autogenerated, minimizing
the amount of work that needs to be done

• Tightly couples the code to the spec, making it difficult to
diverge 

• At the very least, can give developers a starting point
© 2018 InfluxData. All rights reserved.
Developing against the API: Swagger Codegen
• Downsides:

• Beholden to the quality of the code produced by the generator

• Performance & User Experience

• Time spent learning tooling

• Large library size for all functionality

• Wasn’t something we were interested in for the server
© 2018 InfluxData. All rights reserved.
Developing against the API: Swagger Codegen
• Codegen for the client libraries:

• For some languages, this is a viable option

• For others, the generated code is better used as a starting
point
© 2018 InfluxData. All rights reserved.
Consistent Guidelines for API Libraries
• As we work through the Alpha and move into the Beta, we’re
continuing to refine our guidelines for writing API libraries

• Care about the user experience: function names, etc.

• Factors outside of the Swagger definition:

• How we batch and write points, and deal with backpressure

• Consistency guarantees for read & write

• Dealing with large/streaming queries
API Features
© 2018 InfluxData. All rights reserved.
What does the API give us?
• Two types of endpoints in the API

• Traditional CRUD endpoints for managing resources

• Everything in 2.0 can be managed through the API

• Dashboards, Telegraf configs, users & permissions, etc.

• Two GRPC endpoints for write and query

• Allows us to interact with InfluxDB 2.0 in a purely programmatic
fashion, if we want
© 2018 InfluxData. All rights reserved.
Building against the API
• For 1.x, the client libraries have been used for:

• Application instrumentation & performance monitoring

• Support for managing InfluxDB using configuration-as-code
tools such as Terraform and Ansible

• Customer-facing applications that use Time Series Data

• Data analysis tools

• Custom Dashboards

• ETL & Reporting tooling
© 2018 InfluxData. All rights reserved.
Building against the API
• Expect to see similar efforts with 2.0

• Building libraries in-house allows the community to focus on
building on top of Influx
© 2018 InfluxData. All rights reserved.
Building against the API - New Abstractions
• New features in the API allow for new types of applications

• “Documents” is a simple key-value store that is currently being
used for templating within the UI

• Wanted to abstract the Chronograf-specific APIs of 1.x

• Allow developers to write additional data directly to the
database without using another tool

• Can be used for storing metadata for an IoT application,
dashboard customizations, etc.
Work in Progress
© 2018 InfluxData. All rights reserved.
Critical Path Libraries
• Used by our team to build 2.0

• Go: CLI, Telegraf

• JavaScript: UI

• Being built by the core engineering org, developed as we go

• Changing as the API and requirements evolve

• Starting most libraries with Write & Query APIs

• Get people up and running with applications
© 2018 InfluxData. All rights reserved.
JavaScript/TypeScript
• github.com/influxdata/influxdb-client-js

• Team decided to make use of autogenerated code

• Since TS is first, which generator?

• Swagger Codegen

• Official, being re-written for OAS 3.0

• Openapi-codegen

• Fork of the OAS 2.0 codegen, support for more
languages, built by Swagger Codegen developers
© 2018 InfluxData. All rights reserved.
openapi-codegen
• You can use a Docker container to run the codegen tool:
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate 
-i https://raw.githubusercontent.com/influxdata/platform/master/http/cur_swagger.yml 
-g go 
-o /local/out/go
© 2018 InfluxData. All rights reserved.
Golang
• github.com/influxdata/influxdb-client-go

• Most of the API uses generated code

• Key functions, Write & Query are not generated

• Can be imported separately in order to minimize the size of the
client
JVM Libraries
& the Java Client
© 2018 InfluxData. All rights reserved.
JVM
• Library for Java, Reactive, Scala, Kotlin

• Built by Bonitoo

• Currently lives at github.com/bonitoo-io/influxdb-client-java

• Hosted in Bonitoo Maven snapshot repo

• Java

• Both sync and async are available
© 2018 InfluxData. All rights reserved.
Java Client
• Both sync and async are available

• Write data using multiple data formats

• Query using Flux

• Management API
© 2018 InfluxData. All rights reserved.
Java Client Basics - Write
• Writes support a number of parameters

• batchSize

• flushInterval & jitterInterval

• retryInterval

• bufferLimit

• Backpressure

• DROP_OLDEST, DROP_LATEST, ERROR, BLOCK
© 2018 InfluxData. All rights reserved.
Java Client Basics - Write
• Also supports a number of data formats

• by POJO

• by Data Point

• by LineProtocol
© 2018 InfluxData. All rights reserved.
Java Client Basics - Query
• Queries written using Flux

• flux-dsl for building queries in Java

• Sync is not intended for large queries because results could be
unbounded

• Can map results to POJO

• Raw query allows you direct access to the CSV’s Flux returns
© 2018 InfluxData. All rights reserved.
Java Client Basics - Query
• Async allows users to:

• Handle unbounded queries

• Handle exceptions

• Stop receiving results and be notified when all the data has
arrived

• Handle CSV’s line-by-line
© 2018 InfluxData. All rights reserved.
Attend the Bonitoo session!
• InfluxDB Client Libraries and Applications

• Cover both JVM and C# clients w/detailed examples

• This room!
Thank You!Thank You!

More Related Content

What's hot

SAP Inside Track Singapore 2014
SAP Inside Track Singapore 2014SAP Inside Track Singapore 2014
SAP Inside Track Singapore 2014
mharkus
 

What's hot (19)

Onion Architecture and the Blog
Onion Architecture and the BlogOnion Architecture and the Blog
Onion Architecture and the Blog
 
Functions and DevOps
Functions and DevOpsFunctions and DevOps
Functions and DevOps
 
Sap HCI online training
Sap HCI online trainingSap HCI online training
Sap HCI online training
 
Scala & Spark Online Training
Scala & Spark Online TrainingScala & Spark Online Training
Scala & Spark Online Training
 
Welcome to New Swift: Library Evolution & LSP Support
Welcome to New Swift: Library Evolution & LSP SupportWelcome to New Swift: Library Evolution & LSP Support
Welcome to New Swift: Library Evolution & LSP Support
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
 
SAP Inside Track Singapore 2014
SAP Inside Track Singapore 2014SAP Inside Track Singapore 2014
SAP Inside Track Singapore 2014
 
Don't just pdf, Smart PDF
Don't just pdf, Smart PDFDon't just pdf, Smart PDF
Don't just pdf, Smart PDF
 
SpringPeople Introduction to JAVA Web Services
SpringPeople Introduction to JAVA Web ServicesSpringPeople Introduction to JAVA Web Services
SpringPeople Introduction to JAVA Web Services
 
2.3.anypoint exchange
2.3.anypoint exchange2.3.anypoint exchange
2.3.anypoint exchange
 
A Journey from API Versioning to Canary Release | APIDays Zurich 2017
A Journey from API Versioning to Canary Release | APIDays Zurich 2017A Journey from API Versioning to Canary Release | APIDays Zurich 2017
A Journey from API Versioning to Canary Release | APIDays Zurich 2017
 
A Journey from API Versioning to Canary Release | Nordic APIs Platform Summit...
A Journey from API Versioning to Canary Release | Nordic APIs Platform Summit...A Journey from API Versioning to Canary Release | Nordic APIs Platform Summit...
A Journey from API Versioning to Canary Release | Nordic APIs Platform Summit...
 
API Versioning for Zero Downtime | Devoxx Belgium 2017
API Versioning for Zero Downtime | Devoxx Belgium 2017API Versioning for Zero Downtime | Devoxx Belgium 2017
API Versioning for Zero Downtime | Devoxx Belgium 2017
 
mulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_ramlmulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_raml
 
API ARU-ARU
API ARU-ARUAPI ARU-ARU
API ARU-ARU
 
Apache flink
Apache flinkApache flink
Apache flink
 
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
 
APIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API LanguagesAPIdays 2015 - The State of Web API Languages
APIdays 2015 - The State of Web API Languages
 
Apache Flink Online Training
Apache Flink Online TrainingApache Flink Online Training
Apache Flink Online Training
 

Similar to 2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advocate | InfluxData

Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?
Akana
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
Mugunth Kumar
 
Emulators as an Emerging Best Practice for API Providers
Emulators as an Emerging Best Practice for API ProvidersEmulators as an Emerging Best Practice for API Providers
Emulators as an Emerging Best Practice for API Providers
Cisco DevNet
 

Similar to 2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advocate | InfluxData (20)

InfluxDB 2.0 Client Libraries by Noah Crowley
InfluxDB 2.0 Client Libraries by Noah CrowleyInfluxDB 2.0 Client Libraries by Noah Crowley
InfluxDB 2.0 Client Libraries by Noah Crowley
 
Adobe Spark Meetup - 9/19/2018 - San Jose, CA
Adobe Spark Meetup - 9/19/2018 - San Jose, CAAdobe Spark Meetup - 9/19/2018 - San Jose, CA
Adobe Spark Meetup - 9/19/2018 - San Jose, CA
 
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
 
SamSegalResume
SamSegalResumeSamSegalResume
SamSegalResume
 
Kafka Summit SF 2017 - Kafka and the Polyglot Programmer
Kafka Summit SF 2017 - Kafka and the Polyglot ProgrammerKafka Summit SF 2017 - Kafka and the Polyglot Programmer
Kafka Summit SF 2017 - Kafka and the Polyglot Programmer
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
Neev Open Source Contributions
Neev Open Source ContributionsNeev Open Source Contributions
Neev Open Source Contributions
 
Publishing API documentation -- Workshop
Publishing API documentation -- WorkshopPublishing API documentation -- Workshop
Publishing API documentation -- Workshop
 
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia GuptaIntro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
 
Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
 
Shindig Apachecon Asia 09
Shindig Apachecon Asia 09Shindig Apachecon Asia 09
Shindig Apachecon Asia 09
 
Multi-Lingual Accumulo Communications
Multi-Lingual Accumulo CommunicationsMulti-Lingual Accumulo Communications
Multi-Lingual Accumulo Communications
 
Emulators as an Emerging Best Practice for API Providers
Emulators as an Emerging Best Practice for API ProvidersEmulators as an Emerging Best Practice for API Providers
Emulators as an Emerging Best Practice for API Providers
 
IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019
 
REST-API's for architects and managers
REST-API's for architects and managersREST-API's for architects and managers
REST-API's for architects and managers
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
 
Advanced Database Patterns for Kubernetes
Advanced Database Patterns for KubernetesAdvanced Database Patterns for Kubernetes
Advanced Database Patterns for Kubernetes
 
Running Containerized Applications on Modern Serverless Platforms
Running Containerized Applications on Modern Serverless PlatformsRunning Containerized Applications on Modern Serverless Platforms
Running Containerized Applications on Modern Serverless Platforms
 

More from 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
 

More from 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
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

2.0 Client Libraries & Using the Java Client by Noah Crowley, Developer Advocate | InfluxData

  • 1. Noah Crowley / Developer Advocate 2.0 Client Libraries & Using the Java Client
  • 2. © 2018 InfluxData. All rights reserved. A new approach for Clients in InfluxDB 2.0 • In 1.x, the client libraries were community-led efforts • A function of available resources — not enough engineers! • Has been a successful effort; supports 17 languages • Some issues with consistency across libraries • Function names, batching and buffering of data • In 2.0, the client libraries are part of the work we’re doing on the platform as a whole
  • 3. © 2018 InfluxData. All rights reserved. API-driven • 2.0 has a consistent and easy to use API across all products • Open Source, Enterprise, Cloud • Allows for easy migration of workloads • Want to give developers an equally consistent and easy to use set of client libraries • Consistency of function names (with respect to language idioms) • Ease of use: Documentation & examples, always up-to-date
  • 4. InfluxDB 2.0 API & Swagger
  • 5. © 2018 InfluxData. All rights reserved. Defining the API: Swagger • The InfluxDB repo contains an API specification • Industry-standard format • Information about endpoints, parameters, security, etc. • Single source of truth • Allows the specification to be checked into Git and versioned alongside the code • Provides a contract for engineers to follow when developing against the API
  • 6. © 2018 InfluxData. All rights reserved. /telegrafs: get: tags: - Telegrafs parameters: - $ref: '#/components/parameters/ TraceSpan' - in: query name: orgID description: specifies the organization of the resource required: true schema: type: string responses: '200': description: a list of telegraf configs content: application/json: schema: $ref: "#/components/schemas/Telegrafs" default: description: unexpected error content: application/json: schema: $ref: “#/components/schemas/Error"
  • 7. © 2018 InfluxData. All rights reserved. Developing against the API: Swagger Codegen • Swagger also gives us the ability to do code generation • Both client and server are possible • Tradeoffs between codegen and writing libraries by hand • Ideally the libraries would be fully autogenerated, minimizing the amount of work that needs to be done • Tightly couples the code to the spec, making it difficult to diverge • At the very least, can give developers a starting point
  • 8. © 2018 InfluxData. All rights reserved. Developing against the API: Swagger Codegen • Downsides: • Beholden to the quality of the code produced by the generator • Performance & User Experience • Time spent learning tooling • Large library size for all functionality • Wasn’t something we were interested in for the server
  • 9. © 2018 InfluxData. All rights reserved. Developing against the API: Swagger Codegen • Codegen for the client libraries: • For some languages, this is a viable option • For others, the generated code is better used as a starting point
  • 10. © 2018 InfluxData. All rights reserved. Consistent Guidelines for API Libraries • As we work through the Alpha and move into the Beta, we’re continuing to refine our guidelines for writing API libraries • Care about the user experience: function names, etc. • Factors outside of the Swagger definition: • How we batch and write points, and deal with backpressure • Consistency guarantees for read & write • Dealing with large/streaming queries
  • 12. © 2018 InfluxData. All rights reserved. What does the API give us? • Two types of endpoints in the API • Traditional CRUD endpoints for managing resources • Everything in 2.0 can be managed through the API • Dashboards, Telegraf configs, users & permissions, etc. • Two GRPC endpoints for write and query • Allows us to interact with InfluxDB 2.0 in a purely programmatic fashion, if we want
  • 13. © 2018 InfluxData. All rights reserved. Building against the API • For 1.x, the client libraries have been used for: • Application instrumentation & performance monitoring • Support for managing InfluxDB using configuration-as-code tools such as Terraform and Ansible • Customer-facing applications that use Time Series Data • Data analysis tools • Custom Dashboards • ETL & Reporting tooling
  • 14. © 2018 InfluxData. All rights reserved. Building against the API • Expect to see similar efforts with 2.0 • Building libraries in-house allows the community to focus on building on top of Influx
  • 15. © 2018 InfluxData. All rights reserved. Building against the API - New Abstractions • New features in the API allow for new types of applications • “Documents” is a simple key-value store that is currently being used for templating within the UI • Wanted to abstract the Chronograf-specific APIs of 1.x • Allow developers to write additional data directly to the database without using another tool • Can be used for storing metadata for an IoT application, dashboard customizations, etc.
  • 17. © 2018 InfluxData. All rights reserved. Critical Path Libraries • Used by our team to build 2.0 • Go: CLI, Telegraf • JavaScript: UI • Being built by the core engineering org, developed as we go • Changing as the API and requirements evolve • Starting most libraries with Write & Query APIs • Get people up and running with applications
  • 18. © 2018 InfluxData. All rights reserved. JavaScript/TypeScript • github.com/influxdata/influxdb-client-js • Team decided to make use of autogenerated code • Since TS is first, which generator? • Swagger Codegen • Official, being re-written for OAS 3.0 • Openapi-codegen • Fork of the OAS 2.0 codegen, support for more languages, built by Swagger Codegen developers
  • 19. © 2018 InfluxData. All rights reserved. openapi-codegen • You can use a Docker container to run the codegen tool: docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/influxdata/platform/master/http/cur_swagger.yml -g go -o /local/out/go
  • 20.
  • 21.
  • 22. © 2018 InfluxData. All rights reserved. Golang • github.com/influxdata/influxdb-client-go • Most of the API uses generated code • Key functions, Write & Query are not generated • Can be imported separately in order to minimize the size of the client
  • 23. JVM Libraries & the Java Client
  • 24. © 2018 InfluxData. All rights reserved. JVM • Library for Java, Reactive, Scala, Kotlin • Built by Bonitoo • Currently lives at github.com/bonitoo-io/influxdb-client-java • Hosted in Bonitoo Maven snapshot repo • Java • Both sync and async are available
  • 25. © 2018 InfluxData. All rights reserved. Java Client • Both sync and async are available • Write data using multiple data formats • Query using Flux • Management API
  • 26. © 2018 InfluxData. All rights reserved. Java Client Basics - Write • Writes support a number of parameters • batchSize • flushInterval & jitterInterval • retryInterval • bufferLimit • Backpressure • DROP_OLDEST, DROP_LATEST, ERROR, BLOCK
  • 27. © 2018 InfluxData. All rights reserved. Java Client Basics - Write • Also supports a number of data formats • by POJO • by Data Point • by LineProtocol
  • 28. © 2018 InfluxData. All rights reserved. Java Client Basics - Query • Queries written using Flux • flux-dsl for building queries in Java • Sync is not intended for large queries because results could be unbounded • Can map results to POJO • Raw query allows you direct access to the CSV’s Flux returns
  • 29. © 2018 InfluxData. All rights reserved. Java Client Basics - Query • Async allows users to: • Handle unbounded queries • Handle exceptions • Stop receiving results and be notified when all the data has arrived • Handle CSV’s line-by-line
  • 30. © 2018 InfluxData. All rights reserved. Attend the Bonitoo session! • InfluxDB Client Libraries and Applications • Cover both JVM and C# clients w/detailed examples • This room!