Skip to content

Commit

Permalink
update samples and package versions
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity committed Nov 22, 2019
1 parent 30918e8 commit 9e9951b
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 58 deletions.
8 changes: 8 additions & 0 deletions sdk/core/azure-core-tracing-opencensus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Release History
## Version 1.0.0-beta.5 (2019-11-25)
For details on the Azure SDK for Java (December 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview6-java).
Version 1.0.0-beta.5 extended support for 0.24.0 opencensus-api package version.

This package's
[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opencensus_1.0.0-beta.5/sdk/core/azure-core-tracing-opencensus/README.md)
and
[samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opencensus_1.0.0-beta.5/sdk/core/azure-core-tracing-opencensus/src/samples).

## Version 1.0.0-preview.4 (2019-10-31)

Expand Down
19 changes: 12 additions & 7 deletions sdk/core/azure-core-tracing-opencensus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ documentation][api_documentation] | [Samples][samples]
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opencensus</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -38,7 +38,7 @@ Netty and include OkHTTP client in your pom.xml.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opencensus</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
Expand All @@ -54,7 +54,7 @@ Netty and include OkHTTP client in your pom.xml.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.0.0</version>
<version>1.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -137,10 +137,15 @@ private static final Tracer TRACER;
.buildProducer();

try (Scope scope = TRACER.spanBuilder("tracing-user-span").startScopedSpan()) {
Context tracingContext = new Context(PARENT_SPAN_KEY, TRACER.getCurrentSpan());
// Create an event to send
final EventData eventData = new EventData("Hello world!".getBytes(UTF_8), traceContext);
producer.send(eventData);
EventData event1 = new EventData("1".getBytes(UTF_8));
event1.addContext(PARENT_SPAN_KEY, span);

EventDataBatch eventDataBatch = producer.createBatch();

if (!eventDataBatch.tryAdd(eventData)) {
producer.send(eventDataBatch);
eventDataBatch = producer.createBatch();
}
} finally {
Tracing.getExportComponent().shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.0.0</version>
<version>4.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -22,7 +22,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opencensus</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-queue</artifactId>
<version>12.0.0</version>
<version>12.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -23,7 +23,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opencensus</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.0.0</version>
<version>4.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -22,7 +22,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opencensus</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
38 changes: 22 additions & 16 deletions sdk/core/azure-core-tracing-opencensus/src/samples/PublishEvents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-eventhubs</artifactId>
<version>5.0.0-beta.5</version>
<version>5.0.0-beta.6</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -66,25 +66,31 @@ public class PublishEvents {
}

public static void main(String[] args) {
final int count = 2;
final byte[] body = "Hello World!".getBytes(UTF_8);
EventHubProducerClient producer = new EventHubClientBuilder()
.connectionString(connectionString)
.buildProducerClient();

try(Scope scope = TRACER.spanBuilder("user-parent-span").startScopedSpan()) {
final EventData event1 = new EventData("1".getBytes(UTF_8));
event1.addContext(PARENT_SPAN_KEY, TRACER.getCurrentSpan());

final EventData event2 = new EventData("2".getBytes(UTF_8));
event2.addContext(PARENT_SPAN_KEY, TRACER.getCurrentSpan());

Context traceContext = new Context(PARENT_SPAN_KEY, TRACER.getCurrentSpan());

EventHubProducerClient producer = new EventHubClientBuilder()
.connectionString(CONNECTION_STRING)
.buildProducer();
final List<EventData> telemetryEvents = Arrays.asList(event1, event2);
final CreateBatchOptions options = new CreateBatchOptions()
.setPartitionKey("telemetry")
.setMaximumSizeInBytes(256);

EventDataBatch currentBatch = producer.createBatch(options);

final Context traceContext = new Context(PARENT_SPAN_KEY, TRACER.getCurrentSpan());
final Flux<EventData> testData = Flux.range(0, count)
.flatMap(number -> {
final EventData data = new EventData(body, traceContext);
return Flux.just(data);
});

producer.send(testData.toIterable(1));
// For each telemetry event, we try to add it to the current batch.
for (EventData event : telemetryEvents) {
if (!currentBatch.tryAdd(event)) {
producer.send(currentBatch);
currentBatch = producer.createBatch(options);
}
}
} finally {
producer.close();
Tracing.getExportComponent().shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-queue</artifactId>
<version>12.0.0</version>
<version>12.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -23,7 +23,7 @@ Sample uses **[opencensus-impl][opencensus_impl]** as implementation package and
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opencensus</artifactId>
<version>1.0.0-beta.4</version>
<version>1.0.0-beta.5</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
11 changes: 10 additions & 1 deletion sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Release History

## Version 1.0.0-beta.1 (-12-)
## Version 1.0.0-beta.1 (2019-11-25)

For details on the Azure SDK for Java (Decemeber 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview5-java).
Version 1.0.0-beta.1 is the first preview of our efforts to provide low level interfaces and helper methods to support tracing for Java client libraries.
This library includes [OpenTelemetry](https://opentelemetry.io/) implementation of the interface.
This library added tracing instrumentation for AMQP and HTTP Java SDK client libraries across different languages and platforms.

This package's
[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opentelemetry_1.0.0-beta.1/sdk/core/azure-core-tracing-opentelemetry/README.md)
and
[samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-core-tracing-opentelemetry_1.0.0-beta.1/sdk/core/azure-core-tracing-opentelemetry/src/samples).

14 changes: 10 additions & 4 deletions sdk/core/azure-core-tracing-opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Netty and include OkHTTP client in your pom.xml.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.0.0</version>
<version>1.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -140,9 +140,15 @@ private static final TracerSdkFactory TRACER_SDK_FACTORY;

Span span = TRACER.spanBuilder("user-parent-span").startSpan();
try (Scope scope = TRACER.withSpan(span)) {
Context traceContext = new Context(PARENT_SPAN_KEY, span);
EventData eventData = new EventData("Hello world!".getBytes(UTF_8), traceContext);
producer.send(eventData);
EventData event1 = new EventData("1".getBytes(UTF_8));
event1.addContext(PARENT_SPAN_KEY, span);

EventDataBatch eventDataBatch = producer.createBatch();

if (!eventDataBatch.tryAdd(eventData)) {
producer.send(eventDataBatch);
eventDataBatch = producer.createBatch();
}
} finally {
span.end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.0.0</version>
<version>4.1.0-beta.1</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
Expand All @@ -25,7 +25,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
</dependencies>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
Expand All @@ -25,7 +25,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.0.0</version>
<version>4.1.0-beta.1</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
Expand All @@ -25,7 +25,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
</dependencies>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** for implementation and **
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-eventhubs</artifactId>
<version>5.0.0-beta.5</version>
<version>5.0.0-beta.6</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
Expand All @@ -25,7 +25,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** for implementation and **
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -74,20 +74,31 @@ public class Sample {

private static void doClientWork() {
EventHubProducerClient producer = new EventHubClientBuilder()
.connectionString(CONNECTION_STRING)
.buildProducer();

final int count = 2;
final byte[] body = "Hello World!".getBytes(UTF_8);
.connectionString(connectionString)
.buildProducerClient();

Span span = TRACER.spanBuilder("user-parent-span").startSpan();
try (final Scope scope = TRACER.withSpan(span)) {
final Context traceContext = new Context(PARENT_SPAN_KEY, span);
final Flux<EventData> testData = Flux.range(0, count).flatMap(number -> {
final EventData data = new EventData(body, traceContext);
return Flux.just(data);
});
producer.send(testData.toIterable(1));
final EventData event1 = new EventData("1".getBytes(UTF_8));
event1.addContext(PARENT_SPAN_KEY, span);

final EventData event2 = new EventData("2".getBytes(UTF_8));
event2.addContext(PARENT_SPAN_KEY, span);

final List<EventData> telemetryEvents = Arrays.asList(event1, event2);
final CreateBatchOptions options = new CreateBatchOptions()
.setPartitionKey("telemetry")
.setMaximumSizeInBytes(256);

EventDataBatch currentBatch = producer.createBatch(options);

// For each telemetry event, we try to add it to the current batch.
for (EventData event : telemetryEvents) {
if (!currentBatch.tryAdd(event)) {
producer.send(currentBatch);
currentBatch = producer.createBatch(options);
}
}
} finally {
span.end();
producer.close();
Expand Down

0 comments on commit 9e9951b

Please sign in to comment.