-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Application Signals runtime metrics with feature disabled (#900)
## Feature request Add runtime metrics collection into Application Signals. ## Description of changes: This PR is (mostly) equivalent to [Add Application Signals runtime metrics #881](#881). The difference is that it disables runtime metrics for now. We split the core function from feature enablement because there are other ongoing feature developments depending on the changes made by runtime metrics. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. *Issue #, if available:* *Description of changes:* By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
12 changed files
with
747 additions
and
41 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
44 changes: 44 additions & 0 deletions
44
...a/software/amazon/opentelemetry/javaagent/providers/AwsResourceAttributeConfigurator.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,44 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 software.amazon.opentelemetry.javaagent.providers; | ||
|
||
import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_NAME; | ||
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE; | ||
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.UNKNOWN_SERVICE; | ||
|
||
import io.opentelemetry.api.common.AttributesBuilder; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
|
||
public class AwsResourceAttributeConfigurator { | ||
// As per | ||
// https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#opentelemetry-resource | ||
// If service name is not specified, SDK defaults the service name to unknown_service:java | ||
private static final String OTEL_UNKNOWN_SERVICE = "unknown_service:java"; | ||
|
||
public static void setServiceAttribute( | ||
Resource resource, AttributesBuilder attributesBuilder, Runnable handleUnknownService) { | ||
String service = resource.getAttribute(AWS_LOCAL_SERVICE); | ||
if (service == null) { | ||
service = resource.getAttribute(SERVICE_NAME); | ||
// In practice the service name is never null, but we can be defensive here. | ||
if (service == null || service.equals(OTEL_UNKNOWN_SERVICE)) { | ||
service = UNKNOWN_SERVICE; | ||
handleUnknownService.run(); | ||
} | ||
} | ||
attributesBuilder.put(AWS_LOCAL_SERVICE, service); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...java/software/amazon/opentelemetry/javaagent/providers/CloudWatchTemporalitySelector.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,27 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 software.amazon.opentelemetry.javaagent.providers; | ||
|
||
import io.opentelemetry.sdk.metrics.data.AggregationTemporality; | ||
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector; | ||
|
||
public class CloudWatchTemporalitySelector { | ||
static AggregationTemporalitySelector alwaysDelta() { | ||
return (instrumentType) -> { | ||
return AggregationTemporality.DELTA; | ||
}; | ||
} | ||
} |
Oops, something went wrong.