Skip to content

Commit

Permalink
Updated placeholder
Browse files Browse the repository at this point in the history
Signed-off-by: Asif Sohail Mohammed <[email protected]>
Signed-off-by: Asif Sohail Mohammed <[email protected]>
  • Loading branch information
asifsmohammed committed Feb 14, 2023
1 parent 7fa2ec1 commit fe23191
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data-prepper-plugins/http-source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ source:
## Configurations

* port (Optional) => An `int` between 0 and 65535 represents the port source is running on. Default is ```2021```.
* path (Optional) => A `string` which represents the URI path for log ingestion, and it should start with `/`. Path can contain `${PIPELINE_NAME}` placeholder which will be replaced with pipeline name. Default value is `/log/ingest`.
* path (Optional) => A `string` which represents the URI path for log ingestion, and it should start with `/`. Path can contain `${pipelineName}` placeholder which will be replaced with pipeline name. Default value is `/log/ingest`.
* health_check_service (Optional) => A `boolean` that determines if a `/health` endpoint on the defined port will be home to a health check. Default is `false`
* unauthenticated_health_check (Optional) => A `boolean` that determines if the health endpoint will require authentication. This option is ignored if no authentication is defined. Default is `false`
* request_timeout (Optional) => An `int` larger than 0 represents request timeout in millis. Default is ```10_000```.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@DataPrepperPlugin(name = "http", pluginType = Source.class, pluginConfigurationType = HTTPSourceConfig.class)
public class HTTPSource implements Source<Record<Log>> {
private static final Logger LOG = LoggerFactory.getLogger(HTTPSource.class);
private static final String PIPELINE_NAME_PLACEHOLDER = "${pipelineName}";
public static final String REGEX_HEALTH = "regex:^/(?!health$).*$";

private final HTTPSourceConfig sourceConfig;
Expand Down Expand Up @@ -122,7 +123,7 @@ public void start(final Buffer<Record<Log>> buffer) {
maxPendingRequests, blockingTaskExecutor.getQueue());
final LogThrottlingRejectHandler logThrottlingRejectHandler = new LogThrottlingRejectHandler(maxPendingRequests, pluginMetrics);

final String httpSourcePath = sourceConfig.getPath().replace("${PIPELINE_NAME}", pipelineName);
final String httpSourcePath = sourceConfig.getPath().replace(PIPELINE_NAME_PLACEHOLDER, pipelineName);
sb.decorator(httpSourcePath, ThrottlingService.newDecorator(logThrottlingStrategy, logThrottlingRejectHandler));
final LogHTTPService logHTTPService = new LogHTTPService(sourceConfig.getBufferTimeoutInMillis(), buffer, pluginMetrics);
sb.annotatedService(httpSourcePath, logHTTPService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void testHTTPSJsonResponse() {
void testHTTPSJsonResponse_with_custom_path_along_with_placeholder() {
reset(sourceConfig);
when(sourceConfig.getPort()).thenReturn(2021);
when(sourceConfig.getPath()).thenReturn("/${PIPELINE_NAME}/test");
when(sourceConfig.getPath()).thenReturn("/${pipelineName}/test");
when(sourceConfig.getThreadCount()).thenReturn(200);
when(sourceConfig.getMaxConnectionCount()).thenReturn(500);
when(sourceConfig.getMaxPendingRequests()).thenReturn(1024);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
grok-pipeline:
source:
http:
path: "/${PIPELINE_NAME}/logs"
path: "/${pipelineName}/logs"
processor:
- grok:
match:
Expand Down

0 comments on commit fe23191

Please sign in to comment.