This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1322 from openservicemesh/trace-zipkin
Separating tracing/zipkin specific code
- Loading branch information
Showing
2 changed files
with
41 additions
and
21 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,39 @@ | ||
package lds | ||
|
||
import ( | ||
xds_tracing "github.com/envoyproxy/go-control-plane/envoy/config/trace/v3" | ||
xds_hcm "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" | ||
|
||
"github.com/golang/protobuf/ptypes" | ||
"github.com/openservicemesh/osm/pkg/configurator" | ||
"github.com/openservicemesh/osm/pkg/constants" | ||
) | ||
|
||
// GetZipkinTracingConfig returns a configuration tracing struct for a connection manager to use | ||
func GetZipkinTracingConfig(cfg configurator.Configurator) (*xds_hcm.HttpConnectionManager_Tracing, error) { | ||
|
||
zipkinConf := &xds_tracing.ZipkinConfig{ | ||
CollectorCluster: constants.EnvoyZipkinCluster, | ||
CollectorEndpoint: cfg.GetZipkinEndpoint(), | ||
CollectorEndpointVersion: xds_tracing.ZipkinConfig_HTTP_JSON, | ||
} | ||
|
||
zipkinConfMarshalled, err := ptypes.MarshalAny(zipkinConf) | ||
if err != nil { | ||
log.Error().Err(err).Msgf("Error marshalling zipkinConf config %s", err) | ||
return nil, err | ||
} | ||
|
||
tracing := &xds_hcm.HttpConnectionManager_Tracing{ | ||
Verbose: true, | ||
Provider: &xds_tracing.Tracing_Http{ | ||
// Name must refer to an instantiatable tracing driver | ||
Name: "envoy.tracers.zipkin", | ||
ConfigType: &xds_tracing.Tracing_Http_TypedConfig{ | ||
TypedConfig: zipkinConfMarshalled, | ||
}, | ||
}, | ||
} | ||
|
||
return tracing, nil | ||
} |