Skip to content

Commit

Permalink
[CI] Add markdown check for normalized code-blocks + .md page fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Aug 14, 2023
1 parent f5b7c14 commit 8140780
Show file tree
Hide file tree
Showing 28 changed files with 378 additions and 272 deletions.
5 changes: 4 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"no-emphasis-as-header": false,
"no-hard-tabs": false,
"no-inline-html": false,
"no-trailing-punctuation": false
"no-trailing-punctuation": false,
"no-trailing-spaces": true,
"custom-rules-below-this-point": false,
"trim-code-block-and-unindent": true
}
1 change: 0 additions & 1 deletion content/en/blog/2022/k8s-otel-expose/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ my-in-memory-query ClusterIP 10.245.91.239 <none>
otel-collector-app-collector ClusterIP 10.245.5.134 <none> 4317/TCP 5m
otel-collector-app-collector-headless ClusterIP None <none> 4317/TCP 5m
otel-collector-app-collector-monitoring ClusterIP 10.245.116.38 <none> 8888/TCP 5m
```

Finally, cert-manager is configured to automatically request TLS certificates
Expand Down
1 change: 0 additions & 1 deletion content/en/docs/collector/build-connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ func (c *connectorImp) ConsumeTraces(ctx context.Context, td ptrace.Traces) erro
}
return nil
}
```

## Using the Component
Expand Down
56 changes: 28 additions & 28 deletions content/en/docs/collector/scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,34 +282,34 @@ After the reconciliation, the OpenTelemetry Operator will convert the
Collector’s configuration into the following:
```yaml
exporters:
logging: null
receivers:
prometheus:
config:
global:
scrape_interval: 1m
scrape_timeout: 10s
evaluation_interval: 1m
scrape_configs:
- job_name: otel-collector
honor_timestamps: true
scrape_interval: 10s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
follow_redirects: true
http_sd_configs:
- follow_redirects: false
url: http://collector-with-ta-targetallocator:80/jobs/otel-collector/targets?collector_id=$POD_NAME
service:
pipelines:
traces:
exporters:
- logging
processors: []
receivers:
- prometheus
exporters:
logging: null
receivers:
prometheus:
config:
global:
scrape_interval: 1m
scrape_timeout: 10s
evaluation_interval: 1m
scrape_configs:
- job_name: otel-collector
honor_timestamps: true
scrape_interval: 10s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
follow_redirects: true
http_sd_configs:
- follow_redirects: false
url: http://collector-with-ta-targetallocator:80/jobs/otel-collector/targets?collector_id=$POD_NAME
service:
pipelines:
traces:
exporters:
- logging
processors: []
receivers:
- prometheus
```
Note how the Operator added a `global` section and a `new http_sd_configs` to
Expand Down
20 changes: 10 additions & 10 deletions content/en/docs/demo/services/accounting.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ ensure all spans are exported. This service makes that call as part of a
deferred function in main

```go
tp, err := initTracerProvider()
if err != nil {
log.Fatal(err)
tp, err := initTracerProvider()
if err != nil {
log.Fatal(err)
}
defer func() {
if err := tp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down tracer provider: %v", err)
}
defer func() {
if err := tp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down tracer provider: %v", err)
}
}()
}()
```

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

```go
handler := groupHandler{} // implements sarama.ConsumerGroupHandler
wrappedHandler := otelsarama.WrapConsumerGroupHandler(&handler)
handler := groupHandler{} // implements sarama.ConsumerGroupHandler
wrappedHandler := otelsarama.WrapConsumerGroupHandler(&handler)
```
42 changes: 21 additions & 21 deletions content/en/docs/demo/services/ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Within the execution of auto-instrumented code you can get current span from
context.

```java
Span span = Span.current();
Span span = Span.current();
```

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

```java
span.setAttribute("app.ads.contextKeys", req.getContextKeysList().toString());
span.setAttribute("app.ads.contextKeys.count", req.getContextKeysCount());
span.setAttribute("app.ads.contextKeys", req.getContextKeysList().toString());
span.setAttribute("app.ads.contextKeys.count", req.getContextKeysCount());
```

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

```java
span.addEvent("Error", Attributes.of(AttributeKey.stringKey("exception.message"), e.getMessage()));
span.addEvent("Error", Attributes.of(AttributeKey.stringKey("exception.message"), e.getMessage()));
```

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

```java
span.setStatus(StatusCode.ERROR);
span.setStatus(StatusCode.ERROR);
```

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

```java
// create and start a new span manually
Tracer tracer = GlobalOpenTelemetry.getTracer("adservice");
Span span = tracer.spanBuilder("getRandomAds").startSpan();

// put the span into context, so if any child span is started the parent will be set properly
try (Scope ignored = span.makeCurrent()) {

Collection<Ad> allAds = adsMap.values();
for (int i = 0; i < MAX_ADS_TO_SERVE; i++) {
ads.add(Iterables.get(allAds, random.nextInt(allAds.size())));
}
span.setAttribute("app.ads.count", ads.size());

} finally {
span.end();
}
// create and start a new span manually
Tracer tracer = GlobalOpenTelemetry.getTracer("adservice");
Span span = tracer.spanBuilder("getRandomAds").startSpan();

// put the span into context, so if any child span is started the parent will be set properly
try (Scope ignored = span.makeCurrent()) {

Collection<Ad> allAds = adsMap.values();
for (int i = 0; i < MAX_ADS_TO_SERVE; i++) {
ads.add(Iterables.get(allAds, random.nextInt(allAds.size())));
}
span.setAttribute("app.ads.count", ads.size());

} finally {
span.end();
}
```

## Metrics
Expand Down
10 changes: 5 additions & 5 deletions content/en/docs/demo/services/cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Within the execution of auto-instrumented code you can get current span
(activity) from context.

```cs
var activity = Activity.Current;
var activity = Activity.Current;
```

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

```cs
activity?.SetTag("app.user.id", request.UserId);
activity?.SetTag("app.product.quantity", request.Item.Quantity);
activity?.SetTag("app.product.id", request.Item.ProductId);
activity?.SetTag("app.user.id", request.UserId);
activity?.SetTag("app.product.quantity", request.Item.Quantity);
activity?.SetTag("app.product.id", request.Item.ProductId);
```

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

```cs
activity?.AddEvent(new("Fetch cart"));
activity?.AddEvent(new("Fetch cart"));
```

## Metrics
Expand Down
72 changes: 36 additions & 36 deletions content/en/docs/demo/services/checkout.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ ensure all spans are exported. This service makes that call as part of a
deferred function in main

```go
tp := initTracerProvider()
defer func() {
if err := tp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down tracer provider: %v", err)
}
}()
tp := initTracerProvider()
defer func() {
if err := tp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down tracer provider: %v", err)
}
}()
```

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

```go
var srv = grpc.NewServer(
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()),
grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()),
)
var srv = grpc.NewServer(
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()),
grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()),
)
```

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

```go
saramaConfig := sarama.NewConfig()
producer, err := sarama.NewAsyncProducer(brokers, saramaConfig)
if err != nil {
return nil, err
}
producer = otelsarama.WrapAsyncProducer(saramaConfig, producer)
saramaConfig := sarama.NewConfig()
producer, err := sarama.NewAsyncProducer(brokers, saramaConfig)
if err != nil {
return nil, err
}
producer = otelsarama.WrapAsyncProducer(saramaConfig, producer)
```

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

```go
span := trace.SpanFromContext(ctx)
span := trace.SpanFromContext(ctx)
```

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

```go
span.SetAttributes(
attribute.String("app.order.id", orderID.String()), shippingTrackingAttribute,
attribute.Float64("app.shipping.amount", shippingCostFloat),
attribute.Float64("app.order.amount", totalPriceFloat),
attribute.Int("app.order.items.count", len(prep.orderItems)),
)
span.SetAttributes(
attribute.String("app.order.id", orderID.String()), shippingTrackingAttribute,
attribute.Float64("app.shipping.amount", shippingCostFloat),
attribute.Float64("app.order.amount", totalPriceFloat),
attribute.Int("app.order.items.count", len(prep.orderItems)),
)
```

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

```go
span.AddEvent("prepared")
span.AddEvent("prepared")
```

Adding a span event with additional attributes:

```go
span.AddEvent("charged",
trace.WithAttributes(attribute.String("app.payment.transaction.id", txID)))
span.AddEvent("charged",
trace.WithAttributes(attribute.String("app.payment.transaction.id", txID)))
```

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

```go
mp := initMeterProvider()
defer func() {
if err := mp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down meter provider: %v", err)
}
}()
mp := initMeterProvider()
defer func() {
if err := mp.Shutdown(context.Background()); err != nil {
log.Printf("Error shutting down meter provider: %v", err)
}
}()
```

### Adding golang runtime auto-instrumentation

Golang runtime are instrumented in the main function

```go
err := runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
if err != nil {
log.Fatal(err)
}
err := runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
if err != nil {
log.Fatal(err)
}
```

## Logs
Expand Down
Loading

0 comments on commit 8140780

Please sign in to comment.