You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/28 22:22:48 UTC

[GitHub] [skywalking-satellite] hanahmily commented on a change in pull request #11: add prometheus server

hanahmily commented on a change in pull request #11:
URL: https://github.com/apache/skywalking-satellite/pull/11#discussion_r549503637



##########
File path: plugins/server/prometheus/Prometheus_test.go
##########
@@ -0,0 +1,66 @@
+// Licensed to 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. Apache Software Foundation (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.
+
+package prometheus
+
+import (
+	"fmt"
+	"net/http"
+	"reflect"
+	"testing"
+	"time"
+
+	"github.com/apache/skywalking-satellite/internal/pkg/log"
+	"github.com/apache/skywalking-satellite/internal/pkg/plugin"
+	"github.com/apache/skywalking-satellite/internal/satellite/telemetry"
+	"github.com/apache/skywalking-satellite/plugins/server/api"
+)
+
+func initPrometheusServer(cfg plugin.Config) (*Server, error) {

Review comment:
       Could you use different endpoints and ports instead of defaults. 

##########
File path: plugins/server/prometheus/Prometheus.go
##########
@@ -0,0 +1,83 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor

Review comment:
       Why the file name is a capical letter? 

##########
File path: internal/satellite/telemetry/telemetry.go
##########
@@ -0,0 +1,53 @@
+// Licensed to 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. Apache Software Foundation (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.
+
+package telemetry
+
+import (
+	"github.com/prometheus/client_golang/prometheus"
+)
+
+// Registerer is the global metrics center for collecting the telemetry data in core modules or plugins.
+var (
+	registry   *prometheus.Registry
+	Registerer prometheus.Registerer // The register is for adding metrics to the registry.
+	Gatherer   prometheus.Gatherer   // The gatherer is for fetching metrics from the registry.
+)
+
+// Config defines the common telemetry labels.
+type Config struct {
+	Service   string `mapstructure:"service"`   // The service name.
+	Namespace string `mapstructure:"namespace"` // The kubernetes namespace.
+	Pod       string `mapstructure:"pod"`       // The kubernetes pod name.

Review comment:
       IIRC, we should not introduce Kubernetes notions into satellite since it's designed to deployed on VM as well. 
   
   How about using more general and SkyWalking-style concepts, for example, `Cluster`, `Service` and `Instance` 

##########
File path: .github/workflows/build-and-test.yaml
##########
@@ -36,12 +36,6 @@ jobs:
         with:
           go-version: ${{ matrix.go-version }}
 
-      - name: Install Protoc
-        uses: arduino/setup-protoc@v1

Review comment:
       @kezhenxu94 Could we use a third part plugin now?

##########
File path: tools/install_protoc.sh
##########
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+
+if [[ "$(uname)"=="Darwin" || "$(expr substr $(uname -s) 1 10)"=="MINGW32_NT" ]];then

Review comment:
       In this PR, he's using a third-party plugin instead of this bash to install protoc




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org