Skip to content

Commit

Permalink
Merge branch 'main' into http-route-remove-low-cardinality
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad committed Nov 9, 2022
2 parents 4b9048b + 7f0f8e3 commit 3b1437d
Show file tree
Hide file tree
Showing 30 changed files with 501 additions and 1,963 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ significant modifications will be credited to OpenTelemetry Authors.
([#455](https://github.com/open-telemetry/opentelemetry-demo/pull/455))
* Update cartservice Dockerfile to support ARM64
([#439](https://github.com/open-telemetry/opentelemetry-demo/pull/439))
* Update shippingservice to add resource data to spans
([#504](https://github.com/open-telemetry/opentelemetry-demo/pull/504))
* Add Envoy as reverse proxy for all user-facing services
([#508](https://github.com/open-telemetry/opentelemetry-demo/pull/508))
* Envoy: Grafana, Load Generator, Jaeger exposed.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ keeping it up to date for you.

- [Datadog](https://github.com/DataDog/opentelemetry-demo)
- [Dynatrace](https://www.dynatrace.com/news/blog/opentelemetry-demo-application-with-dynatrace/)
- [Helios](https://otelsandbox.gethelios.dev)
- [Honeycomb.io](https://github.com/honeycombio/opentelemetry-demo)
- [Lightstep](https://github.com/lightstep/opentelemetry-demo)
- [New Relic](https://github.com/newrelic/opentelemetry-demo)
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ services:
# OTEL_EXPORTER_OTLP_TRACES_ENDPOINT # Not working for PHP
- QUOTE_SERVICE_PORT
- OTEL_SERVICE_NAME=quoteservice
- OTEL_EXPORTER_OTLP_ENDPOINT=otelcol:4317
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4318
- OTEL_TRACES_SAMPLER=parentbased_always_on
- OTEL_TRACES_EXPORTER=otlp
- OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
- OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
- OTEL_PHP_TRACES_PROCESSOR=simple
depends_on:
- otelcol
Expand Down
7 changes: 7 additions & 0 deletions docs/services/shippingservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ The OpenTelemetry SDK is initialized from `main`.
```rust
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
global::set_text_map_propagator(TraceContextPropagator::new());
let os_resource = OsResourceDetector.detect(Duration::from_secs(0));
let process_resource = ProcessResourceDetector.detect(Duration::from_secs(0));
let sdk_resource = SdkProvidedResourceDetector.detect(Duration::from_secs(0));
opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
Expand All @@ -38,6 +41,10 @@ fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
)), // TODO: assume this ^ is true from config when opentelemetry crate > v0.17.0
// https://github.com/open-telemetry/opentelemetry-rust/pull/806 includes the environment variable.
)
.with_trace_config(
sdktrace::config()
.with_resource(os_resource.merge(&process_resource).merge(&sdk_resource)),
)
.install_batch(opentelemetry::runtime::Tokio)
}
```
Expand Down
147 changes: 0 additions & 147 deletions pb/google/protobuf/timestamp.proto

This file was deleted.

43 changes: 0 additions & 43 deletions pb/grpc/health/v1/health.proto

This file was deleted.

11 changes: 5 additions & 6 deletions src/adservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM openjdk:18-slim AS builder
FROM eclipse-temurin:17-jdk AS builder

WORKDIR /usr/src/app/

COPY ./src/adservice/ ./
COPY ./pb/ ./src/main/proto/
RUN chmod +x ./gradlew
COPY ./pb/ ./proto
RUN ./gradlew downloadRepos
RUN ./gradlew installDist
RUN ./gradlew installDist -PprotoSourceDir=./proto

# -----------------------------------------------------------------------------

FROM openjdk:18-slim
FROM eclipse-temurin:17-jdk

ARG version=1.16.0
ARG version=1.19.1
WORKDIR /usr/src/app/

COPY --from=builder /usr/src/app/ ./
Expand Down
11 changes: 9 additions & 2 deletions src/adservice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ already part of the source code. To build Ad Service, run:
It will create an executable script
`src/adservice/build/install/hipstershop/bin/AdService`.

To run the Ad Service:

```sh
export AD_SERVICE_PORT=8080
./build/install/hipstershop/bin/AdService
```

### Upgrading Gradle

If you need to upgrade the version of gradle then run
Expand All @@ -25,8 +32,8 @@ If you need to upgrade the version of gradle then run

## Building Docker

From `src/adservice/`, run:
From the root of `opentelemetry-demo`, run:

```sh
docker build ./
docker build --file ./src/adservice/Dockerfile ./
```
44 changes: 37 additions & 7 deletions src/adservice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ description = 'Ad Service'
group = "adservice"
version = "0.1.0-SNAPSHOT"

def opentelemetryVersion = "1.12.0"
def opentelemetryVersion = "1.19.0"
def opentelemetryInstrumentationAlphaVersion = "1.19.1-alpha"
def grpcVersion = "1.45.1"
def jacksonVersion = "2.13.2"
def protocVersion = "3.20.0"

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_18
targetCompatibility = JavaVersion.VERSION_18
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

ext {
Expand All @@ -33,16 +34,18 @@ dependencies {
if (speed) {
implementation fileTree(dir: offlineCompile, include: '*.jar')
} else {
implementation platform("io.opentelemetry:opentelemetry-bom:${opentelemetryVersion}")
implementation platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${opentelemetryInstrumentationAlphaVersion}")

implementation "com.google.api.grpc:proto-google-common-protos:2.8.0",
"javax.annotation:javax.annotation-api:1.3.2",
"io.grpc:grpc-protobuf:${grpcVersion}",
"io.grpc:grpc-stub:${grpcVersion}",
"io.grpc:grpc-netty:${grpcVersion}",
"io.grpc:grpc-services:${grpcVersion}",
"io.opentelemetry:opentelemetry-api:${opentelemetryVersion}",
"io.opentelemetry:opentelemetry-sdk:${opentelemetryVersion}",
"io.opentelemetry:opentelemetry-extension-annotations:${opentelemetryVersion}",
"io.opentelemetry:opentelemetry-api",
"io.opentelemetry:opentelemetry-sdk",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations",
"org.apache.logging.log4j:log4j-core:2.17.2"

runtimeOnly "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}",
Expand All @@ -51,6 +54,27 @@ dependencies {
}
}

// Default protoSourceDir is in /opentelemetry-demo/pb. Optionally override the
// location for the docker build, which copies the protos to a different location.
def protoSourceDir = findProperty('protoSourceDir')?: project.projectDir.parentFile.parentFile.toPath().toString() + "/pb"
def protoDestDir = project.buildDir.toPath().toString() + "/proto"

// Copy protos to the build directory
tasks.register('copyProtos', Copy) {
from protoSourceDir
into protoDestDir
}

// Include the output directory of copyProtos in main source set so they are
// picked up by the protobuf plugin
sourceSets {
main {
proto {
srcDir(protoDestDir)
}
}
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
Expand All @@ -60,14 +84,20 @@ protobuf {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
generateProtoTasks { task ->
all()*.plugins {
grpc {}
}
ofSourceSet('main')
}
}

afterEvaluate {
// Ensure protos are copy before classes are generated
tasks.getByName('processResources').dependsOn 'copyProtos'
tasks.getByName('generateProto').dependsOn 'copyProtos'
}

googleJavaFormat {
toolVersion '1.7'
}
Expand Down
Binary file modified src/adservice/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/adservice/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3b1437d

Please sign in to comment.