Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
flink-monitor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵建伟
flink-monitor
Commits
7473e043
Commit
7473e043
authored
Mar 20, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
13864593
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
25 deletions
+24
-25
PortraitMonitorShdOperator.java
...mei/data/monitor/operator/PortraitMonitorShdOperator.java
+24
-25
No files found.
src/main/java/com/gmei/data/monitor/operator/PortraitMonitorShdOperator.java
View file @
7473e043
...
...
@@ -62,6 +62,29 @@ public class PortraitMonitorShdOperator implements BaseOperator{
public
boolean
filter
(
String
value
)
throws
Exception
{
return
JSON
.
isValid
(
value
);
}
}).
assignTimestampsAndWatermarks
(
new
AscendingTimestampExtractor
<
String
>()
{
@Override
public
long
extractAscendingTimestamp
(
String
element
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
element
);
long
logTime
=
0
;
String
maidianEventTime
=
jsonObject
.
getString
(
"create_at"
);
if
(
StringUtils
.
isNotBlank
(
maidianEventTime
))
{
logTime
=
Long
.
valueOf
(
maidianEventTime
)
*
1000
;
}
String
backendEventTime
=
jsonObject
.
getString
(
"TIME"
);
if
(
StringUtils
.
isNotBlank
(
backendEventTime
))
{
try
{
logTime
=
dateTimeFormat
.
parseMillis
(
backendEventTime
);
}
catch
(
IllegalArgumentException
e
)
{
try
{
logTime
=
dateTimeNoMillisFormat
.
parseMillis
(
backendEventTime
);
}
catch
(
IllegalArgumentException
e2
)
{
e2
.
printStackTrace
();
}
}
}
return
logTime
;
}
})
.
map
(
new
MapFunction
<
String
,
JSONObject
>()
{
@Override
...
...
@@ -130,32 +153,8 @@ public class PortraitMonitorShdOperator implements BaseOperator{
return
false
;
}
});
SingleOutputStreamOperator
singleOutputStreamOperator
=
filter01
.
assignTimestampsAndWatermarks
(
new
AscendingTimestampExtractor
<
String
>()
{
@Override
public
long
extractAscendingTimestamp
(
String
element
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
element
);
long
logTime
=
0
;
String
maidianEventTime
=
jsonObject
.
getString
(
"create_at"
);
if
(
StringUtils
.
isNotBlank
(
maidianEventTime
))
{
logTime
=
Long
.
valueOf
(
maidianEventTime
)
*
1000
;
}
String
backendEventTime
=
jsonObject
.
getString
(
"TIME"
);
if
(
StringUtils
.
isNotBlank
(
backendEventTime
))
{
try
{
logTime
=
dateTimeFormat
.
parseMillis
(
backendEventTime
);
}
catch
(
IllegalArgumentException
e
)
{
try
{
logTime
=
dateTimeNoMillisFormat
.
parseMillis
(
backendEventTime
);
}
catch
(
IllegalArgumentException
e2
)
{
e2
.
printStackTrace
();
}
}
}
return
logTime
;
}
});
//filter01.print();
SingleOutputStreamOperator
map02
=
singleOutputStreamOperator
.
map
(
new
MapFunction
<
JSONObject
,
Tuple2
<
String
,
JSONObject
>>()
{
SingleOutputStreamOperator
map02
=
filter01
.
map
(
new
MapFunction
<
JSONObject
,
Tuple2
<
String
,
JSONObject
>>()
{
@Override
public
Tuple2
<
String
,
JSONObject
>
map
(
JSONObject
jsonObject
)
throws
Exception
{
String
statisticsAction
=
jsonObject
.
getString
(
"statistics_action"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment