-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
411 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...y-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverDistributionSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2025 VMware, Inc. | ||
* | ||
* Licensed 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 io.micrometer.stackdriver; | ||
|
||
import io.micrometer.core.instrument.Clock; | ||
import io.micrometer.core.instrument.distribution.*; | ||
import io.micrometer.core.instrument.step.StepDistributionSummary; | ||
|
||
import static io.micrometer.stackdriver.StackdriverHistogramUtil.stackdriverHistogram; | ||
|
||
class StackdriverDistributionSummary extends StepDistributionSummary { | ||
|
||
public StackdriverDistributionSummary(Id id, Clock clock, DistributionStatisticConfig distributionStatisticConfig, | ||
double scale, long stepMillis) { | ||
super(id, clock, distributionStatisticConfig, scale, stepMillis, | ||
stackdriverHistogram(clock, distributionStatisticConfig)); | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...egistry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverHistogramUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2025 VMware, Inc. | ||
* | ||
* Licensed 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 io.micrometer.stackdriver; | ||
|
||
import io.micrometer.core.instrument.Clock; | ||
import io.micrometer.core.instrument.distribution.*; | ||
|
||
final class StackdriverHistogramUtil { | ||
|
||
private StackdriverHistogramUtil() { | ||
} | ||
|
||
// copied and modified from AbstractDistributionSummary/AbstractTimer | ||
static Histogram stackdriverHistogram(Clock clock, DistributionStatisticConfig distributionStatisticConfig) { | ||
if (distributionStatisticConfig.isPublishingPercentiles()) { | ||
return new StackdriverClientSidePercentilesHistogram(clock, distributionStatisticConfig); | ||
} | ||
if (distributionStatisticConfig.isPublishingHistogram()) { | ||
return new StackdriverFixedBoundaryHistogram(clock, distributionStatisticConfig); | ||
} | ||
return NoopHistogram.INSTANCE; | ||
} | ||
|
||
static class StackdriverClientSidePercentilesHistogram extends TimeWindowPercentileHistogram { | ||
|
||
StackdriverClientSidePercentilesHistogram(Clock clock, | ||
DistributionStatisticConfig distributionStatisticConfig) { | ||
super(clock, distributionStatisticConfig, true, false, true); | ||
} | ||
|
||
} | ||
|
||
static class StackdriverFixedBoundaryHistogram extends TimeWindowFixedBoundaryHistogram { | ||
|
||
StackdriverFixedBoundaryHistogram(Clock clock, DistributionStatisticConfig config) { | ||
super(clock, config, true, false, true); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ometer-registry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverTimer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2025 VMware, Inc. | ||
* | ||
* Licensed 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 io.micrometer.stackdriver; | ||
|
||
import io.micrometer.core.instrument.Clock; | ||
import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; | ||
import io.micrometer.core.instrument.distribution.pause.PauseDetector; | ||
import io.micrometer.core.instrument.step.StepTimer; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static io.micrometer.stackdriver.StackdriverHistogramUtil.stackdriverHistogram; | ||
|
||
class StackdriverTimer extends StepTimer { | ||
|
||
public StackdriverTimer(Id id, Clock clock, DistributionStatisticConfig distributionStatisticConfig, | ||
PauseDetector pauseDetector, TimeUnit baseTimeUnit, long stepDurationMillis) { | ||
super(id, clock, distributionStatisticConfig, pauseDetector, baseTimeUnit, stepDurationMillis, | ||
stackdriverHistogram(clock, distributionStatisticConfig)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.