From 51b6593c12b734befaa655901a7b8b86ee027cce Mon Sep 17 00:00:00 2001 From: "saikalyan.bhagavathula" Date: Fri, 24 May 2024 20:32:28 +0530 Subject: [PATCH] changing few log levels --- pkg/convert/traces.go | 5 +++- pkg/libtrace/transmission/transmission.go | 36 ++++++++++------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/pkg/convert/traces.go b/pkg/convert/traces.go index 77a698016..da74cf49f 100644 --- a/pkg/convert/traces.go +++ b/pkg/convert/traces.go @@ -92,6 +92,9 @@ func TranslateTraceRequest(request *coltracepb.ExportTraceServiceRequest, ri Req break } } + if isUnknownInstance { + traceAttributes["resourceAttributes"]["instance"] = _unknown + } for _, librarySpan := range resourceSpan.ScopeSpans { scopeAttrs := getScopeAttributes(librarySpan.Scope) @@ -239,7 +242,7 @@ func TranslateTraceRequest(request *coltracepb.ExportTraceServiceRequest, ri Req traceAttributes["spanEventAttributes"]["traceId"] = traceID traceAttributes["spanEventAttributes"]["spanId"] = spanID traceAttributes["spanEventAttributes"]["trace_operation"] = span.Name - traceAttributes["spanEventAttributes"]["trace_instance"] = traceAttributes["resourceAttributes"]["instance"] + traceAttributes["spanEventAttributes"]["trace_instance"] = traceAttributes["spanAttributes"]["instance"] traceAttributes["spanEventAttributes"]["trace_service"] = traceAttributes["resourceAttributes"]["service_name"] spanEvents = append(spanEvents, SpanEvent{ Name: sevent.GetName(), diff --git a/pkg/libtrace/transmission/transmission.go b/pkg/libtrace/transmission/transmission.go index 79a67ad08..094263a43 100644 --- a/pkg/libtrace/transmission/transmission.go +++ b/pkg/libtrace/transmission/transmission.go @@ -514,7 +514,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { switch v := val.(type) { case nil: - b.logger.Error().Logf("resource attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("resource attribute value is nil for key: ", key) // here v has type interface{} case string: resourceAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type int case bool: @@ -522,7 +522,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: resourceAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("resource attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("resource attribute type unknown: %v", v) // here v has type interface{} } if key == "app" { @@ -538,7 +538,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { switch v := val.(type) { case nil: - b.logger.Error().Logf("span attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("span attribute value is nil for key: ", key) // here v has type interface{} case string: spanAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type int case bool: @@ -546,7 +546,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: spanAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("span attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("span attribute type unknown: %v", v) // here v has type interface{} } traceData.Data.SpanAttributes = append(traceData.Data.SpanAttributes, &spanAttrKeyVal) @@ -564,7 +564,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { switch v := val.(type) { case nil: - b.logger.Error().Logf("event attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("event attribute value is nil for key: ", key) // here v has type interface{} case string: eventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type int case bool: @@ -572,7 +572,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: eventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("event attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("event attribute type unknown: %v", v) // here v has type interface{} } traceData.Data.EventAttributes = append(traceData.Data.EventAttributes, &eventAttrKeyVal) @@ -587,7 +587,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { spanEventAttrKeyVal.Key = key switch v := val.(type) { case nil: - b.logger.Error().Logf("event attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("event attribute value is nil for key: ", key) // here v has type interface{} case string: spanEventAttrKeyVal.Value = &v11.AnyValue{Value: &v11.AnyValue_StringValue{StringValue: v}} // here v has type string case bool: @@ -595,7 +595,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: spanEventAttrKeyVal.Value = &v11.AnyValue{Value: &v11.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("event attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("event attribute type unknown: %v", v) // here v has type interface{} } recordAttributes = append(recordAttributes, spanEventAttrKeyVal) } @@ -652,7 +652,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { switch v := val.(type) { case nil: - b.logger.Error().Logf("resource attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("resource attribute value is nil for key: ", key) // here v has type interface{} case string: resourceAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type int case bool: @@ -660,7 +660,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: resourceAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("resource attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("resource attribute type unknown: %v", v) // here v has type interface{} } logtraceData.Data.ResourceAttributes = append(logtraceData.Data.ResourceAttributes, &resourceAttrKeyVal) } @@ -672,7 +672,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { switch v := val.(type) { case nil: - b.logger.Error().Logf("span attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("span attribute value is nil for key: ", key) // here v has type interface{} case string: spanAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type int case bool: @@ -680,7 +680,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: spanAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("span attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("span attribute type unknown: %v", v) // here v has type interface{} } logtraceData.Data.SpanAttributes = append(logtraceData.Data.SpanAttributes, &spanAttrKeyVal) @@ -698,7 +698,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { switch v := val.(type) { case nil: - b.logger.Error().Logf("event attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("event attribute value is nil for key: ", key) // here v has type interface{} case string: eventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type int case bool: @@ -706,7 +706,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: eventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("event attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("event attribute type unknown: %v", v) // here v has type interface{} } logtraceData.Data.EventAttributes = append(logtraceData.Data.EventAttributes, &eventAttrKeyVal) @@ -721,7 +721,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { spanEventAttrKeyVal.Key = key switch v := val.(type) { case nil: - b.logger.Error().Logf("event attribute value is nil for key: ", key) // here v has type interface{} + b.logger.Debug().Logf("event attribute value is nil for key: ", key) // here v has type interface{} case string: spanEventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_StringValue{StringValue: v}} // here v has type string case bool: @@ -729,7 +729,7 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { case int64: spanEventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_IntValue{IntValue: v}} // here v has type interface{} default: - b.logger.Error().Logf("event attribute type unknown: %v", v) // here v has type interface{} + b.logger.Debug().Logf("event attribute type unknown: %v", v) // here v has type interface{} } proxypbSpanEvent.SpanEventAttributes = append(proxypbSpanEvent.SpanEventAttributes, spanEventAttrKeyVal) } @@ -791,8 +791,6 @@ func (b *batchAgg) exportProtoMsgBatch(events []*Event) { if SendTraces { traceBatches := b.SendTraceBatches(traceReq, ctx) - b.logger.Debug().Logf("numer of batches: %v", (len(traceBatches))) - for _, batch := range traceBatches { traceReq.Items = batch b.ExportTraces(traceReq, ctx) @@ -950,8 +948,6 @@ func (b *batchAgg) SendTraceBatches(traceReq proxypb.ExportTraceProxyServiceRequ func (b *batchAgg) ExportTraces(traceReq proxypb.ExportTraceProxyServiceRequest, ctx context.Context) { - b.logger.Debug().Logf("Hitting the ExportTraceProxy function") - b.logger.Debug().Logf("if you didnt receive success msg in some time try to ping apiHost once") r, err := b.conn.GetTraceClient().ExportTraceProxy(ctx, &traceReq) if st, ok := status.FromError(err); ok { if st.Code() != codes.OK {