Upgrade dependencies. (#42)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index a520d78..577121e 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -37,14 +37,14 @@
     - fmt
     - check-and-test
     - doc
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
           submodules: 'recursive'
 
   license-check:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
@@ -59,7 +59,7 @@
           config: .github/licenserc.yaml
 
   fmt:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
@@ -76,11 +76,13 @@
         features:
           - ""
           - "--all-features"
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
           submodules: 'recursive'
+      - name: Install protoc
+        run: sudo apt-get install -y protobuf-compiler=3.6.1.3-2ubuntu5
       - name: Install Rust toolchain
         run: rustup toolchain install stable --component clippy
       - name: Run check
@@ -91,11 +93,13 @@
         run: cargo test --workspace --release ${{ matrix.features }}
 
   doc:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
           submodules: 'recursive'
+      - name: Install protoc
+        run: sudo apt-get install -y protobuf-compiler=3.6.1.3-2ubuntu5
       - name: Install Rust toolchain
         run: rustup toolchain install stable
       - name: Run docs
diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml
index 90175d9..052ecaf 100644
--- a/.github/workflows/codecov.yaml
+++ b/.github/workflows/codecov.yaml
@@ -25,11 +25,13 @@
       - 'v*'
 jobs:
   test:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
           submodules: true
+      - name: Install protoc
+        run: sudo apt-get install -y protobuf-compiler=3.6.1.3-2ubuntu5
       - uses: actions-rs/toolchain@v1
         with:
           profile: minimal
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 8e389e1..d1fab52 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -27,7 +27,7 @@
 
 jobs:
   e2e-rust:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
         with:
diff --git a/Cargo.toml b/Cargo.toml
index 498478e..1ccc728 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,25 +38,25 @@
 [dependencies]
 async-stream = "0.3.3"
 base64 = "0.13.0"
-bytes = "1.1.0"
+bytes = "1.2.1"
 cfg-if = "1.0.0"
 futures-core = "0.3.21"
 futures-util = "0.3.21"
-prost = "0.10.4"
-prost-derive = "0.10.1"
-serde = { version = "1.0.138", features = ["derive"] }
-thiserror = "1.0.31"
-tokio = { version = "1.18.2", features = ["parking_lot"] }
-tonic = { version = "0.7.2", features = ["codegen"] }
-tracing = "0.1.35"
-uuid = { version = "1.1.0", features = ["serde", "v4"] }
+prost = "0.11.0"
+prost-derive = "0.11.0"
+serde = { version = "1.0.143", features = ["derive"] }
+thiserror = "1.0.32"
+tokio = { version = "1.20.1", features = ["parking_lot"] }
+tonic = { version = "0.8.0", features = ["codegen"] }
+tracing = "0.1.36"
+uuid = { version = "1.1.2", features = ["serde", "v4"] }
 
 [build-dependencies]
-tonic-build = "0.7.2"
+tonic-build = "0.8.0"
 
 [dev-dependencies]
-tokio = { version = "1.18.2", features = ["rt-multi-thread", "signal"] }
-tokio-stream = { version = "0.1.8", features = ["net"] }
+tokio = { version = "1.20.1", features = ["rt-multi-thread", "signal"] }
+tokio-stream = { version = "0.1.9", features = ["net"] }
 
 [[test]]
 name = "trace_context"
diff --git a/e2e/docker/Dockerfile b/e2e/docker/Dockerfile
index 7b7c6c6..d1296c7 100644
--- a/e2e/docker/Dockerfile
+++ b/e2e/docker/Dockerfile
@@ -16,7 +16,7 @@
 # under the License.
 #
 FROM rust:1.57
-RUN apt-get update && apt-get install -y cmake
+RUN apt-get update && apt-get install -y cmake protobuf-compiler=3.12.4-1
 WORKDIR /build
 COPY . /build/
 RUN cargo build --release --workspace
diff --git a/src/reporter/mod.rs b/src/reporter/mod.rs
index 534647d..044afa2 100644
--- a/src/reporter/mod.rs
+++ b/src/reporter/mod.rs
@@ -15,13 +15,14 @@
 //
 
 pub mod grpc;
-pub mod once_cell;
 pub mod print;
 
 use crate::skywalking_proto::v3::{LogData, SegmentObject};
+use serde::{Deserialize, Serialize};
 use std::{ops::Deref, sync::Arc};
+use tokio::sync::OnceCell;
 
-#[derive(Debug)]
+#[derive(Debug, Serialize, Deserialize)]
 #[non_exhaustive]
 pub enum CollectItem {
     Trace(SegmentObject),
@@ -51,3 +52,9 @@
         Report::report(self.deref(), item)
     }
 }
+
+impl<T: Report> Report for OnceCell<T> {
+    fn report(&self, item: CollectItem) {
+        Report::report(self.get().expect("OnceCell is empty"), item)
+    }
+}
diff --git a/src/reporter/once_cell.rs b/src/reporter/once_cell.rs
deleted file mode 100644
index acd8d73..0000000
--- a/src/reporter/once_cell.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-use crate::reporter::{CollectItem, Report};
-use tokio::sync::OnceCell;
-
-#[derive(Clone, Default)]
-pub struct OnceCellReporter<R: Report> {
-    report: OnceCell<R>,
-}
-
-impl<R: Report> OnceCellReporter<R> {
-    pub fn set(&self, report: R) -> Option<()> {
-        self.report.set(report).ok()
-    }
-}
-
-impl<R: Report> Report for OnceCellReporter<R> {
-    fn report(&self, item: CollectItem) {
-        self.report
-            .get()
-            .expect("Report hasn't setted")
-            .report(item)
-    }
-}