Skip to content

Commit

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

package tracing

import (
"github.com/cloudwego/hertz/pkg/common/tracer/stats"
"github.com/cloudwego/hertz/pkg/common/tracer/traceinfo"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)

var commonEvents = map[string]stats.Event{
"http_start": stats.HTTPStart,
"http_finish": stats.HTTPFinish,
"server_handle_start": stats.ServerHandleStart,
"server_handle_finish": stats.ServerHandleFinish,
"read_header_start": stats.ReadHeaderStart,
"read_header_finish": stats.ReadHeaderFinish,
"read_body_start": stats.ReadBodyStart,
"read_body_finish": stats.ReadBodyFinish,
"write_start": stats.WriteStart,
"write_finish": stats.WriteFinish,
}

func injectStatsEventsToSpan(span trace.Span, st traceinfo.HTTPStats) {
for name, event := range commonEvents {
if gotEvent := st.GetEvent(event); gotEvent != nil {
attrs := []attribute.KeyValue{attribute.Int("event.status", int(gotEvent.Status()))}
if gotEvent.Info() != "" {
attrs = append(attrs, attribute.String("event.info", gotEvent.Info()))
}
span.AddEvent(name,
trace.WithTimestamp(gotEvent.Time()),
trace.WithAttributes(attrs...),
)
}
}
}
4 changes: 0 additions & 4 deletions tracing/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import (
"go.opentelemetry.io/otel/propagation"
)

const (
instrumentationName = "github.com/hertz-contrib/obs-opentelemetry"
)

// Option opts for opentelemetry tracer provider
type Option = otelhertz.Option

Expand Down

0 comments on commit e92447c

Please sign in to comment.