-
Notifications
You must be signed in to change notification settings - Fork 4.6k
add datadog io normalization and yaml #38362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
derrickaw
wants to merge
39
commits into
apache:master
Choose a base branch
from
derrickaw:20260122_addDatadogIONormalization
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,235
−1
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
382d5f7
draft files
derrickaw e1ba13f
currently works
derrickaw f8ef26a
initial test file
derrickaw a43a6d6
add more test cases
derrickaw 0112eeb
add doc strings and slight code improvements
derrickaw e1f9e1a
adding more test cases and working out errorHandling
derrickaw 266bc3b
works with one test failure
derrickaw d36e1d3
updated error handling logic and add more tests
derrickaw 6ceede3
fix conflict with standard_io
derrickaw 4634bc6
all tests pass - need to add write verification through Datadog agent…
derrickaw 48ddf46
first draft of yaml test file
derrickaw aa4f4a9
some minor changes to schematransformer and write error schema; also …
derrickaw 1ae1f82
working snapshot before simplification
derrickaw 2b13101
combine errors
derrickaw 8caaaf4
import constants
derrickaw e69213b
rollback DatadogIO cleanups
derrickaw 17a15e1
rollback DatadogWriteError cleanups
derrickaw 28aa96e
rollback SYNCHRONIZED_PROCESSING_TIME in timeutil.py
derrickaw 20b8b2e
simplify expansion-service datadog dependency to runtimeOnly
derrickaw c788e8f
revert some previous cleanup operations
derrickaw 77609a3
restore proper trailing newline to build.gradle
derrickaw f63db8c
fix lint issues
derrickaw a1daa18
run standard external transform script
derrickaw 18a5f1d
fix gemini review comments
derrickaw 1ec81d8
update logic for better performance
derrickaw 60577bd
fix yaml row failure
derrickaw a61d32d
Trigger fresh CI/CD run
derrickaw 8674ebf
update coder
derrickaw b028533
old design parts
derrickaw 7517397
revert datadogio coder change and try to cover in integration_tests
derrickaw 8d42334
fix coder
derrickaw 4b47336
fix lint
derrickaw 987287b
address more geminic comments
derrickaw 6a714f3
fix error output
derrickaw c16aa62
fix another gemini review
derrickaw 1f56bca
remove some dead code
derrickaw 868eba6
fix spotless
derrickaw d9a4c56
revert venv
derrickaw c943fdc
address comments
derrickaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
...rc/main/java/org/apache/beam/sdk/io/datadog/DatadogWriteSchemaTransformConfiguration.java
This file contains hidden or 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,114 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF 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 | ||
| * | ||
| * 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 org.apache.beam.sdk.io.datadog; | ||
|
|
||
| import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkArgument; | ||
|
|
||
| import com.google.auto.value.AutoValue; | ||
| import javax.annotation.Nullable; | ||
| import org.apache.beam.sdk.schemas.AutoValueSchema; | ||
| import org.apache.beam.sdk.schemas.annotations.DefaultSchema; | ||
| import org.apache.beam.sdk.schemas.annotations.SchemaFieldDescription; | ||
| import org.apache.beam.sdk.schemas.transforms.providers.ErrorHandling; | ||
| import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Strings; | ||
|
|
||
| /** | ||
| * Configuration for writing to Datadog. | ||
| * | ||
| * <p>This class is meant to be used with {@link DatadogWriteSchemaTransformProvider}. | ||
| */ | ||
| @DefaultSchema(AutoValueSchema.class) | ||
| @AutoValue | ||
| public abstract class DatadogWriteSchemaTransformConfiguration { | ||
|
|
||
| public void validate() { | ||
| String invalidConfigMessage = "Invalid Datadog Write configuration: "; | ||
| checkArgument(!getUrl().isEmpty(), invalidConfigMessage + "url must be specified."); | ||
| checkArgument(!getApiKey().isEmpty(), invalidConfigMessage + "apiKey must be specified."); | ||
| Integer batchCount = getBatchCount(); | ||
| if (batchCount != null) { | ||
| checkArgument(batchCount > 0, invalidConfigMessage + "batchCount must be greater than 0."); | ||
| } | ||
| Integer minBatchCount = getMinBatchCount(); | ||
| if (minBatchCount != null) { | ||
| checkArgument( | ||
| minBatchCount > 0, invalidConfigMessage + "minBatchCount must be greater than 0."); | ||
| } | ||
| Long maxBufferSize = getMaxBufferSize(); | ||
| if (maxBufferSize != null) { | ||
| checkArgument( | ||
| maxBufferSize > 0, invalidConfigMessage + "maxBufferSize must be greater than 0."); | ||
| } | ||
| Integer parallelism = getParallelism(); | ||
| if (parallelism != null) { | ||
| checkArgument(parallelism > 0, invalidConfigMessage + "parallelism must be greater than 0."); | ||
| } | ||
| ErrorHandling errorHandling = getErrorHandling(); | ||
| if (errorHandling != null) { | ||
| checkArgument( | ||
| !Strings.isNullOrEmpty(errorHandling.getOutput()), | ||
| invalidConfigMessage + "Output must not be empty if error handling specified."); | ||
| } | ||
| } | ||
|
|
||
| /** Instantiates a {@link DatadogWriteSchemaTransformConfiguration.Builder} instance. */ | ||
| public static DatadogWriteSchemaTransformConfiguration.Builder builder() { | ||
| return new AutoValue_DatadogWriteSchemaTransformConfiguration.Builder(); | ||
| } | ||
|
|
||
| @SchemaFieldDescription("The Datadog API URL.") | ||
| public abstract String getUrl(); | ||
|
|
||
| @SchemaFieldDescription("The Datadog API key.") | ||
| public abstract String getApiKey(); | ||
|
|
||
| @SchemaFieldDescription("The minimum number of events to batch together for each write.") | ||
| public abstract @Nullable Integer getMinBatchCount(); | ||
|
|
||
| @SchemaFieldDescription("The number of events to batch together for each write.") | ||
| public abstract @Nullable Integer getBatchCount(); | ||
|
|
||
| @SchemaFieldDescription("The maximum buffer size in bytes.") | ||
| public abstract @Nullable Long getMaxBufferSize(); | ||
|
|
||
| @SchemaFieldDescription("The degree of parallelism for writing.") | ||
| public abstract @Nullable Integer getParallelism(); | ||
|
|
||
| @SchemaFieldDescription("Specifies how to handle errors.") | ||
| public abstract @Nullable ErrorHandling getErrorHandling(); | ||
|
|
||
| @AutoValue.Builder | ||
| public abstract static class Builder { | ||
| public abstract Builder setUrl(String url); | ||
|
|
||
| public abstract Builder setApiKey(String apiKey); | ||
|
|
||
| public abstract Builder setMinBatchCount(Integer minBatchCount); | ||
|
|
||
| public abstract Builder setBatchCount(Integer batchCount); | ||
|
|
||
| public abstract Builder setMaxBufferSize(Long maxBufferSize); | ||
|
|
||
| public abstract Builder setParallelism(Integer parallelism); | ||
|
|
||
| public abstract Builder setErrorHandling(@Nullable ErrorHandling errorHandling); | ||
|
|
||
| /** Builds the {@link DatadogWriteSchemaTransformConfiguration} configuration. */ | ||
| public abstract DatadogWriteSchemaTransformConfiguration build(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.