We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by @chalin in #5610 (review)
@jack-berg - if I execute npm run code-excerpts, then I get the following page updates:
npm run code-excerpts
diff --git a/content/en/docs/languages/go/getting-started.md b/content/en/docs/languages/go/getting-started.md index 0294d82c..b122280a 100644 --- a/content/en/docs/languages/go/getting-started.md +++ b/content/en/docs/languages/go/getting-started.md @@ -377,25 +377,22 @@ Modify `rolldice.go` to include custom instrumentation using OpenTelemetry API: package main import ( - "fmt" - "io" - "log" - "math/rand" - "net/http" - "strconv" - "go.opentelemetry.io/contrib/bridges/otelslog" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/sdk/instrumentation" ) -const name = "go.opentelemetry.io/otel/example/dice" +const name = "rolldice" var ( tracer = otel.Tracer(name) meter = otel.Meter(name) - logger = otelslog.NewLogger(name) + logger = otelslog.NewLogger( + otelslog.WithInstrumentationScope(instrumentation.Scope{ + Name: name, + }), + ) rollCnt metric.Int64Counter ) @@ -408,30 +405,6 @@ func init() { panic(err) } } - -func rolldice(w http.ResponseWriter, r *http.Request) { - ctx, span := tracer.Start(r.Context(), "roll") - defer span.End() - - roll := 1 + rand.Intn(6) - - var msg string - if player := r.PathValue("player"); player != "" { - msg = fmt.Sprintf("%s is rolling the dice", player) - } else { - msg = "Anonymous player is rolling the dice" - } - logger.InfoContext(ctx, msg, "result", roll) - - rollValueAttr := attribute.Int("roll.value", roll) - span.SetAttributes(rollValueAttr) - rollCnt.Add(ctx, 1, metric.WithAttributes(rollValueAttr)) - - resp := strconv.Itoa(roll) + "\n" - if _, err := io.WriteString(w, resp); err != nil { - log.Printf("Write failed: %v\n", err) - } -} ``` <!-- prettier-ignore-end -->
Is this expected?
Related: #5276 (comment), @svrnm wrote:
Go can currently not be updated due to https://github.com/open-telemetry/opentelemetry-go/issues/5812, I think you can safely revert that change. @chalin, PTAL as well
Go can currently not be updated due to https://github.com/open-telemetry/opentelemetry-go/issues/5812, I think you can safely revert that change.
@chalin, PTAL as well
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Originally posted by @chalin in #5610 (review)
@jack-berg - if I execute
npm run code-excerpts
, then I get the following page updates:diff --git a/content/en/docs/languages/go/getting-started.md ...
Is this expected?
Related: #5276 (comment), @svrnm wrote:
The text was updated successfully, but these errors were encountered: