Skip to content

Commit

Permalink
Use the new me.dinowernli package namespace for all the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dinowernli committed Jun 12, 2016
1 parent 1a17257 commit 4eb093c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
// Copyright 2016 Dino Wernli. All Rights Reserved. See LICENSE for licensing terms.

package com.github.dinowernli.grpc.prometheus;
package me.dinowernli.grpc.prometheus;

import java.time.Clock;
import java.time.Instant;
import java.util.Optional;

import com.github.dinowernli.grpc.prometheus.MonitoringServerInterceptor.Configuration;

import io.grpc.ForwardingServerCall;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor.MethodType;
import me.dinowernli.grpc.prometheus.MonitoringServerInterceptor.Configuration;
import io.grpc.ServerCall;
import io.grpc.Status;

/**
* A {@link ForwardingServerCall} which update Prometheus metrics based on the server-side actions
* taken for a single rpc, e.g., messages sent, latency, etc.
*/
class MonitoringForwardingServerCall<S> extends ForwardingServerCall.SimpleForwardingServerCall<S> {
class MonitoringServerCall<S> extends ForwardingServerCall.SimpleForwardingServerCall<S> {
private static final long MILLIS_PER_SECOND = 1000L;

private final Clock clock;
Expand All @@ -28,7 +27,7 @@ class MonitoringForwardingServerCall<S> extends ForwardingServerCall.SimpleForwa

private final Optional<Instant> startInstant;

MonitoringForwardingServerCall(
MonitoringServerCall(
ServerCall<S> delegate,
Clock clock,
MethodType methodType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.dinowernli.grpc.prometheus;
package me.dinowernli.grpc.prometheus;

import io.grpc.ForwardingServerCallListener;
import io.grpc.ServerCall;
Expand All @@ -7,12 +7,12 @@
* A {@link ForwardingServerCallListener} which updates Prometheus metrics for a single rpc based
* on updates received from grpc.
*/
class MonitoringForwardingServerCallListener<R>
class MonitoringServerCallListener<R>
extends ForwardingServerCallListener<R> {
private final ServerCall.Listener<R> delegate;
private final ServerMetrics serverMetrics;

MonitoringForwardingServerCallListener(
MonitoringServerCallListener(
ServerCall.Listener<R> delegate, ServerMetrics serverMetrics) {
this.delegate = delegate;
this.serverMetrics = serverMetrics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2016 Dino Wernli. All Rights Reserved. See LICENSE for licensing terms.

package com.github.dinowernli.grpc.prometheus;
package me.dinowernli.grpc.prometheus;

import java.time.Clock;
import java.util.Optional;
Expand Down Expand Up @@ -35,9 +35,9 @@ public <R, S> ServerCall.Listener<R> interceptCall(
// TODO(dino): If we cache the ServerMetrics instance, we can achieve an initial 0 value on
// registration and save some cycles here where we always create a new one per-request.
ServerMetrics metrics = ServerMetrics.create(method, configuration.getCollectorRegistry());
ServerCall<S> monitoringCall = new MonitoringForwardingServerCall<S>(
ServerCall<S> monitoringCall = new MonitoringServerCall<S>(
call, clock, method.getType(), metrics, configuration);
return new MonitoringForwardingServerCallListener<R>(
return new MonitoringServerCallListener<R>(
next.startCall(method, monitoringCall, requestHeaders), metrics);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.dinowernli.grpc.prometheus;
package me.dinowernli.grpc.prometheus;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2016 Dino Wernli. All Rights Reserved. See LICENSE for licensing terms.

package com.github.dinowernli.grpc.prometheus.testing;
package me.dinowernli.grpc.prometheus.testing;

import com.github.dinowernli.proto.grpc.prometheus.HelloProto.HelloRequest;
import com.github.dinowernli.proto.grpc.prometheus.HelloProto.HelloResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ java_test(
srcs = glob(['*.java']),
size = "small",
deps = [
"//src/main/java/com/github/dinowernli/grpc/prometheus",
"//src/main/java/com/github/dinowernli/grpc/prometheus/testing",
"//src/main/java/me/dinowernli/grpc/prometheus",
"//src/main/java/me/dinowernli/grpc/prometheus/testing",
"//src/main/proto:hello_proto_grpc",
"//third_party/grpc",
"//third_party/grpc:testing",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2016 Dino Wernli. All Rights Reserved. See LICENSE for licensing terms.

package com.github.dinowernli.grpc.prometheus;
package me.dinowernli.grpc.prometheus.integration;

import static com.google.common.truth.Truth.assertThat;

Expand All @@ -11,8 +11,6 @@
import org.junit.Before;
import org.junit.Test;

import com.github.dinowernli.grpc.prometheus.MonitoringServerInterceptor.Configuration;
import com.github.dinowernli.grpc.prometheus.testing.HelloServiceImpl;
import com.github.dinowernli.proto.grpc.prometheus.HelloProto.HelloRequest;
import com.github.dinowernli.proto.grpc.prometheus.HelloProto.HelloResponse;
import com.github.dinowernli.proto.grpc.prometheus.HelloServiceGrpc;
Expand All @@ -30,6 +28,9 @@
import io.grpc.testing.StreamRecorder;
import io.grpc.testing.TestUtils;
import io.prometheus.client.Collector.MetricFamilySamples;
import me.dinowernli.grpc.prometheus.MonitoringServerInterceptor;
import me.dinowernli.grpc.prometheus.MonitoringServerInterceptor.Configuration;
import me.dinowernli.grpc.prometheus.testing.HelloServiceImpl;
import io.prometheus.client.CollectorRegistry;

/**
Expand Down

0 comments on commit 4eb093c

Please sign in to comment.