Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-Morgan committed Oct 23, 2024
1 parent e92447c commit a2d4254
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 129 deletions.
82 changes: 0 additions & 82 deletions tracing/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,85 +13,3 @@
// limitations under the License.

package tracing

/*// Server HTTP metrics
const (
ServerRequestCount = "http.server.request_count" // measures the incoming request count total
ServerLatency = "http.server.duration" // measures th incoming end to end duration
)
// Client HTTP metrics.
const (
ClientRequestCount = "http.client.request_count" // measures the client request count total
ClientLatency = "http.client.duration" // measures the duration outbound HTTP requests
)
var (
HTTPMetricsAttributes = []attribute.Key{
semconv.HTTPHostKey,
semconv.HTTPRouteKey,
semconv.HTTPMethodKey,
semconv.HTTPStatusCodeKey,
}
PeerMetricsAttributes = []attribute.Key{
semconv.PeerServiceKey,
PeerServiceNamespaceKey,
PeerDeploymentEnvironmentKey,
RequestProtocolKey,
}
// MetricResourceAttributes resource attributes
MetricResourceAttributes = []attribute.Key{
semconv.ServiceNameKey,
semconv.ServiceNamespaceKey,
semconv.DeploymentEnvironmentKey,
semconv.ServiceInstanceIDKey,
semconv.ServiceVersionKey,
semconv.TelemetrySDKLanguageKey,
semconv.TelemetrySDKVersionKey,
semconv.ProcessPIDKey,
semconv.HostNameKey,
semconv.HostIDKey,
}
)
func extractMetricsAttributesFromSpan(span oteltrace.Span) []attribute.KeyValue {
var attrs []attribute.KeyValue
readOnlySpan, ok := span.(trace.ReadOnlySpan)
if !ok {
return attrs
}
// span attributes
for _, attr := range readOnlySpan.Attributes() {
if matchAttributeKey(attr.Key, HTTPMetricsAttributes) {
attrs = append(attrs, attr)
}
if matchAttributeKey(attr.Key, PeerMetricsAttributes) {
attrs = append(attrs, attr)
}
}
// span resource attributes
for _, attr := range readOnlySpan.Resource().Attributes() {
if matchAttributeKey(attr.Key, MetricResourceAttributes) {
attrs = append(attrs, attr)
}
}
// status code
attrs = append(attrs, StatusKey.String(readOnlySpan.Status().Code.String()))
return attrs
}
func matchAttributeKey(key attribute.Key, toMatchKeys []attribute.Key) bool {
for _, attrKey := range toMatchKeys {
if attrKey == key {
return true
}
}
return false
}
*/
47 changes: 0 additions & 47 deletions tracing/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,3 @@
// limitations under the License.

package tracing

/*func injectPeerServiceToMetadata(_ context.Context, attrs []attribute.KeyValue) map[string]string {
serviceName, serviceNamespace, deploymentEnv := getServiceFromResourceAttributes(attrs)
md := make(map[string]string, 3)
if serviceName != "" {
md[semconvAttributeKeyToHTTPHeader(string(semconv.ServiceNameKey))] = serviceName
}
if serviceNamespace != "" {
md[semconvAttributeKeyToHTTPHeader(string(semconv.ServiceNamespaceKey))] = serviceNamespace
}
if deploymentEnv != "" {
md[semconvAttributeKeyToHTTPHeader(string(semconv.DeploymentEnvironmentKey))] = deploymentEnv
}
return md
}
func extractPeerServiceAttributesFromMetadata(headers *protocol.RequestHeader) []attribute.KeyValue {
var attrs []attribute.KeyValue
serviceName, serviceNamespace, deploymentEnv := headers.Get(semconvAttributeKeyToHTTPHeader(string(semconv.ServiceNameKey))),
headers.Get(semconvAttributeKeyToHTTPHeader(string(semconv.ServiceNamespaceKey))),
headers.Get(semconvAttributeKeyToHTTPHeader(string(semconv.DeploymentEnvironmentKey)))
if serviceName != "" {
attrs = append(attrs, semconv.PeerServiceKey.String(serviceName))
}
if serviceNamespace != "" {
attrs = append(attrs, PeerServiceNamespaceKey.String(serviceNamespace))
}
if deploymentEnv != "" {
attrs = append(attrs, PeerDeploymentEnvironmentKey.String(deploymentEnv))
}
return attrs
}*/
/*
func semconvAttributeKeyToHTTPHeader(key string) string {
return strings.ReplaceAll(key, ".", "-")
}
*/

0 comments on commit a2d4254

Please sign in to comment.