Skip to content

Commit 4a4839c

Browse files
Merge branch 'main' into remove_apac_enduser_discussions
2 parents 9a468ef + c1126f1 commit 4a4839c

21 files changed

+1124
-291
lines changed

archetypes/blog.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ author: >- # If you have only one author, then add the single name on this line
99
draft: true # TODO: remove this line once your post is ready to be published
1010
# canonical_url: http://somewhere.else/ # TODO: if this blog post has been posted somewhere else already, uncomment & provide the canonical URL here.
1111
body_class: otel-with-contributions-from # TODO: remove this line if there are no secondary contributing authors
12+
issue: the issue ID for this blog post # TODO: See https://opentelemetry.io/docs/contributing/blog/ for details
13+
sig: SIG Name # TODO: add the name of the SIG that sponsors this blog post
1214
---
1315

1416
<!-- If your post doesn't have secondary authors, then delete the following paragraph: -->

assets/scss/_styles_project.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
}
185185

186186
details {
187-
background-color: $gray-100;
187+
background-color: var(--bs-tertiary-bg);
188188
margin-bottom: 0.5em;
189189

190190
summary {

content/en/_index.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@ title: OpenTelemetry
33
description: >-
44
High-quality, ubiquitous, and portable telemetry to enable effective
55
observability
6-
show_banner: true
76
outputs:
87
- HTML
98
- REDIRECTS # Include this `content/en` ONLY
109
developer_note:
1110
The blocks/cover shortcode (used below) will use as a background image any
1211
image file containing "background" in its name.
12+
show_banner: true
13+
limit_banner: 2 # Default to 2, adjust as needed
14+
banners:
15+
- message:
16+
'<i class="fas fa-bullhorn"></i> Join us for [**OTel Community Day** on
17+
June
18+
25th](https://events.linuxfoundation.org/open-telemetry-community-day/)!'
19+
to: 2024-06-25
20+
- message:
21+
'<i class="fas fa-bullhorn"></i> Help improve OTel and Prometheus
22+
interoperability: [complete our
23+
survey](https://forms.gle/bZAG9f7udoJsjZUG9) by May 31'
24+
to: 2024-05-31
1325
---
1426

1527
<div class="d-none"><a rel="me" href="https://fosstodon.org/@opentelemetry"></a></div>

content/en/docs/collector/internal-telemetry.md

+163-15
Large diffs are not rendered by default.

content/en/docs/contributing/blog.md

+36-15
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@ weight: 30
66

77
The [OpenTelemetry blog](/blog/) communicates new features, community reports,
88
and any news that might be relevant to the OpenTelemetry community. This
9-
includes end users and developers. Anyone can write a blog post and submit it
10-
for review.
9+
includes end users and developers. Anyone can write a blog post, read below what
10+
the requirements are.
11+
12+
## Documentation or blog post?
13+
14+
Before writing a blog post, ask yourself if your content also might be a good
15+
addition to the documentation. If the answer is "yes", create a new issue or
16+
pull request (PR) with your content to get it added to the docs.
17+
18+
Note, that the focus of maintainers and approvers of the OpenTelemetry Website
19+
is to improve the documentation of the project, so your blog post will have a
20+
lower priority for review.
1121

1222
## Before submitting a blog post
1323

1424
Blog posts should not be commercial in nature and should consist of original
15-
content that applies broadly to the OpenTelemetry community.
25+
content that applies broadly to the OpenTelemetry community. Blog posts should
26+
follow the policies outlined in the
27+
[Social Media Guide](https://github.com/open-telemetry/community/blob/main/social-media-guide.md).
1628

1729
Verify that your intended content broadly applies to the OpenTelemetry Community
1830
. Appropriate content includes:
@@ -27,15 +39,28 @@ Unsuitable content includes:
2739

2840
- Vendor product pitches
2941

30-
To submit a blog post,
42+
If your blog post fits into the list of appropriate content,
3143
[raise an issue](https://github.com/open-telemetry/opentelemetry.io/issues/new?title=New%20Blog%20Post:%20%3Ctitle%3E)
32-
with the title and a short description of your blog post. If you are not a
33-
[Member](https://github.com/open-telemetry/community/blob/main/community-membership.md#member),
34-
you also need to provide a _sponsor_ for your blog post, who is a Member (by
35-
that definition) and who is willing to provide a first review of your blog post.
36-
37-
If you do not raise an issue before providing your PR, we may request you to do
38-
so before providing a review.
44+
with the following details:
45+
46+
- Title of the blog post
47+
- Short description and outline of your blog post
48+
- If applicable, list the technologies used in your blog post. Make sure that
49+
all of them are open source, and prefer CNCF projects over non-CNCF projects
50+
(e.g. use Jaeger for trace visualization, and Prometheus for metric
51+
visualization)
52+
- Name of a [SIG](https://github.com/open-telemetry/community/), which is
53+
related to this blog post
54+
- Name of a sponsor (maintainer or approver) from this SIG, who will help to
55+
review that PR
56+
57+
Maintainers of SIG Communication will verify, that your blog post satisfies all
58+
the requirements for being accepted. If you can not name a SIG/sponsor in your
59+
initial issue details, they will also point you to an appropriate SIG, you can
60+
reach out to for sponsorship.
61+
62+
If your issue has everything needed, a maintainer will verify that you can go
63+
ahead and submit your blog post.
3964

4065
## Submit a blog post
4166

@@ -44,10 +69,6 @@ locally or by using the GitHub UI. In both cases we ask you to follow the
4469
instructions provided by the
4570
[blog post template](https://github.com/open-telemetry/opentelemetry.io/tree/main/archetypes/blog.md).
4671

47-
**Note**: Before writing a blog post, ask yourself if your content also might be
48-
a good addition to the documentation. If the answer is "yes", create a new issue
49-
or pull request (PR) with your content to get it added to the docs.
50-
5172
### Fork and write locally
5273

5374
After you've set up the local fork you can create a blog post using a template.

content/en/docs/languages/go/getting-started.md

+139-14
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ cSpell:ignore: chan fatalln funcs intn itoa khtml otelhttp rolldice stdouttrace
1111
This page will show you how to get started with OpenTelemetry in Go.
1212

1313
You will learn how you can instrument a simple application manually, in such a
14-
way that [traces][] and [metrics][] are emitted to the console.
14+
way that [traces][], [metrics][], and [logs][] are emitted to the console.
15+
16+
{{% alert title="Note" %}}
17+
18+
The logs signal is still experimental. Breaking changes may be introduced in
19+
future versions.
20+
21+
{{% /alert %}}
1522

1623
## Prerequisites
1724

1825
Ensure that you have the following installed locally:
1926

20-
- [Go](https://go.dev/)
27+
- [Go](https://go.dev/) 1.22 or greater
2128

2229
## Example application
2330

@@ -135,9 +142,12 @@ import (
135142
"time"
136143

137144
"go.opentelemetry.io/otel"
145+
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
138146
"go.opentelemetry.io/otel/exporters/stdout/stdoutmetric"
139147
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
148+
"go.opentelemetry.io/otel/log/global"
140149
"go.opentelemetry.io/otel/propagation"
150+
"go.opentelemetry.io/otel/sdk/log"
141151
"go.opentelemetry.io/otel/sdk/metric"
142152
"go.opentelemetry.io/otel/sdk/trace"
143153
)
@@ -186,6 +196,15 @@ func setupOTelSDK(ctx context.Context) (shutdown func(context.Context) error, er
186196
shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown)
187197
otel.SetMeterProvider(meterProvider)
188198

199+
// Set up logger provider.
200+
loggerProvider, err := newLoggerProvider()
201+
if err != nil {
202+
handleErr(err)
203+
return
204+
}
205+
shutdownFuncs = append(shutdownFuncs, loggerProvider.Shutdown)
206+
global.SetLoggerProvider(loggerProvider)
207+
189208
return
190209
}
191210

@@ -224,6 +243,18 @@ func newMeterProvider() (*metric.MeterProvider, error) {
224243
)
225244
return meterProvider, nil
226245
}
246+
247+
func newLoggerProvider() (*log.LoggerProvider, error) {
248+
logExporter, err := stdoutlog.New()
249+
if err != nil {
250+
return nil, err
251+
}
252+
253+
loggerProvider := log.NewLoggerProvider(
254+
log.WithProcessor(log.NewBatchProcessor(logExporter)),
255+
)
256+
return loggerProvider, nil
257+
}
227258
```
228259
<!-- prettier-ignore-end -->
229260

@@ -318,7 +349,8 @@ func newHTTPHandler() http.Handler {
318349
}
319350

320351
// Register handlers.
321-
handleFunc("/rolldice", rolldice)
352+
handleFunc("/rolldice/", rolldice)
353+
handleFunc("/rolldice/{player}", rolldice)
322354

323355
// Add HTTP instrumentation for the whole server.
324356
handler := otelhttp.NewHandler(mux, "/")
@@ -348,14 +380,23 @@ import (
348380
"net/http"
349381
"strconv"
350382

383+
"go.opentelemetry.io/contrib/bridges/otelslog"
351384
"go.opentelemetry.io/otel"
352385
"go.opentelemetry.io/otel/attribute"
353386
"go.opentelemetry.io/otel/metric"
387+
"go.opentelemetry.io/otel/sdk/instrumentation"
354388
)
355389

390+
const name = "rolldice"
391+
356392
var (
357-
tracer = otel.Tracer("rolldice")
358-
meter = otel.Meter("rolldice")
393+
tracer = otel.Tracer(name)
394+
meter = otel.Meter(name)
395+
logger = otelslog.NewLogger(
396+
otelslog.WithInstrumentationScope(instrumentation.Scope{
397+
Name: name,
398+
}),
399+
)
359400
rollCnt metric.Int64Counter
360401
)
361402

@@ -375,6 +416,14 @@ func rolldice(w http.ResponseWriter, r *http.Request) {
375416

376417
roll := 1 + rand.Intn(6)
377418

419+
var msg string
420+
if player := r.PathValue("player"); player != "" {
421+
msg = fmt.Sprintf("%s is rolling the dice", player)
422+
} else {
423+
msg = "Anonymous player is rolling the dice"
424+
}
425+
logger.InfoContext(ctx, msg, "result", roll)
426+
378427
rollValueAttr := attribute.Int("roll.value", roll)
379428
span.SetAttributes(rollValueAttr)
380429
rollCnt.Add(ctx, 1, metric.WithAttributes(rollValueAttr))
@@ -400,11 +449,11 @@ export OTEL_RESOURCE_ATTRIBUTES="service.name=dice,service.version=0.1.0"
400449
go run .
401450
```
402451

403-
Open <http://localhost:8080/rolldice> in your web browser. When you send a
452+
Open <http://localhost:8080/rolldice/Alice> in your web browser. When you send a
404453
request to the server, you'll see two spans in the trace emitted to the console.
405454
The span generated by the instrumentation library tracks the lifetime of a
406-
request to the `/rolldice` route. The span called `roll` is created manually and
407-
it is a child of the previously mentioned span.
455+
request to the `/rolldice/{player}` route. The span called `roll` is created
456+
manually and it is a child of the previously mentioned span.
408457

409458
<details>
410459
<summary>View example output</summary>
@@ -571,7 +620,7 @@ it is a child of the previously mentioned span.
571620
"Key": "http.route",
572621
"Value": {
573622
"Type": "STRING",
574-
"Value": "/rolldice"
623+
"Value": "/rolldice/Alice"
575624
}
576625
},
577626
{
@@ -646,8 +695,83 @@ it is a child of the previously mentioned span.
646695

647696
</details>
648697

649-
Refresh the <http://localhost:8080/rolldice> page a few times, and then either
650-
wait for a little bit or terminate the app and you'll see metrics as in the
698+
Along with the trace, log messages are emitted to the console.
699+
700+
<details>
701+
<summary>View example output</summary>
702+
703+
```json
704+
{
705+
"Timestamp": "2023-09-25T12:42:05.177136776+02:00",
706+
"ObservedTimestamp": "2023-09-25T12:42:06.809396011+02:00",
707+
"Severity": 9,
708+
"SeverityText": "",
709+
"Body": {
710+
"Type": "String",
711+
"Value": "Alice is rolling the dice"
712+
},
713+
"Attributes": [
714+
{
715+
"Key": "result",
716+
"Value": {
717+
"Type": "Int64",
718+
"Value": 6
719+
}
720+
}
721+
],
722+
"TraceID": "829fb7ceb787403c96eac3caf285c965",
723+
"SpanID": "8b6b408b6c1a35e5",
724+
"TraceFlags": "01",
725+
"Resource": [
726+
{
727+
"Key": "service.name",
728+
"Value": {
729+
"Type": "STRING",
730+
"Value": "dice"
731+
}
732+
},
733+
{
734+
"Key": "service.version",
735+
"Value": {
736+
"Type": "STRING",
737+
"Value": "0.1.0"
738+
}
739+
},
740+
{
741+
"Key": "telemetry.sdk.language",
742+
"Value": {
743+
"Type": "STRING",
744+
"Value": "go"
745+
}
746+
},
747+
{
748+
"Key": "telemetry.sdk.name",
749+
"Value": {
750+
"Type": "STRING",
751+
"Value": "opentelemetry"
752+
}
753+
},
754+
{
755+
"Key": "telemetry.sdk.version",
756+
"Value": {
757+
"Type": "STRING",
758+
"Value": "1.19.0-rc.1"
759+
}
760+
}
761+
],
762+
"Scope": {
763+
"Name": "rolldice",
764+
"Version": "",
765+
"SchemaURL": ""
766+
},
767+
"DroppedAttributes": 0
768+
}
769+
```
770+
771+
</details>
772+
773+
Refresh the <http://localhost:8080/rolldice/Alice> page a few times, and then
774+
either wait a little or terminate the app and you'll see metrics as in the
651775
console output. You'll see the `dice.rolls` metric emitted to the console, with
652776
separate counts for each roll value, as well as the HTTP metrics generated by
653777
the instrumentation library.
@@ -832,7 +956,7 @@ the instrumentation library.
832956
"Key": "http.route",
833957
"Value": {
834958
"Type": "STRING",
835-
"Value": "/rolldice"
959+
"Value": "/rolldice/Alice"
836960
}
837961
},
838962
{
@@ -899,7 +1023,7 @@ the instrumentation library.
8991023
"Key": "http.route",
9001024
"Value": {
9011025
"Type": "STRING",
902-
"Value": "/rolldice"
1026+
"Value": "/rolldice/Alice"
9031027
}
9041028
},
9051029
{
@@ -966,7 +1090,7 @@ the instrumentation library.
9661090
"Key": "http.route",
9671091
"Value": {
9681092
"Type": "STRING",
969-
"Value": "/rolldice"
1093+
"Value": "/rolldice/Alice"
9701094
}
9711095
},
9721096
{
@@ -1041,3 +1165,4 @@ If you'd like to explore a more complex example, take a look at the
10411165

10421166
[traces]: /docs/concepts/signals/traces/
10431167
[metrics]: /docs/concepts/signals/metrics/
1168+
[logs]: /docs/concepts/signals/logs/

0 commit comments

Comments
 (0)