• /
  • ログイン
  • 無料アカウント

incrementAttribute (Android SDK API)

Syntax

NewRelic.incrementAttribute(string $name[, float $value])

Increments the count of an attribute. Overwrites its previous value and type each time it is called.

Requirements

Agent version 5.0.0 or higher.

Description

When passed with only a name value, this method increments the count for the specified attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1. When passed an optional float value, it increments the count for the specified attribute by the float value.

For context on how to use this API, see Send custom attributes and events to Insights.

Parameters

Parameter

Description

$name

string

Required. The name of the attribute.

$value

float

Optional. The attribute is incremented by this float value.

Return values

Returns true if recorded successfully, or false if not.

Examples

Increment attribute

Increments the count for the specified attribute by 1. If the attribute does not exist, it creates the attribute with a value of 1.

boolean incremented = NewRelic.incrementAttribute("rate");

Increment attribute by specific amount

Increments the count for the specified attribute by the float value amount:

boolean incremented = NewRelic.incrementAttribute("rate", 9999.99, false);

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.