haoel
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # CONTRIBUTING So you've decided to actively join the development of EaseProbe!!! First let us Welcome you and **Thank You** for your interest. The following document will try to provide some general guidelines and information about the development processes to help your on-boarding experience. This document is constantly under change with new things been added as the project grows. ## General guidelines The following are some guidelines that will help in getting your code contributions easier accepted. * For the Coding Standard, we follow [Uber Go Style Guide](https://github.com/uber-go/guide/blob/master/style.md). * Write a small description for your PR, this makes it much easier for the reviewer * Make sure to address any linting or test failures your PR introduces * If you contribute a new feature * update or create appropriate tests for it * update the README accordingly * If you introduced new files make sure to include the license on top of each new `.go` file. Simply run `resources/scripts/copyright.sh` script can help to add the open source license. ## How EaseProbe Works Basically, the EaseProbe have the following major code organization. ### 1) Probe - **Probe Interface**. Every Probe must implement the `Probe` interface, which is defined in `probe/probe.go` - **Base Probe**. The `probe/base/base.go` help to implement most `Probe` interface methods, like a Probe framework. - **Concrete Probe**. Every concrete probe must do the following works - `Config()` - provide probe's `kind`, `tag` and other information. - `DoProbe()` - implement the actual code that does the probing. - **Probe Configuration**. The probe configuration need to be added in` Conf` struct ( `conf/conf.go` ). - **Probe Result** The probe result and the relevant statistics are stored in a `Result` object, this is define in `probe/result.go` ### 2) Notify - **Notify Interface**. Every Notify must implement the `Notify` interface, which is defined in `notify/notify.go`. - **Base Notify**. The `notify/base/base.go` help to implement most `Notify` interface methods, like a Notify framework. - **Concrete Notify**. Every concrete notifier must do the following works - `Config()` - provide notify's `kind`, report format, send function and other information. - `SendXXXNotification(title, message)` - provide the implementation of how the notifier will perform the notification. - **Formation**. The formatting of the notification message, such as HTML, Markdown, JSON, Text or use a completely custom formatter. These formations are defined in `report/result.go` ### 3) Channel The Channel is used for connect the Probe and Notify. The `channel` package organize the Probe and Notify associations. - **Probe**. All of the prober will be run by `runProbers()` function in `cmd/easeprobe/probe.go` - **Notify**. The Notify would watch the Probe's Result in `channel.WatchAllEvents()` which in `channel/manager.go`. ### 4) SLA Report The SLA Report contains the results of all Probers which include: - **SLA Data**. SLA data (in `probe/data.go`) that are (optionally) persistent in a file. - **Web Server**. the Web server for SLA report is in `web` package, it includes the HTML web page and the Restful API. This uses of Chi framework. - **Report Format**. there are serveral foramtion for SLA report, the code is in `report/sla.go` - **Scheduler**. take care of the SLA report sceduling requirements such as Daily/Weekly/Monthly and can be found in `cmd/easeprobe/report.go` ### 5) Metrics (Prometheus) EaseProbe support to export the probe metrics to prometheus. The package `metric/prometheus.go` help to create and register the metric. - **Base Metrics**. We implement some common metrics for all of Probers i `probe/base/metrics.go` - Total Probe Times(Counter), Probe Duration(Gauge), Status(Gauge), and SLA(Gauge). - **Customize Metrics**. If we need to deal with the Prober specifice metrics, we can do the following works - **Define Metrics**. just create the `metrics.go` in probe which define the metrics struct and how to create it. - **Initialize Metrics**. intial the metrics in `Probe.Config()`funciton - **Export Metrics**. new a `Probe.ExportMetrics()` function and call it in `Probe.DoProbe()` function. Examples - Host Probe metrics: `probe/host/metrics.go` - HTTP Probe metrics: `probe/http/metrics.go` ## Source Code Files * `cmd/easeprobe` This is the `main` package for the EaseProbe main function. * `main.go` - `main()` function to do everything. * `probe.go` - Initalize and configure the Probers and start up all of probers * `notify.go` - Initalize and configure the Notifiers. * `channel.go` - Initalize and configure the Channels. * `report.go` - SLA report. * `conf`. This pacakge is for EaseProbe configuration and Log file. * `conf.go` - EaseProbe configuration file processing. * `log.go` - EaseProbe application log and access log. * `daemon`. This pacakge is about EaseProbe daemon operations, like: create the pid file. * `daemon.go` - For all platform * `daemon_windows.go` - For Windows platform * `daemon_linux.go` - For Linux Platform * `daemon_unix.go` - For all non-Windows and non-Linux platform. * `global`. This package defines the Global variables, structures and functions. * `global.go` - Default Value, Retry, TLS structure, Working Directory... * `easeprobe.go` - EaseProbe Name, Icon, Version, Host information. * `probe.go` - The common configuration for all Probers. * `notify.go` - The common configuration for all Notifiers. * `metric`. This package is for external metric report, like prometheus. * `prometheus.go` - The warpper of prometheus metrics export. * `channel`. Channel object and management * `channel.go` - The channel object. * `manager.go` - manage all of channels * `notify`. All of notifiers * `notify.go` - The notify interface definition. * `base/` - The notify framework for all notify. * `probe`. All of probers. * `probe.go` - the probe interface definition. * `base/` - The probe framework for all notification * `result.go` - The probe result object, includes all of the probe result, like status, start probe time, round trip time, statistics, etc. * `data.go` - The probe result persistent. * `status.go` - The probe status definition: `StatusUp`, `StatusDown`, `StatusUnknown`, ... etc. * `report`. SLA Report formation. * `types.go` - The format of report * `sla.go` - SLA report for all of format. * `result.go`- Probe Result for all of format. * `web`. This package is the web server for EaseProbe SLA report and API * `server.go` - Web Server * `log.go` - Access Log ​ ## Makefile The project provides a `Makefile` with the following targets * `build`: compile the project and produce the EaseProbe binary * `test`: runs `go test` * `docker`: builds the docker images for EaseProbe (using `resources/Dockerfile`) * `clean`: cleans up files created during build ​ ​ ## Github Actions The project currently has 2 Github Workflows that are responsible for checking the code and assisting in releases of new versions. - `ci.yaml` would do license checking, code lint, and unit test. - `release.yaml` would do release work, build the binaries and docker images. **Note**: goreleaser configuraiton file is `.goreleaser.yaml`, and it would use the `resources/Dockerfile.goreleaser` for docker image. ​ ### CI (`.github/workflows/ci.yaml`) The workflow has two jobs `lint` & `test` ​ The `lint` job runs the following - Spelling Check with Reviewdog - Linting through Revive - Check formatting with **`gofmt`** ​ The `test` job runs the following - `go test -cover -race`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully