Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Nathaniel Cook
Increasing Reuse and
Time to Awesome by
Using Flux Packages
Write and share your Flux code
Flux Packages Coming Soon
© 2019 InfluxData. All rights reserved. 3
What are Flux packages?
● Flux source code
● Name
● Version
● Other Metadata
Anatomy of a Flux Package
© 2019 InfluxData. All rights reserved. 5
Create a Flux package
alerts/
package.flux
check.flux
notify.flux
// package.flu...
A package for consistently downsampling data across teams
Example: Consistent Downsampling
© 2019 InfluxData. All rights reserved. 7
Downsampling Package
//downsample.flux
package downsample
bucket = "downsampled_...
© 2019 InfluxData. All rights reserved. 8
Package Tests
//downsample_test.flux
package downsample_test
import "downsample"...
© 2019 InfluxData. All rights reserved. 9
Package
//package.flux
package downsample
option package = {
version: "0.3.1",
}
A package for monitoring services using the RED method
Example: RED Alerts
© 2019 InfluxData. All rights reserved. 11
RED Package
// red.flux
package red
import "influxdata/influxdb/monitoring"
req...
© 2019 InfluxData. All rights reserved. 12
//package.flux
package red
option package = {
version: "0.32.1",
dependencies: ...
Details on how packages function
Flux Package Mechanics
© 2019 InfluxData. All rights reserved. 14
Package Lookup
FLUX_PATH is an environment variable that defines a list of
dire...
© 2019 InfluxData. All rights reserved. 15
Dependency Resolution
What if the same dependency is used by more than one
depe...
© 2019 InfluxData. All rights reserved. 16
Max of Mins Version Selection
package endpoints
option package = {
version: "1....
A short introduction
Semantic Versioning
© 2019 InfluxData. All rights reserved. 18
What is a semantic version?
v1.35.8
Major Minor Patch
© 2019 InfluxData. All rights reserved. 19
Major Versions
Different major versions of a package will be treated as a
separ...
A place to publish and share Flux packages
Flux Package Registry
© 2019 InfluxData. All rights reserved. 21
Package Registry
● User Account to authenticate with Registry
● Packages are Im...
© 2019 InfluxData. All rights reserved. 22
Influx CLI Utility
$ # Initialize a new package directory tree
$ influx package...
Flux is a
community
Let us know what you think about packages
Nächste SlideShare
Wird geladen in …5
×

Increasing Reuse and Time to Awesome by Using Flux Packages | Nathaniel Cook | InfluxData

908 Aufrufe

Veröffentlicht am

This talk will show how to develop your own packages in Flux and publish them to the public package repository. We’ll show the development and testing workflow along with the tools for iterating and releasing new versions of a package.

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Increasing Reuse and Time to Awesome by Using Flux Packages | Nathaniel Cook | InfluxData

  1. 1. Nathaniel Cook Increasing Reuse and Time to Awesome by Using Flux Packages
  2. 2. Write and share your Flux code Flux Packages Coming Soon
  3. 3. © 2019 InfluxData. All rights reserved. 3 What are Flux packages? ● Flux source code ● Name ● Version ● Other Metadata
  4. 4. Anatomy of a Flux Package
  5. 5. © 2019 InfluxData. All rights reserved. 5 Create a Flux package alerts/ package.flux check.flux notify.flux // package.flux package alerts option package = { version: "0.3.1", dependencies: [{ package: "alerta", version: "1.0.0" }] }
  6. 6. A package for consistently downsampling data across teams Example: Consistent Downsampling
  7. 7. © 2019 InfluxData. All rights reserved. 7 Downsampling Package //downsample.flux package downsample bucket = "downsampled_5m" every = 5m mean = (tables=<-) => tables |> aggregateWindow(every: every, fn: mean) |> set(key: "agg", value: "mean") |> to(bucket: bucket)
  8. 8. © 2019 InfluxData. All rights reserved. 8 Package Tests //downsample_test.flux package downsample_test import "downsample" test mean = () => ({ input: ..., want: ..., fn: downsample.mean, })
  9. 9. © 2019 InfluxData. All rights reserved. 9 Package //package.flux package downsample option package = { version: "0.3.1", }
  10. 10. A package for monitoring services using the RED method Example: RED Alerts
  11. 11. © 2019 InfluxData. All rights reserved. 11 RED Package // red.flux package red import "influxdata/influxdb/monitoring" requestsCheck = ... errorsCheck = ... durationsCheck = ...
  12. 12. © 2019 InfluxData. All rights reserved. 12 //package.flux package red option package = { version: "0.32.1", dependencies: [{ package: "influxdata/influxdb/monitor", version: "1.0.0" }] }
  13. 13. Details on how packages function Flux Package Mechanics
  14. 14. © 2019 InfluxData. All rights reserved. 14 Package Lookup FLUX_PATH is an environment variable that defines a list of directories to search for packages. 1. Search for directory of the form $FLUX_PATH/pauldix/foo 2. Search for version directory of the form $FLUX_PATH/pauldix/foo/_version/v0.3.5 3. Search public registry for package (optionally download and cache into FLUX_PATH)
  15. 15. © 2019 InfluxData. All rights reserved. 15 Dependency Resolution What if the same dependency is used by more than one dependent package? Flux will pick the maximum version of the provided minimum versions.
  16. 16. © 2019 InfluxData. All rights reserved. 16 Max of Mins Version Selection package endpoints option package = { version: "1.5.1", dependencies: [{ package: "alerta", version: "1.2.1" }] } package alerts option package = { version: "0.3.1", dependencies: [{ package: "alerta", version: "1.0.0" }] }
  17. 17. A short introduction Semantic Versioning
  18. 18. © 2019 InfluxData. All rights reserved. 18 What is a semantic version? v1.35.8 Major Minor Patch
  19. 19. © 2019 InfluxData. All rights reserved. 19 Major Versions Different major versions of a package will be treated as a separate package. package foo import "nathanielc/downsample" import d2 "nathanielc/downsample@2"
  20. 20. A place to publish and share Flux packages Flux Package Registry
  21. 21. © 2019 InfluxData. All rights reserved. 21 Package Registry ● User Account to authenticate with Registry ● Packages are Immutable ● Namespaced by a user or organization ● Semantically Versioned
  22. 22. © 2019 InfluxData. All rights reserved. 22 Influx CLI Utility $ # Initialize a new package directory tree $ influx package init $ # Run all tests in the package directory $ influx package test $ # Publish the package to the registry $ influx package publish
  23. 23. Flux is a community Let us know what you think about packages

×