-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sumologic-image-widget) : Hubot can display widget from a sumologic dashboard #8
Open
julien-vidal
wants to merge
40
commits into
master
Choose a base branch
from
payou-playground-graph-img-generation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
980a8c4
Some test to get dashboard widget data
2061918
Start implement dashboard show cmd
e730a35
feat(package) : Set package info and dev task
julien-vidal fcff3f7
feat(sumologic-image-widget) : Test gist, shit and doc it
julien-vidal 6fc5fec
feat(sumologic-image-widget) : Play with sumologic data and revertengine
julien-vidal 83586d2
feat(sumologic-image-widget) : Push some refactor on dashboard...
e1e6ade
feat(sumologic-image-widget) : Start implementing show widget
julien-vidal d9f587c
Merge branch 'payou-playground-graph-img-generation' of https://githu…
d8d0e64
feat(sumologic-image-widget) : Start stackedBarFormatter
7df37a3
feat(sumologic-image-widget) : First working version
f9c01c9
feat(sumologic-image-widget) : Hubot listen for sumo command
julien-vidal b2fce86
feat(sumologic-image-widget) : Add Pie formatter
julien-vidal e5d0be9
feat(sumologic-image-widget) : Add some others chart to implement
julien-vidal 02a531f
feat(sumologic-image-widget) : Add missing mocks for front dashboard
a538572
feat(sumologic-image-widget) : remove sumo token from code
julien-vidal 3e0101e
feat(sumologic-image-widget) : Refactor chain architecture
julien-vidal 1f1c0d9
feat(sumologic-image-widget) : Refactor fixing
julien-vidal ce65ee8
feat(sumologic-image-widget) : add linesChart support
julien-vidal ecb60fe
feat(sumologic-image-widget) : add (time)counter charts
julien-vidal 07b7942
feat(sumologic-image-widget) : Refactor how graphBuilder getGraph
julien-vidal 635a6db
feat(sumologic-image-widget) : Start implementing (time)counter
julien-vidal b926583
feat(sumologic-image-widget) : (time)counter Done
julien-vidal 1d7292b
feat(sumologic-image-widget) : Update roadmap
julien-vidal 1a167f5
feat(sumologic-image-widget) : Fix how counter transform data
julien-vidal 11943d4
feat(sumologic-image-widget) : Add clean way to store graph file
b332496
feat(sumologic-image-widget) : Implement tmp folder and clean
julien-vidal 14cdf05
feat(sumologic-image-widget) : Start refactor of file management
354316c
feat(sumologic-image-widget) : Implement fileHelper
b23a562
feat(sumologic-image-widget) : End FileHelper integration
774006f
feat(sumologic-image-widget) : Add Highcharts theme support
a765019
feat(sumologic-image-widget) : Implement how to learn to hubot
julien-vidal 471223a
feat(sumologic-image-widget) : Comment dark theme
julien-vidal 7a12d13
feat(sumologic-image-widget) : Tidy file by purposes
954f54e
feat(sumologic-image-widget) : Remap dependencies due to previous tidy
8998270
feat(sumologic-image-widget) : Add info message when hubot learn new …
c97938b
feat(sumologic-image-widget) : Rename method for erase sumo memory
3f8fced
feat(sumologic-image-widget) : Clean fileHelper
55fe6e9
feat(sumologic-image-widget) : Clean todo and clean
deae5f7
feat(sumologic-image-widget) : Add notification on hubot learnings
julien-vidal 6a3159e
feat(sumologic-image-widget) : End error message on hubot learning fail
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ node_modules | |
.DS_Store* | ||
.hubot_history | ||
.idea | ||
custom | ||
dump.rdb |
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
18 changes: 18 additions & 0 deletions
18
scripts/hubot-sumologic-image-widget/constants/momentTimeUnitMapping.json
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,18 @@ | ||
[ | ||
{ | ||
"unit": "milliseconds", | ||
"format": "ms" | ||
}, | ||
{ | ||
"unit": "seconds", | ||
"format": "s" | ||
}, | ||
{ | ||
"unit": "minutes", | ||
"format": "m" | ||
}, | ||
{ | ||
"unit": "hours", | ||
"format": "h" | ||
} | ||
] |
33 changes: 33 additions & 0 deletions
33
scripts/hubot-sumologic-image-widget/graphs/counterChart.coffee
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,33 @@ | ||
_ = require 'lodash' | ||
numeral = require 'numeral' | ||
counterTpl = require './svgTpl/counter.tpl' | ||
SvgHelper = require '../helpers/graphs/svgHelper' | ||
|
||
class CounterChart | ||
constructor: (@name, @config, @rawData) -> | ||
@template = _.template(counterTpl) | ||
@variables = SvgHelper.getDimensions(@config) | ||
@svg = @template(_.merge(@variables, @format(@rawData))) | ||
|
||
getSvg: () -> | ||
@svg | ||
|
||
format: (rawData) -> | ||
fieldName = @extractFieldName(_.get(rawData, 'fields', [])) | ||
value = _.parseInt(_.get(rawData, "records.0.map.#{fieldName}")) | ||
numberFormatted = numeral(value).format('0a').match(/([0-9]*)([a-zA-Z])?$/) | ||
if _.isUndefined(numberFormatted[2]) | ||
numberFormatted[2] = '' | ||
return {value : numberFormatted[1], metric: numberFormatted[2]} | ||
|
||
extractFieldName: (fields) -> | ||
allowedFieldTypes = ['int', 'double'] | ||
field = _.filter(fields, (item) -> | ||
_.includes(allowedFieldTypes, item.fieldType) | ||
) | ||
if field.length is 1 | ||
return _.first(field).name | ||
else | ||
throw "Counter Graph : Don't find an eligible field, in JSON after #{JSON.stringify(fields, null, 4)}" | ||
|
||
module.exports = CounterChart |
66 changes: 66 additions & 0 deletions
66
scripts/hubot-sumologic-image-widget/graphs/linesChart.coffee
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,66 @@ | ||
_ = require 'lodash' | ||
HighchartsHelper = require '../helpers/highcharts/highchartsHelper' | ||
|
||
class LinesChart | ||
constructor: (@name, @config, @rawData) -> | ||
@svg = HighchartsHelper.getNewPlayground(@format(@rawData)) | ||
|
||
getSvg: () -> | ||
@svg | ||
|
||
format: (rawData) -> | ||
@data = { | ||
chart: | ||
forExport: true | ||
width: 800 | ||
height: 600 | ||
title: | ||
text: @name | ||
xAxis: | ||
type: 'datetime' | ||
min: rawData.resolvedTimeRange.startMillis | ||
max: rawData.resolvedTimeRange.endMillis | ||
plotOptions: | ||
series: | ||
marker: | ||
enabled: false | ||
series: @formatSeries(rawData) | ||
} | ||
|
||
#rawData is like raw.stackedbar.json | ||
#Function goal format it like highchart.stackedbar.js (series) | ||
formatSeries: (rawData) -> | ||
flatData = _.mapValues(rawData.records, 'map') | ||
|
||
seriesKeys = _(flatData) | ||
.mapValues(_.keys) | ||
.toArray() | ||
.flattenDeep() | ||
.uniq() | ||
.zipObject() | ||
.mapValues( (v, k) -> | ||
return k | ||
) | ||
.value() | ||
|
||
createSerie = (v, k) -> | ||
return {name : k, data:[]} | ||
|
||
xKeyFinder = _.partial(_.startsWith, _, '_') | ||
xKey = _(seriesKeys).chain().pickBy(xKeyFinder).values().first().value() | ||
series = _(seriesKeys).chain().omitBy(xKeyFinder).mapValues(createSerie).value() | ||
|
||
|
||
_.forEach(flatData, (record) -> | ||
_.forIn(record, (value, key, item) -> | ||
if (key isnt xKey) | ||
series[key].data.push({ | ||
x: _.parseInt(item[xKey]) | ||
y: _.parseInt(value) | ||
}) | ||
) | ||
) | ||
return _.toArray(series); | ||
|
||
|
||
module.exports = LinesChart |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my mind, dashboard means the TV Dashboard :)
Maybe use a sumologic cmd ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is just for testing, will disappear when finished ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sure, feel free it's a dashboard TV manager, I don't have TV
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should buy one 😜
Really under construction lol, I think I will move my dev in an other place at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure I should buy one.
Waiting our office keys 🍭