Skip to content

Commit 69314d9

Browse files
chalincartermp
andauthored
[CI] Add markdown check for normalized code-blocks + .md page fixes (#3177)
Co-authored-by: Phillip Carter <[email protected]>
1 parent bc4a1ca commit 69314d9

28 files changed

+383
-272
lines changed

.markdownlint.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
"no-emphasis-as-header": false,
77
"no-hard-tabs": false,
88
"no-inline-html": false,
9-
"no-trailing-punctuation": false
9+
"no-trailing-punctuation": false,
10+
"no-trailing-spaces": true,
11+
"custom-rules-below-this-point": false,
12+
"trim-code-block-and-unindent": true
1013
}

content/en/blog/2022/k8s-otel-expose/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ my-in-memory-query ClusterIP 10.245.91.239 <none>
198198
otel-collector-app-collector ClusterIP 10.245.5.134 <none> 4317/TCP 5m
199199
otel-collector-app-collector-headless ClusterIP None <none> 4317/TCP 5m
200200
otel-collector-app-collector-monitoring ClusterIP 10.245.116.38 <none> 8888/TCP 5m
201-
202201
```
203202

204203
Finally, cert-manager is configured to automatically request TLS certificates

content/en/docs/collector/build-connector.md

-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ func (c *connectorImp) ConsumeTraces(ctx context.Context, td ptrace.Traces) erro
464464
}
465465
return nil
466466
}
467-
468467
```
469468

470469
## Using the Component

content/en/docs/collector/scaling.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -282,34 +282,34 @@ After the reconciliation, the OpenTelemetry Operator will convert the
282282
Collector’s configuration into the following:
283283
284284
```yaml
285-
exporters:
286-
logging: null
287-
receivers:
288-
prometheus:
289-
config:
290-
global:
291-
scrape_interval: 1m
292-
scrape_timeout: 10s
293-
evaluation_interval: 1m
294-
scrape_configs:
295-
- job_name: otel-collector
296-
honor_timestamps: true
297-
scrape_interval: 10s
298-
scrape_timeout: 10s
299-
metrics_path: /metrics
300-
scheme: http
301-
follow_redirects: true
302-
http_sd_configs:
303-
- follow_redirects: false
304-
url: http://collector-with-ta-targetallocator:80/jobs/otel-collector/targets?collector_id=$POD_NAME
305-
service:
306-
pipelines:
307-
traces:
308-
exporters:
309-
- logging
310-
processors: []
311-
receivers:
312-
- prometheus
285+
exporters:
286+
logging: null
287+
receivers:
288+
prometheus:
289+
config:
290+
global:
291+
scrape_interval: 1m
292+
scrape_timeout: 10s
293+
evaluation_interval: 1m
294+
scrape_configs:
295+
- job_name: otel-collector
296+
honor_timestamps: true
297+
scrape_interval: 10s
298+
scrape_timeout: 10s
299+
metrics_path: /metrics
300+
scheme: http
301+
follow_redirects: true
302+
http_sd_configs:
303+
- follow_redirects: false
304+
url: http://collector-with-ta-targetallocator:80/jobs/otel-collector/targets?collector_id=$POD_NAME
305+
service:
306+
pipelines:
307+
traces:
308+
exporters:
309+
- logging
310+
processors: []
311+
receivers:
312+
- prometheus
313313
```
314314
315315
Note how the Operator added a `global` section and a `new http_sd_configs` to

content/en/docs/demo/services/accounting.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ ensure all spans are exported. This service makes that call as part of a
4040
deferred function in main
4141

4242
```go
43-
tp, err := initTracerProvider()
44-
if err != nil {
45-
log.Fatal(err)
43+
tp, err := initTracerProvider()
44+
if err != nil {
45+
log.Fatal(err)
46+
}
47+
defer func() {
48+
if err := tp.Shutdown(context.Background()); err != nil {
49+
log.Printf("Error shutting down tracer provider: %v", err)
4650
}
47-
defer func() {
48-
if err := tp.Shutdown(context.Background()); err != nil {
49-
log.Printf("Error shutting down tracer provider: %v", err)
50-
}
51-
}()
51+
}()
5252
```
5353

5454
### Adding Kafka ( Sarama ) auto-instrumentation
@@ -58,6 +58,6 @@ Kafka topic. To instrument the Kafka client the ConsumerHandler implemented by
5858
the developer has to be wrapped.
5959

6060
```go
61-
handler := groupHandler{} // implements sarama.ConsumerGroupHandler
62-
wrappedHandler := otelsarama.WrapConsumerGroupHandler(&handler)
61+
handler := groupHandler{} // implements sarama.ConsumerGroupHandler
62+
wrappedHandler := otelsarama.WrapConsumerGroupHandler(&handler)
6363
```

content/en/docs/demo/services/ad.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ Within the execution of auto-instrumented code you can get current span from
2929
context.
3030

3131
```java
32-
Span span = Span.current();
32+
Span span = Span.current();
3333
```
3434

3535
Adding attributes to a span is accomplished using `setAttribute` on the span
3636
object. In the `getAds` function multiples attribute are added to the span.
3737

3838
```java
39-
span.setAttribute("app.ads.contextKeys", req.getContextKeysList().toString());
40-
span.setAttribute("app.ads.contextKeys.count", req.getContextKeysCount());
39+
span.setAttribute("app.ads.contextKeys", req.getContextKeysList().toString());
40+
span.setAttribute("app.ads.contextKeys.count", req.getContextKeysCount());
4141
```
4242

4343
### Add span events
@@ -47,7 +47,7 @@ In the `getAds` function an event with an attribute is added when an exception
4747
is caught.
4848

4949
```java
50-
span.addEvent("Error", Attributes.of(AttributeKey.stringKey("exception.message"), e.getMessage()));
50+
span.addEvent("Error", Attributes.of(AttributeKey.stringKey("exception.message"), e.getMessage()));
5151
```
5252

5353
### Setting span status
@@ -57,7 +57,7 @@ accordingly using `setStatus` on the span object. In the `getAds` function the
5757
span status is set when an exception is caught.
5858

5959
```java
60-
span.setStatus(StatusCode.ERROR);
60+
span.setStatus(StatusCode.ERROR);
6161
```
6262

6363
### Create new spans
@@ -68,22 +68,22 @@ into context using `Span.makeCurrent()`. The `getRandomAds` function will create
6868
a new span, set it into context, perform an operation, and finally end the span.
6969

7070
```java
71-
// create and start a new span manually
72-
Tracer tracer = GlobalOpenTelemetry.getTracer("adservice");
73-
Span span = tracer.spanBuilder("getRandomAds").startSpan();
74-
75-
// put the span into context, so if any child span is started the parent will be set properly
76-
try (Scope ignored = span.makeCurrent()) {
77-
78-
Collection<Ad> allAds = adsMap.values();
79-
for (int i = 0; i < MAX_ADS_TO_SERVE; i++) {
80-
ads.add(Iterables.get(allAds, random.nextInt(allAds.size())));
81-
}
82-
span.setAttribute("app.ads.count", ads.size());
83-
84-
} finally {
85-
span.end();
86-
}
71+
// create and start a new span manually
72+
Tracer tracer = GlobalOpenTelemetry.getTracer("adservice");
73+
Span span = tracer.spanBuilder("getRandomAds").startSpan();
74+
75+
// put the span into context, so if any child span is started the parent will be set properly
76+
try (Scope ignored = span.makeCurrent()) {
77+
78+
Collection<Ad> allAds = adsMap.values();
79+
for (int i = 0; i < MAX_ADS_TO_SERVE; i++) {
80+
ads.add(Iterables.get(allAds, random.nextInt(allAds.size())));
81+
}
82+
span.setAttribute("app.ads.count", ads.size());
83+
84+
} finally {
85+
span.end();
86+
}
8787
```
8888

8989
## Metrics

content/en/docs/demo/services/cart.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Within the execution of auto-instrumented code you can get current span
4444
(activity) from context.
4545

4646
```cs
47-
var activity = Activity.Current;
47+
var activity = Activity.Current;
4848
```
4949

5050
Adding attributes (tags in .NET) to a span (activity) is accomplished using
@@ -53,9 +53,9 @@ Adding attributes (tags in .NET) to a span (activity) is accomplished using
5353
span.
5454

5555
```cs
56-
activity?.SetTag("app.user.id", request.UserId);
57-
activity?.SetTag("app.product.quantity", request.Item.Quantity);
58-
activity?.SetTag("app.product.id", request.Item.ProductId);
56+
activity?.SetTag("app.user.id", request.UserId);
57+
activity?.SetTag("app.product.quantity", request.Item.Quantity);
58+
activity?.SetTag("app.product.id", request.Item.ProductId);
5959
```
6060

6161
### Add span events
@@ -65,7 +65,7 @@ object. In the `GetCart` function from `services/CartService.cs` a span event is
6565
added.
6666

6767
```cs
68-
activity?.AddEvent(new("Fetch cart"));
68+
activity?.AddEvent(new("Fetch cart"));
6969
```
7070

7171
## Metrics

content/en/docs/demo/services/checkout.md

+36-36
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ ensure all spans are exported. This service makes that call as part of a
4141
deferred function in main
4242

4343
```go
44-
tp := initTracerProvider()
45-
defer func() {
46-
if err := tp.Shutdown(context.Background()); err != nil {
47-
log.Printf("Error shutting down tracer provider: %v", err)
48-
}
49-
}()
44+
tp := initTracerProvider()
45+
defer func() {
46+
if err := tp.Shutdown(context.Background()); err != nil {
47+
log.Printf("Error shutting down tracer provider: %v", err)
48+
}
49+
}()
5050
```
5151

5252
### Adding gRPC auto-instrumentation
@@ -55,10 +55,10 @@ This service receives gRPC requests, which are instrumented in the main function
5555
as part of the gRPC server creation.
5656

5757
```go
58-
var srv = grpc.NewServer(
59-
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()),
60-
grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()),
61-
)
58+
var srv = grpc.NewServer(
59+
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()),
60+
grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()),
61+
)
6262
```
6363

6464
This service will issue several outgoing gRPC calls, which are all instrumented
@@ -81,12 +81,12 @@ be in turn be processed by other microservices. To instrument the Kafka client
8181
the Producer has to be wrapped after it has been created.
8282

8383
```go
84-
saramaConfig := sarama.NewConfig()
85-
producer, err := sarama.NewAsyncProducer(brokers, saramaConfig)
86-
if err != nil {
87-
return nil, err
88-
}
89-
producer = otelsarama.WrapAsyncProducer(saramaConfig, producer)
84+
saramaConfig := sarama.NewConfig()
85+
producer, err := sarama.NewAsyncProducer(brokers, saramaConfig)
86+
if err != nil {
87+
return nil, err
88+
}
89+
producer = otelsarama.WrapAsyncProducer(saramaConfig, producer)
9090
```
9191

9292
### Add attributes to auto-instrumented spans
@@ -95,19 +95,19 @@ Within the execution of auto-instrumented code you can get current span from
9595
context.
9696

9797
```go
98-
span := trace.SpanFromContext(ctx)
98+
span := trace.SpanFromContext(ctx)
9999
```
100100

101101
Adding attributes to a span is accomplished using `SetAttributes` on the span
102102
object. In the `PlaceOrder` function several attributes are added to the span.
103103

104104
```go
105-
span.SetAttributes(
106-
attribute.String("app.order.id", orderID.String()), shippingTrackingAttribute,
107-
attribute.Float64("app.shipping.amount", shippingCostFloat),
108-
attribute.Float64("app.order.amount", totalPriceFloat),
109-
attribute.Int("app.order.items.count", len(prep.orderItems)),
110-
)
105+
span.SetAttributes(
106+
attribute.String("app.order.id", orderID.String()), shippingTrackingAttribute,
107+
attribute.Float64("app.shipping.amount", shippingCostFloat),
108+
attribute.Float64("app.order.amount", totalPriceFloat),
109+
attribute.Int("app.order.items.count", len(prep.orderItems)),
110+
)
111111
```
112112

113113
### Add span events
@@ -119,14 +119,14 @@ attributes, others do not.
119119
Adding a span event without attributes:
120120

121121
```go
122-
span.AddEvent("prepared")
122+
span.AddEvent("prepared")
123123
```
124124

125125
Adding a span event with additional attributes:
126126

127127
```go
128-
span.AddEvent("charged",
129-
trace.WithAttributes(attribute.String("app.payment.transaction.id", txID)))
128+
span.AddEvent("charged",
129+
trace.WithAttributes(attribute.String("app.payment.transaction.id", txID)))
130130
```
131131

132132
## Metrics
@@ -156,23 +156,23 @@ ensure all records are exported. This service makes that call as part of a
156156
deferred function in main
157157

158158
```go
159-
mp := initMeterProvider()
160-
defer func() {
161-
if err := mp.Shutdown(context.Background()); err != nil {
162-
log.Printf("Error shutting down meter provider: %v", err)
163-
}
164-
}()
159+
mp := initMeterProvider()
160+
defer func() {
161+
if err := mp.Shutdown(context.Background()); err != nil {
162+
log.Printf("Error shutting down meter provider: %v", err)
163+
}
164+
}()
165165
```
166166

167167
### Adding golang runtime auto-instrumentation
168168

169169
Golang runtime are instrumented in the main function
170170

171171
```go
172-
err := runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
173-
if err != nil {
174-
log.Fatal(err)
175-
}
172+
err := runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
173+
if err != nil {
174+
log.Fatal(err)
175+
}
176176
```
177177

178178
## Logs

0 commit comments

Comments
 (0)