Skip to content

Commit

Permalink
Merge branch 'master' into struct-info-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ikhoon committed Sep 8, 2022
2 parents 05e11ac + 3da7bac commit fab9b95
Show file tree
Hide file tree
Showing 310 changed files with 9,164 additions and 2,447 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Armeria site

on:
push:
tags:
- armeria-*

env:
LC_ALL: 'en_US.UTF-8'

jobs:
publish-site:
if: github.repository == 'line/armeria'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install svgbob_cli
run: |
sudo apt-get -y install cargo && cargo install svgbob_cli
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- id: setup-jdk-17
name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build the site
run: |
./gradlew --no-daemon --stacktrace --max-workers=2 --parallel site
- name: Deploy the site
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/public
26 changes: 6 additions & 20 deletions .post-release-msg
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,25 @@
- Publish job: https://github.com/line/armeria/actions/workflows/publish-release.yml
- Sonatype repository: https://oss.sonatype.org/
- Maven Central: https://repo.maven.apache.org/maven2/com/linecorp/armeria/armeria-bom/${releaseVersion}/
- Site job: https://github.com/line/armeria/actions/workflows/publish-site.yml

2. Build the web site:

git checkout ${tag} && \
./gradlew --no-daemon clean site

3. Close the milestone and set its due date with the date of the release at:
2. Close the milestone and set its due date with the date of the release at:

https://github.com/line/armeria/milestones

4. Copy the generated web site to the 'gh-pages' branch, e.g.

cd ../site-armeria && \
git checkout gh-pages && \
rm -fr .buildinfo .doctrees .gradle * && \
rsync -aiP ../upstream-armeria/site/public/ . && \
git add -A . && \
git commit --amend -m 'Deploy the web site' && \
git push --force

5. Update the release note at:
3. Update the release note at:

https://github.com/line/armeria/releases/tag/${tag}

6. Copy the examples to armeria-examples using the script:
4. Copy the examples to armeria-examples using the script:

cd ../armeria-examples && \
./update-examples.sh ${releaseVersion} ../upstream-armeria && \
git add -A . && \
git commit -m 'Update Armeria to ${releaseVersion}' && \
git push

7. Announce the release via Twitter.
5. Announce the release via Twitter.

8. Send an update pull request to https://github.com/TechEmpower/FrameworkBenchmarks
6. Send an update pull request to https://github.com/TechEmpower/FrameworkBenchmarks
if we made performance improvements.
2 changes: 1 addition & 1 deletion annotation-processor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependencies {
testImplementation 'org.jooq:joor'
testImplementation libs.joor
}
2 changes: 1 addition & 1 deletion benchmarks/ghz/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
dependencies {
implementation project(':core')
implementation project(':grpc')
implementation 'javax.annotation:javax.annotation-api'
implementation libs.javax.annotation
}

application {
Expand Down
33 changes: 10 additions & 23 deletions benchmarks/jmh/build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,29 @@
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "me.champeau.jmh:jmh-gradle-plugin:${managedVersions['me.champeau.jmh:jmh-gradle-plugin']}"
}
plugins {
alias libs.plugins.jmh
}

apply plugin: 'me.champeau.jmh'

dependencies {
implementation project(':grpc')
implementation project(':grpc-protocol')
implementation project(':retrofit2')
implementation project(':thrift0.16')
implementation project(':kotlin')

implementation("com.squareup.okhttp3:okhttp") {
version {
// Will fail the build if the override doesn't work
strictly '3.14.9'
}
}
implementation 'com.squareup.retrofit2:converter-jackson'
implementation 'com.google.protobuf:protobuf-java-util'
implementation 'io.grpc:grpc-okhttp'
implementation 'io.grpc:grpc-netty-shaded'
implementation 'org.awaitility:awaitility'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core'
implementation libs.retrofit2.converter.jackson
implementation libs.protobuf.java.util
implementation libs.grpc.okhttp
implementation libs.grpc.netty.shaded
implementation libs.awaitility
implementation libs.kotlin.coroutines.core

jmh "pl.project13.scala:sbt-jmh-extras:${managedVersions['pl.project13.scala:sbt-jmh-extras']}"
jmh libs.jmh.extras

implementation project(':testing-internal')
}

jmh {
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
jmhVersion = managedVersions['org.openjdk.jmh:jmh-core']
jmhVersion = libs.versions.jmh.get()

def jmhIncludes = rootProject.findProperty('jmh.includes')
if (jmhIncludes) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright 2022 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

package com.linecorp.armeria.internal.common;

import org.openjdk.jmh.annotations.Benchmark;

import com.linecorp.armeria.common.HttpMethod;
import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.RequestContext;
import com.linecorp.armeria.common.RequestContextStorage;
import com.linecorp.armeria.common.util.Sampler;
import com.linecorp.armeria.server.ServiceRequestContext;

/**
* Microbenchmarks for LeakTracingRequestContextStorage.
*/
public class LeakTracingRequestContextStorageBenchmark {

private static final RequestContextStorage threadLocalReqCtxStorage =
RequestContextStorage.threadLocal();
private static final RequestContextStorage neverSample =
new LeakTracingRequestContextStorage(threadLocalReqCtxStorage, Sampler.never());
private static final RequestContextStorage rateLimited1 =
new LeakTracingRequestContextStorage(threadLocalReqCtxStorage, Sampler.of("rate-limited=1"));
private static final RequestContextStorage rateLimited10 =
new LeakTracingRequestContextStorage(threadLocalReqCtxStorage, Sampler.of("rate-limited=10"));
private static final RequestContextStorage random1 =
new LeakTracingRequestContextStorage(threadLocalReqCtxStorage, Sampler.of("random=0.01"));
private static final RequestContextStorage random10 =
new LeakTracingRequestContextStorage(threadLocalReqCtxStorage, Sampler.of("random=0.10"));
private static final RequestContextStorage alwaysSample =
new LeakTracingRequestContextStorage(threadLocalReqCtxStorage, Sampler.always());
private static final RequestContext reqCtx = newCtx("/");

private static ServiceRequestContext newCtx(String path) {
return ServiceRequestContext.builder(HttpRequest.of(HttpMethod.GET, path))
.build();
}

@Benchmark
public void baseline_threadLocal() {
final RequestContext oldCtx = threadLocalReqCtxStorage.push(reqCtx);
threadLocalReqCtxStorage.pop(reqCtx, oldCtx);
}

@Benchmark
public void leakTracing_never_sample() {
final RequestContext oldCtx = neverSample.push(reqCtx);
neverSample.pop(reqCtx, oldCtx);
}

@Benchmark
public void leakTracing_rateLimited_1() {
final RequestContext oldCtx = rateLimited1.push(reqCtx);
rateLimited1.pop(reqCtx, oldCtx);
}

@Benchmark
public void leakTracing_rateLimited_10() {
final RequestContext oldCtx = rateLimited10.push(reqCtx);
rateLimited10.pop(reqCtx, oldCtx);
}

@Benchmark
public void leakTracing_random_1() {
final RequestContext oldCtx = random1.push(reqCtx);
random1.pop(reqCtx, oldCtx);
}

@Benchmark
public void leakTracing_random_10() {
final RequestContext oldCtx = random10.push(reqCtx);
random10.pop(reqCtx, oldCtx);
}

@Benchmark
public void leakTracing_always_sample() {
final RequestContext oldCtx = alwaysSample.push(reqCtx);
alwaysSample.pop(reqCtx, oldCtx);
}
}
8 changes: 4 additions & 4 deletions brave/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dependencies {
api 'io.zipkin.brave:brave'
api 'io.zipkin.brave:brave-instrumentation-http'
api libs.brave
api libs.brave.instrumentation.http

testImplementation project(':thrift0.16')
testImplementation 'io.zipkin.brave:brave-context-slf4j'
testImplementation 'io.zipkin.brave:brave-instrumentation-http-tests'
testImplementation libs.brave.context.slf4j
testImplementation libs.brave.instrumentation.http.tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.slf4j.LoggerFactory;

import com.linecorp.armeria.client.ClientRequestContext;
import com.linecorp.armeria.client.DefaultClientRequestContext;
import com.linecorp.armeria.client.HttpClient;
import com.linecorp.armeria.client.SimpleDecoratingHttpClient;
import com.linecorp.armeria.common.HttpRequest;
Expand All @@ -34,6 +33,7 @@
import com.linecorp.armeria.common.annotation.Nullable;
import com.linecorp.armeria.common.brave.RequestContextCurrentTraceContext;
import com.linecorp.armeria.common.logging.ClientConnectionTimings;
import com.linecorp.armeria.internal.common.RequestContextExtension;
import com.linecorp.armeria.internal.common.brave.SpanTags;

import brave.Span;
Expand Down Expand Up @@ -121,10 +121,10 @@ public HttpResponse execute(ClientRequestContext ctx, HttpRequest req) throws Ex
req = req.withHeaders(newHeaders);
ctx.updateRequest(req);

if (currentTraceContext != null && !span.isNoop() && ctx instanceof DefaultClientRequestContext) {
final DefaultClientRequestContext defaultCtx = (DefaultClientRequestContext) ctx;
final RequestContextExtension ctxExtension = ctx.as(RequestContextExtension.class);
if (currentTraceContext != null && !span.isNoop() && ctxExtension != null) {
// Make the span the current span and run scope decorators when the ctx is pushed.
defaultCtx.hook(() -> currentTraceContext.newScope(span.context()));
ctxExtension.hook(() -> currentTraceContext.newScope(span.context()));
}

maybeAddTagsToSpan(ctx, braveReq, span);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.brave.RequestContextCurrentTraceContext;
import com.linecorp.armeria.internal.common.RequestContextExtension;
import com.linecorp.armeria.internal.common.brave.SpanTags;
import com.linecorp.armeria.server.DefaultServiceRequestContext;
import com.linecorp.armeria.server.HttpService;
import com.linecorp.armeria.server.ServiceRequestContext;
import com.linecorp.armeria.server.SimpleDecoratingHttpService;
Expand Down Expand Up @@ -100,12 +100,11 @@ public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exc
final HttpServerRequest braveReq = ServiceRequestContextAdapter.asHttpServerRequest(ctx);
final Span span = handler.handleReceive(braveReq);

if (currentTraceContext.scopeDecoratorAdded() && !span.isNoop() &&
ctx instanceof DefaultServiceRequestContext) {
final DefaultServiceRequestContext defaultCtx = (DefaultServiceRequestContext) ctx;
final RequestContextExtension ctxExtension = ctx.as(RequestContextExtension.class);
if (currentTraceContext.scopeDecoratorAdded() && !span.isNoop() && ctxExtension != null) {
// Run the scope decorators when the ctx is pushed to the thread local.
defaultCtx.hook(() -> currentTraceContext.decorateScope(span.context(),
SERVICE_REQUEST_DECORATING_SCOPE));
ctxExtension.hook(() -> currentTraceContext.decorateScope(span.context(),
SERVICE_REQUEST_DECORATING_SCOPE));
}

maybeAddTagsToSpan(ctx, braveReq, span);
Expand Down
2 changes: 1 addition & 1 deletion bucket4j/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies {
// Bucket4j - rate-limiting library based on Token-Bucket algorithm
implementation 'com.github.vladimir-bukhtoyarov:bucket4j-core'
implementation libs.bucket4j
}
Loading

0 comments on commit fab9b95

Please sign in to comment.