-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add open telemetry #2530
add open telemetry #2530
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2016 Google Inc. All Rights Reserved. | ||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright YEAR Google Inc. All Rights Reserved. | ||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import ( | |
"crypto/tls" | ||
"flag" | ||
"fmt" | ||
"github.com/google/cadvisor/cmd/internal/opentelemetry" | ||
"net/http" | ||
"net/http/pprof" | ||
"os" | ||
|
@@ -77,6 +78,8 @@ var rawCgroupPrefixWhiteList = flag.String("raw_cgroup_prefix_whitelist", "", "A | |
|
||
var perfEvents = flag.String("perf_events_config", "", "Path to a JSON file containing configuration of perf events to measure. Empty value disabled perf events measuring.") | ||
|
||
var traceEndpoint = flag.String("trace_endpoint", "", "Url host:port to the OTLP collector") | ||
|
||
var ( | ||
// Metrics to be ignored. | ||
// Tcp metrics are ignored by default. | ||
|
@@ -170,7 +173,12 @@ func main() { | |
klog.Fatalf("Failed to create a manager: %s", err) | ||
} | ||
|
||
mux := http.NewServeMux() | ||
// setup open telemetry | ||
if *traceEndpoint != "" { | ||
defer opentelemetry.InitTrace(*traceEndpoint, *collectorCert).Stop() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I understand why |
||
} | ||
|
||
mux := opentelemetry.WrapperServerMux(http.NewServeMux()) | ||
|
||
if *enableProfiling { | ||
mux.HandleFunc("/debug/pprof/", pprof.Index) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,18 +23,19 @@ require ( | |
github.com/golang/snappy v0.0.0-20150730031844-723cc1e459b8 // indirect | ||
github.com/influxdb/influxdb v0.9.6-0.20151125225445-9eab56311373 | ||
github.com/klauspost/crc32 v0.0.0-20151223135126-a3b15ae34567 // indirect | ||
github.com/kr/pretty v0.1.0 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious why adding opentelemetry removed this indirect dependency |
||
github.com/mesos/mesos-go v0.0.7-0.20180413204204-29de6ff97b48 | ||
github.com/onsi/ginkgo v1.11.0 // indirect | ||
github.com/onsi/gomega v1.7.1 // indirect | ||
github.com/opencontainers/runc v1.0.0-rc10 | ||
github.com/pquerna/ffjson v0.0.0-20171002144729-d49c2bc1aa13 // indirect | ||
github.com/prometheus/client_golang v1.0.0 | ||
github.com/stretchr/testify v1.4.0 | ||
go.opentelemetry.io/otel v0.5.0 | ||
go.opentelemetry.io/otel/exporters/otlp v0.5.0 | ||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be | ||
google.golang.org/api v0.0.0-20150730141719-0c2979aeaa5b | ||
google.golang.org/appengine v1.6.5 // indirect | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect | ||
google.golang.org/grpc v1.27.1 | ||
gopkg.in/olivere/elastic.v2 v2.0.12 | ||
gopkg.in/yaml.v2 v2.2.8 // indirect | ||
k8s.io/klog/v2 v2.0.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2020 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed 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 opentelemetry | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
type tracingTags []string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot find where it's used |
||
|
||
func (tT *tracingTags) String() string { | ||
return strings.Join(*tT, ", ") | ||
} | ||
|
||
func (tT *tracingTags) Set(value string) error { | ||
*tT = append(*tT, value) | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you reading this variable here? Would it be better to hide this logic inside the
InitTrace
?