Skip to content

Commit

Permalink
changing few log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
saikalyan.bhagavathula committed May 24, 2024
1 parent 3b1ce21 commit 51b6593
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
5 changes: 4 additions & 1 deletion pkg/convert/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(),
Expand Down
36 changes: 16 additions & 20 deletions pkg/libtrace/transmission/transmission.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,15 @@ 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:
resourceAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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" {
Expand All @@ -538,15 +538,15 @@ 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:
spanAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
Expand All @@ -564,15 +564,15 @@ 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:
eventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
Expand All @@ -587,15 +587,15 @@ 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:
spanEventAttrKeyVal.Value = &v11.AnyValue{Value: &v11.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
}
Expand Down Expand Up @@ -652,15 +652,15 @@ 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:
resourceAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
}
Expand All @@ -672,15 +672,15 @@ 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:
spanAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
Expand All @@ -698,15 +698,15 @@ 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:
eventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
Expand All @@ -721,15 +721,15 @@ 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:
spanEventAttrKeyVal.Value = &proxypb.AnyValue{Value: &proxypb.AnyValue_BoolValue{BoolValue: v}} // here v has type interface{}
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)
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 51b6593

Please sign in to comment.