Skip to content

Commit

Permalink
Merge branch 'main' into ana/get-started-survey
Browse files Browse the repository at this point in the history
  • Loading branch information
AnaMMedina21 authored Jun 12, 2024
2 parents 012961e + 4b1f5e3 commit cb22201
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,3 @@ IgnoreURLs: # list of regexs of paths or URLs to be ignored
- ^https://wikipedia.org/wiki/(S.M.A.R.T|Hop_)
# TODO move into content/en/blog/2023/contributing-to-otel/index.md once https://github.com/open-telemetry/opentelemetry.io/issues/3889 is implemented
- ^https://shorturl.at/vLYZ0$
# TODO remove while or after fixing https://github.com/open-telemetry/opentelemetry.io/issues/4656
- ^/docs/specs/otel/versioning-and-stability/#experimental
2 changes: 1 addition & 1 deletion content/en/docs/concepts/instrumentation/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ You may be rightfully concerned about adding new dependencies, here are some
considerations to help you decide how to minimize dependency hell:

- OpenTelemetry Trace API reached stability in early 2021, it follows
[Semantic Versioning 2.0](/docs/specs/otel/versioning-and-stability) and we
[Semantic Versioning 2.0](/docs/specs/otel/versioning-and-stability/) and we
take API stability seriously.
- When taking dependency, use the earliest stable OpenTelemetry API (1.0.\*) and
avoid updating it unless you have to use new features.
Expand Down
68 changes: 66 additions & 2 deletions content/en/docs/languages/java/instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ If you followed the instructions to [initialize the SDK](#initialize-the-sdk)
above, you have a `TracerProvider` setup for you already. You can continue with
[acquiring a tracer](#acquiring-a-tracer).

### Acquiring a Tracer
### Acquiring a tracer

To do [Tracing](/docs/concepts/signals/traces/) you'll need to acquire a
[`Tracer`](/docs/concepts/signals/traces/#tracer).
Expand Down Expand Up @@ -676,6 +676,36 @@ Tracer tracer = GlobalOpenTelemetry.getTracer("instrumentation-scope-name", "ins
Note that you can't force end users to configure the global, so this is the most
brittle option for library instrumentation.

### Acquiring a tracer in Java agent

If you are using the [Java agent], you can acquire a `Tracer` from the global OpenTelemetry
instance:

```java
import io.opentelemetry.api.GlobalOpenTelemetry;

Tracer tracer = GlobalOpenTelemetry.getTracer("application");
```

### Acquiring a tracer in Spring Boot starter

If you are using the [Spring Boot starter], you can acquire a `Tracer` from the
autowired OpenTelemetry instance:

```java
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.trace.Tracer;

@Controller
public class MyController {
private final Tracer tracer;

public MyController(OpenTelemetry openTelemetry) {
this.tracer = openTelemetry.getTracer("application");
}
}
```

### Create Spans

Now that you have [tracers](/docs/concepts/signals/traces/#tracer) initialized,
Expand Down Expand Up @@ -1194,7 +1224,7 @@ OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
.build();
```

### Acquiring a Meter
### Acquiring a meter

Anywhere in your application where you have manually instrumented code you can
call `opentelemetry.meterBuilder(instrumentationScopeName)` to get or create a
Expand All @@ -1216,6 +1246,38 @@ Now that you have [meters](/docs/concepts/signals/metrics/#meter) initialized.
you can create
[metric instruments](/docs/concepts/signals/metrics/#metric-instruments).

### Acquiring a meter in Java agent

If you are using the [Java agent], you can acquire a `Meter` from the global OpenTelemetry
instance:

```java
import io.opentelemetry.api.GlobalOpenTelemetry;

Meter meter = GlobalOpenTelemetry.getMeter("application");
```

### Acquiring a meter in Spring Boot starter

If you are using the [Spring Boot starter], you can acquire a `Meter` from the
autowired OpenTelemetry instance:

```java
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.metrics.Meter;

@Controller
public class MyController {
private final Meter meter;

public MyController(OpenTelemetry openTelemetry) {
this.meter = openTelemetry.getMeter("application");
}
}
```

a

### Using Counters

Counters can be used to measure non-negative, increasing values.
Expand Down Expand Up @@ -1857,3 +1919,5 @@ io.opentelemetry.sdk.trace.export.BatchSpanProcessor = io.opentelemetry.extensio
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/trace/src/main/java/io/opentelemetry/sdk/trace/samplers/ParentBasedSampler.java
[traceidratiobased]:
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/trace/src/main/java/io/opentelemetry/sdk/trace/samplers/TraceIdRatioBasedSampler.java
[Java agent]: /docs/zero-code/java/agent/
[Spring Boot starter]: /docs/zero-code/java/spring-boot-starter/
2 changes: 1 addition & 1 deletion content/en/docs/zero-code/java/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ aliases:
cascade:
vers:
instrumentation: 2.4.0
otel: 1.38.0
otel: 1.39.0
---

Zero-code instrumentation with Java uses a Java agent JAR or Spring Boot
Expand Down
2 changes: 1 addition & 1 deletion data/registry/instrumentation-js-cerbos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ createdAt: 2023-09-13
package:
name: '@cerbos/opentelemetry'
registry: npm
version: 0.5.0
version: 0.5.1
isFirstParty: true
2 changes: 1 addition & 1 deletion data/registry/instrumentation-ruby-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ createdAt: 2020-11-09
package:
registry: gems
name: opentelemetry-instrumentation-all
version: 0.60.0
version: 0.61.0
2 changes: 1 addition & 1 deletion data/registry/instrumentation-ruby-ethon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ createdAt: 2020-11-09
package:
registry: gems
name: opentelemetry-instrumentation-ethon
version: 0.21.5
version: 0.21.6
2 changes: 1 addition & 1 deletion data/registry/instrumentation-ruby-rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ createdAt: 2020-11-09
package:
registry: gems
name: opentelemetry-instrumentation-rails
version: 0.30.1
version: 0.30.2
31 changes: 31 additions & 0 deletions layouts/partials/docs/get-signal-status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{/*

Returns the maturity status of the given signal for the given language.

Arguments:

.lang the instrumentation language
.signal the signal name; must be a legal field of the Instrumentation data file.

*/ -}}

{{ $status := "-" -}}
{{ $signal := .signal -}}

{{ with index site.Data.instrumentation .lang -}}
{{ with index .status $signal -}}
{{ $statusWeCanLinkTo := "stable development" -}}
{{ $status = cond (or (eq "experimental" .) (eq "in development" .)) "development" . -}}
{{ $humanizedStatus := humanize $status -}}
{{ $status = cond (in $statusWeCanLinkTo $status)
(printf "[%s](/docs/specs/otel/versioning-and-stability/#%s)" $humanizedStatus $status)
(cond (in "alpha beta" $status)
(printf "[%s](https://github.com/open-telemetry/oteps/blob/main/text/0232-maturity-of-otel.md#%s)" $humanizedStatus $status)
$humanizedStatus)
-}}
{{ end -}}
{{ else -}}
{{ errorf "The site.Data.instrumentation map has no language key '%s'." .lang -}}
{{ end -}}

{{ return $status -}}
16 changes: 4 additions & 12 deletions layouts/shortcodes/docs/languages/index-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@
{{ $lang := .Get 0 -}}
{{ $data := index $.Site.Data.instrumentation $lang }}
{{ $name := $data.name -}}
{{ $tracesStatus := $data.status.traces | humanize -}}
{{ $metricsStatus := $data.status.metrics | humanize -}}
{{ $logsStatus := $data.status.logs | humanize -}}
{{ if in "Stable Experimental" $tracesStatus -}}
{{ $tracesStatus = printf "[%s](/docs/specs/otel/versioning-and-stability/#%s)" $tracesStatus $data.status.traces -}}
{{ end -}}
{{ if in "Stable Experimental" $metricsStatus -}}
{{ $metricsStatus = printf "[%s](/docs/specs/otel/versioning-and-stability/#%s)" $metricsStatus $data.status.metrics -}}
{{ end -}}
{{ if in "Stable Experimental" $logsStatus -}}
{{ $logsStatus = printf "[%s](/docs/specs/otel/versioning-and-stability/#%s)" $logsStatus $data.status.logs -}}
{{ end -}}

{{ $tracesStatus := partial "docs/get-signal-status.html" (dict "lang" $lang "signal" "traces") -}}
{{ $metricsStatus := partial "docs/get-signal-status.html" (dict "lang" $lang "signal" "metrics") -}}
{{ $logsStatus := partial "docs/get-signal-status.html" (dict "lang" $lang "signal" "logs") -}}

This is the OpenTelemetry {{ $name }} documentation. OpenTelemetry is an
observability framework -- an API, SDK, and tools that are designed to aid in
Expand Down

0 comments on commit cb22201

Please sign in to comment.