-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic server implementation for the file.d playground
- Loading branch information
1 parent
92378d4
commit 468ccc9
Showing
15 changed files
with
427 additions
and
43 deletions.
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
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,42 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/ozontech/file.d/fd" | ||
"github.com/ozontech/file.d/logger" | ||
"github.com/ozontech/file.d/playground" | ||
|
||
_ "github.com/ozontech/file.d/plugin/action/add_file_name" | ||
_ "github.com/ozontech/file.d/plugin/action/add_host" | ||
_ "github.com/ozontech/file.d/plugin/action/convert_date" | ||
_ "github.com/ozontech/file.d/plugin/action/convert_log_level" | ||
_ "github.com/ozontech/file.d/plugin/action/debug" | ||
_ "github.com/ozontech/file.d/plugin/action/discard" | ||
_ "github.com/ozontech/file.d/plugin/action/flatten" | ||
_ "github.com/ozontech/file.d/plugin/action/join" | ||
_ "github.com/ozontech/file.d/plugin/action/join_template" | ||
_ "github.com/ozontech/file.d/plugin/action/json_decode" | ||
_ "github.com/ozontech/file.d/plugin/action/json_encode" | ||
_ "github.com/ozontech/file.d/plugin/action/keep_fields" | ||
_ "github.com/ozontech/file.d/plugin/action/mask" | ||
_ "github.com/ozontech/file.d/plugin/action/modify" | ||
_ "github.com/ozontech/file.d/plugin/action/parse_es" | ||
_ "github.com/ozontech/file.d/plugin/action/parse_re2" | ||
_ "github.com/ozontech/file.d/plugin/action/remove_fields" | ||
_ "github.com/ozontech/file.d/plugin/action/rename" | ||
_ "github.com/ozontech/file.d/plugin/action/set_time" | ||
|
||
_ "github.com/ozontech/file.d/plugin/input/fake" | ||
_ "github.com/ozontech/file.d/plugin/output/devnull" | ||
) | ||
|
||
func main() { | ||
lg := logger.Instance.Desugar().Named("playground") | ||
handler := playground.NewDoActionsHandler(fd.DefaultPluginRegistry, lg) | ||
|
||
err := http.ListenAndServe(":9090", handler) | ||
if err != nil && err != http.ErrServerClosed { | ||
panic(err) | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package playground | ||
|
||
import ( | ||
"time" | ||
|
||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
type ZeroClock struct { | ||
start time.Time | ||
} | ||
|
||
func NewZeroClock(now time.Time) *ZeroClock { | ||
return &ZeroClock{start: now} | ||
} | ||
|
||
var _ zapcore.Clock = ZeroClock{} | ||
|
||
func (z ZeroClock) Now() time.Time { | ||
diff := time.Since(z.start) | ||
return time.Time{}.Add(diff) | ||
} | ||
|
||
func (z ZeroClock) NewTicker(_ time.Duration) *time.Ticker { | ||
return new(time.Ticker) | ||
} |
Oops, something went wrong.