-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert PlaceholderFactory to interface (#327)
Changes the PlaceholderFactory class to be an interface instead. This should give us more flexibility later on if needed. Also does some cleanup: * Remove unused NoopPlaceholderId class. * Specify registry when constructing a PlaceholderId rather then when invoking resolveToId. * Remove tags method from PlaceholderId interface, which was a legacy from when the interface extended Id.
- Loading branch information
1 parent
5761175
commit f301832
Showing
13 changed files
with
144 additions
and
188 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
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
65 changes: 65 additions & 0 deletions
65
...ceholders/src/main/java/com/netflix/spectator/placeholders/DefaultPlaceholderFactory.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,65 @@ | ||
/** | ||
* Copyright 2016 Netflix, 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 | ||
* | ||
* http://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.netflix.spectator.placeholders; | ||
|
||
import com.netflix.spectator.api.Counter; | ||
import com.netflix.spectator.api.DistributionSummary; | ||
import com.netflix.spectator.api.Registry; | ||
import com.netflix.spectator.api.Timer; | ||
|
||
/** | ||
* Factory for creating instances of activity based meters with placeholders in the | ||
* identifiers so that the final id can be resolved when the activity takes place. | ||
*/ | ||
final class DefaultPlaceholderFactory implements PlaceholderFactory { | ||
|
||
private final Registry registry; | ||
|
||
/** | ||
* Create a new instance of the factory. | ||
* | ||
* @param registry | ||
* the registry to use when creating ids | ||
*/ | ||
DefaultPlaceholderFactory(Registry registry) { | ||
this.registry = registry; | ||
} | ||
|
||
@Override | ||
public PlaceholderId createId(String name) { | ||
return new DefaultPlaceholderId(name, registry); | ||
} | ||
|
||
@Override | ||
public PlaceholderId createId(String name, Iterable<TagFactory> tagFactories) { | ||
return DefaultPlaceholderId.createWithFactories(name, tagFactories, registry); | ||
} | ||
|
||
@Override | ||
public Counter counter(PlaceholderId id) { | ||
return new DefaultPlaceholderCounter(id, registry); | ||
} | ||
|
||
@Override | ||
public DistributionSummary distributionSummary(PlaceholderId id) { | ||
return new DefaultPlaceholderDistributionSummary(id, registry); | ||
} | ||
|
||
@Override | ||
public Timer timer(PlaceholderId id) { | ||
return new DefaultPlaceholderTimer(id, registry); | ||
} | ||
} |
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
76 changes: 0 additions & 76 deletions
76
...-ext-placeholders/src/main/java/com/netflix/spectator/placeholders/NoopPlaceholderId.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.