-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
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
Java documentation for cardinality limits #5610
Java documentation for cardinality limits #5610
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but I am just double checking that updating the opentelemetry-java-examples submodule is on purpose?
d37c394
to
afbd59d
Compare
c65922a
to
ef490d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 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?
@chalin we've run into this question before here: #5276 (comment) Every time I run
|
Sigh, right. Let me create an issue for that. |
The issue is: And the PR to implement your first proposition @jack-berg is: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the Go code excerpt issue (#5629) is orthogonal to this PR's purpose, and it being treated separately, this PR is a go for me!
2b66879
to
0fbce49
Compare
Co-authored-by: Patrice Chalin <[email protected]>
Co-authored-by: Patrice Chalin <[email protected]>
Followup to #5566.